- “imregister” function: https://www.mathworks.com/help/releases/R2021a/images/ref/imregister.html
- “imregconfig” function: https://www.mathworks.com/help/releases/R2021a/images/ref/imregconfig.html
Issue with image registration.
11 views (last 30 days)
Show older comments
Ridhima Chopra
on 21 Feb 2024
Commented: Image Analyst
on 2 Mar 2024
I have attached my image registration matlab file.
The input/moving image I have taken is:
The moving and fixed images are same.
After the hamming distance is calculated between the fixed image and the registered/ the moving image, why is the hamming distance not coming zero?
for these lines:
difference =abs(original - transformed_img);
distance = (sum(difference(:)))
Output comes out like:
distance =
214.3689.
However both the images look exactly the same, before and after transformation. Is there any way to prevent the change in pixel values after image registration?
0 Comments
Accepted Answer
Garmit Pant
on 29 Feb 2024
Hello Ridhima
From what I gather, you are applying image registration on the same image using feature matching method and are facing an issue with the transformed image not exactly matching the original image.
Since the method of image registration being employed here is feature matching'and then warping the image using the “imwarp” function, it is expected output to have some pixel-level discrepancy between the original and transformed image. This discrepancy can arise due to interpolation artifacts and algorithmic nuances inherent in the feature matching image registration process and the implementation of the function.
Since the images are the same, you can apply the intensity-based image registration method. Following is a code snippet to use intensity-based image registration:
grayFrame1 = imread("peppers.png"); %fixed image
grayFrame1=rgb2gray(grayFrame1);
original = grayFrame1;
grayFrame2= imread("peppers.png"); %moving image
grayFrame2=rgb2gray(grayFrame2);
subplot(1,2,1)
imshow(grayFrame1)
title('Fixed Image')
subplot(1,2,2)
imshow(grayFrame2)
title('Moving Image')
[optimizer, metric] = imregconfig('monomodal');
movingRegistered = imregister(grayFrame2,grayFrame1,'rigid',optimizer, metric);
figure
imshowpair(grayFrame1, movingRegistered,'Scaling','joint')
difference =abs(original - movingRegistered);
distance = (sum(difference(:)))
For further understanding the methods mentioned above, you can refer to the following MATLAB Documentation:
I hope you find the above explanation and suggestions useful!
3 Comments
More Answers (0)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!