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

21 Ansichten (letzte 30 Tage)
Eirik Kvernevik
Eirik Kvernevik am 28 Okt. 2021
Bearbeitet: Steve Eddins am 19 Okt. 2025 um 13:14
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 Kommentar
Eirik Kvernevik
Eirik Kvernevik am 28 Okt. 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 ?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Steve Eddins
Steve Eddins am 16 Okt. 2025 um 19:13
Bearbeitet: Steve Eddins vor etwa 18 Stunden
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 Kommentar
Eirik Kvernevik
Eirik Kvernevik vor etwa 19 Stunden
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by