FUNCTION REFERENCE
imregister
Register two 2-D images by intensity: align moving with fixed.
Register two 2-D images by intensity: align moving with fixed.
Syntax
movingReg = imregister(moving, fixed, transformType, optimizer, metric)Syntax
[movingReg, Rreg] = imregister(moving, Rmoving, fixed, Rfixed, transformType, optimizer, metric)Syntax
[movingReg, Rreg] = imregister(..., 'DisplayOptimization', tf, 'InitialTransformation', tform0, 'PyramidLevels', n)Estimates tform as imregtform does (same inputs and options) and returns movingReg = imwarp(moving, Rmoving, tform, 'OutputView', Rfixed) with linear interpolation: movingReg has the size of fixed and the class of moving, and pixels that map outside moving are 0. Rreg is Rfixed (imref2d(size(fixed)) when no referencing objects are given). Use imregtform to get the transformation itself, and imshowpair or imfuse to compare movingReg with fixed.
Example
[x, y] = meshgrid(1:64); fixed = exp(-((x - 26).^2 + (y - 34).^2)/60) + 0.8*exp(-((x - 40).^2 + (y - 24).^2)/30) + 0.6*exp(-((x - 38).^2 + (y - 44).^2)/40); [optimizer, metric] = imregconfig('monomodal'); moving = imwarp(fixed, rigidtform2d(3, [1 -2]), 'OutputView', imref2d(size(fixed))); movingReg = imregister(moving, fixed, 'rigid', optimizer, metric); max(max(abs(movingReg(8:56, 8:56) - fixed(8:56, 8:56)))) % about 0.02Example
[x, y] = meshgrid(1:64); fixed = exp(-((x - 26).^2 + (y - 34).^2)/60) + 0.8*exp(-((x - 40).^2 + (y - 24).^2)/30) + 0.6*exp(-((x - 38).^2 + (y - 44).^2)/40); [optimizer, metric] = imregconfig('monomodal'); moving = imwarp(fixed, transltform2d(2, 1), 'OutputView', imref2d(size(fixed))); [movingReg, Rreg] = imregister(uint8(255*moving), uint8(255*fixed), 'translation', optimizer, metric); class(movingReg) % 'uint8'Differences from MATLAB: the estimate follows the choices listed under imregtform. 3-D volumes are not supported yet.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.