How to interpret the drift between 2 images, using cross-correlation?

2 views (last 30 days)
Hi, I am a beginner in Matlab and I need to remove the drift (which exists because of the microscope when capturing the images at different time) betw my two images so that they can be comparable. To identify my drift, I found this code using the function normxcorr2 :
c = normxcorr2(picture1,picture2);
[max_c, imax] = max(abs(c(:))); %find the max value
[ypeak, xpeak] = ind2sub(size(c),imax(1)); %Find peak in cross-correlation.
corr_offset = round([(xpeak-(size(c,2)+1)/2) (ypeak-(size(c,1)+1)/2)]);
offset = corr_offset;
xoffset = offset(1);
yoffset = offset(2);
and I found the following results :
xpeak=195
ypeak=136
max_c=0.7250
offset=[-1,-1]
xoffset=-1
yoffset=-1
I am a bit confused about how to interpret these results. Does it mean there is a drift of -0.7250 in the direction y and -0.7250 in the direction x? Is this result in pixel or meter?
Thank you for your help!

Answers (0)

Community Treasure Hunt

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

Start Hunting!