is there a bug in imregcorr-function for transformtype "rigid" ?

23 visualizzazioni (ultimi 30 giorni)
I have tried some examples where imregcorr does not give the wanted result for the transformtype "rigid" , for the same examples I obtain the correct result when using "similarity" .
Here is one example :
I1 = imread('...\cameraman.tif');
FIXED = im2double(I1);
MOVING = imrotate(I1,125);
fixedRefObj = imref2d(size(FIXED));
movingRefObj = imref2d(size(MOVING));
tform = imregcorr(MOVING,movingRefObj,FIXED,fixedRefObj,'transformtype','rigid','Window',true);
MOVINGREG.RegisteredImage = imwarp(MOVING, movingRefObj, tform, 'OutputView', fixedRefObj,'interp','cubic', 'SmoothEdges', true);
imshow(MOVINGREG.RegisteredImage) giving the following output image :
This is far away from the original cameraman image, which was rotated 125 degrees counterclockwise
  1 Commento
Eirik Kvernevik
Eirik Kvernevik il 28 Ott 2021
I have found problems for the "rigid" transformtype for a multiple og angles : a bunch of angles between 21 and 87 degrees , and a bunch between 133 and 239 degrees is what I have found so far.
there also seems to be a problem with the "similarity" type for 88, 89, 268 and 269 degrees . Would be interesting if anyone else have problems with this or if someone have a solution to this ?

Accedi per commentare.

Risposta accettata

Steve Eddins
Steve Eddins il 16 Ott 2025 alle 19:13
Modificato: Steve Eddins circa 2 ore fa
As of R2024b, the function imregcorr uses a new algorithm called normalized gradient correlation. See my 16-Oct-2025 blog post for more information. The function can now register this image pair successfully.
fixed_image = imread("cameraman.tif");
moving_image = imrotate(fixed_image, 125);
tiledlayout(1,2)
nexttile
imshow(fixed_image), title("fixed image")
nexttile
imshow(moving_image), title("moving image")
tform = imregcorr(moving_image, fixed_image)
tform =
simtform2d with properties: Dimensionality: 2 Scale: 1.0001 RotationAngle: 124.9967 Translation: [377.8203 84.5295] R: [2×2 double] A: [-0.5736 -0.8193 377.8203 0.8193 -0.5736 84.5295 0 0 1.0000]
[moving_image_reg,moving_reg_ref] = imwarp(moving_image, imref2d(size(moving_image)), tform);
clf
imshowpair(fixed_image,imref2d(size(fixed_image)),moving_image_reg,moving_reg_ref)
  1 Commento
Eirik Kvernevik
Eirik Kvernevik circa 3 ore fa
great, thank you for reply and the upgrade . I will have a look at this when I have the possibility, I currently do not have a version of matlab available as Im not a student anymore and it is a copule of years since I worked with matlab.

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by