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

3 views (last 30 days)
Aude Rapet on 16 Jan 2017
Edited: Aude Rapet on 18 Jan 2017
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?