Borrar filtros
Borrar filtros

imregcorr() misaligns images badly

66 visualizaciones (últimos 30 días)
Nathan Nguyen
Nathan Nguyen el 3 de Jul. de 2024 a las 20:28
Editada: Matt J el 9 de Jul. de 2024 a las 23:35
[tform, peakregcorr] = imregcorr(SourceImageAdj,SourceRef, ...
TargetImageAdj,TargetRef, ...
'transformType', 'similarity', ...
'Window', true);
RegisteredImage = imwarp(SourceImageAdj,SourceRef, tform, 'linear', ...
'OutputView', TargetRef);
disp(peakregcorr)
figure, imshowpair(TargetImageAdj,TargetRef,RegisteredImage, TargetRef)
above is my code to correlate 2 images of different sizes. the goal is to find the correlation between the images to determine what pixel location a point of interest might lie in both images. However, imregcorr consistently misses the mark badly.
Whereas the code above might output a tform object - Dimensionality: 2, Scale: 0.4254, RotationAngle: 2.4851, Translation: [-0.3269 -0.0904]
A more correct tform object (based upon the output image would look like - Dimensionality: 2, Scale: 1, RotationAngle: -1, Translation: [0.0640 0]
The SourceRef and TargetRef seem correct, so Im not sure what is causing the issue
  2 comentarios
Garmit Pant
Garmit Pant el 4 de Jul. de 2024 a las 5:24
Hello
Can you please provide the input images that you are using?
Regards
Nathan Nguyen
Nathan Nguyen el 8 de Jul. de 2024 a las 20:51
Editada: Nathan Nguyen el 8 de Jul. de 2024 a las 20:55
these are the input images that I am using
srcimg - source image
srcref - source reference imref2d
targetim - target image
tgtref - target reference imref2d
tform - transformation object that is formed from the images
The problem is that my original source image is 512x512 whereas the target image is 2048x2044

Iniciar sesión para comentar.

Respuesta aceptada

Matt J
Matt J el 8 de Jul. de 2024 a las 23:18
Editada: Matt J el 8 de Jul. de 2024 a las 23:19
Phase correlation isn't going to be a good algorithm for images of a starry field. I think your best bet is to do landmark extraction -- either manually with cpselect or automatically if you have some way to do that -- and then use fitgeotform2d.
[sp,tp] = cpselect(SourceImageAdj, TargetImageAdj ,'Wait',true);
[sp(:,1), sp(:,2)]=intrinsicToWorld(SourceRef, sp(:,1), sp(:,2))
[tp(:,1), tp(:,2)]=intrinsicToWorld(TargetRef, tp(:,1), tp(:,2))
tform = fitgeotform2d(sp,tp,'similarity')
RegisteredImage = imwarp(SourceImageAdj,SourceRef, tform, 'linear', ...
'OutputView', TargetRef);
figure, imshowpair(TargetImageAdj,TargetRef,RegisteredImage, TargetRef)
  1 comentario
Nathan Nguyen
Nathan Nguyen el 9 de Jul. de 2024 a las 20:01
Editada: Matt J el 9 de Jul. de 2024 a las 23:35
Thanks yeah manual selection seems to work well!
This isn't relevant to the question specifically but if I found all of the feature detection algorithms from matlab on this webpage. These seems to be pretty useful https://www.mathworks.com/help/images/techniques-supported-by-registration-estimator-app.html

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by