How to check if there is a shift in the images, and output the shift in terms of values

10 views (last 30 days)
Hi , I have 2 gray images having very slight differences, I want to check if there is shift or change in between those 2 images. How can I do that.I used normx2corr command and get the corr_offset, but its always 0 0 , where as there is a difference in the images.Any help or advice would be appreciated.
im1 = imread('image1.png');
im2 = imread('image2.png');
im1a=rgb2gray(im1);
im2a=rgb2gray(im2);
cc = normxcorr2(im1a,im2a);
[max_cc, imax] = max(abs(cc(:)));
[ypeak, xpeak] = ind2sub(size(cc),imax(1));
corr_offset_1 = [ (ypeak-size(im1a,1)) (xpeak-size(im1a,2)) ]
output -->corr_offset =
0 0

Answers (0)

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!