You are here : matlabImage Processingimregcorr

imregcorr() - Image Processing

tform = imregcorr(moving,fixed) estimates
the geometric transformation that aligns an image, moving,
with a reference image, fixed. The function returns
a geometric transformation object, tform, that
maps pixels in moving to pixels in fixed. tform = imregcorr(moving,fixed,transformtype) estimates
the geometric transformation, where transformtype is
a text string that specifies the type of transformation.tform = imregcorr(moving,Rmoving,fixed,Rfixed,___) estimates
the geometric transformation that aligns an image, moving,
with a reference image, fixed. Rmoving and Rfixed are
spatial referencing objects that contain spatial information about
the moving and fixed images,
respectively. The transformation object returned, tform,
defines the point mapping in the world coordinate system.tform = imregcorr(___,Name,Value,___) registers
the moving image to the fixed image using name-value pairs to control
various aspects of the registration algorithm.


tform = imregcorr(moving,fixed) exampletform = imregcorr(moving,fixed,transformtype)tform = imregcorr(moving,Rmoving,fixed,Rfixed,___)tform = imregcorr(___,Name,Value,___)


Register an image using phase correlation
Solve a registration problem in which an image
is synthetically scaled and rotated.
Prepare the sample fixed and moving images.fixed  = imread('cameraman.tif');

theta = 20;
S = 2.3;
tform = affine2d([S.*cosd(theta) -S.*sind(theta) 0; S.*sind(theta) S.*cosd(theta) 0; 0 0 1]);
moving = imwarp(fixed,tform);
moving = moving + uint8(10*rand(size(moving)));

figure, imshowpair(fixed,moving,'montage');
 Estimate the transformation needed to align the images
using imregcorr.tformEstimate = imregcorr(moving,fixed);
Apply estimated geometric transform to the image you want
to align (moving). The example uses the 'OutputView' parameter
to obtain a registered image the same size and with the same world
limits as the reference image. The example first views the original
image and the registered image side-by-side to check the registration.
The example then views the registered image overlaid on the original
using the 'falsecolor' option to highlight
any areas where the images differ.Rfixed = imref2d(size(fixed));
movingReg = imwarp(moving,tformEstimate,'OutputView',Rfixed);
figure, imshowpair(fixed,movingReg,'montage');
figure, imshowpair(fixed,movingReg,'falsecolor');

Output / Return Value


Alternatives / See Also