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

조회 수: 23 (최근 30일)
Eirik Kvernevik
Eirik Kvernevik 2021년 10월 28일
편집: Steve Eddins 2025년 10월 19일 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
Eirik Kvernevik
Eirik Kvernevik 2021년 10월 28일
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 ?

댓글을 달려면 로그인하십시오.

채택된 답변

Steve Eddins
Steve Eddins 2025년 10월 16일 19:13
편집: Steve Eddins 대략 22시간 전
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
Eirik Kvernevik
Eirik Kvernevik 대략 23시간 전
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by