MATLAB: Xcorr2 function

cross correlationxcorr2

hello,can anybody help me how to go about using the xcorr2 function to find the cross correlation between 2 images? i need a single value of correlation between a query image and an image in the database. i have used the followin: crosscorr1=max(abs(xcorr2(double(x(:,:,1)),double(y(:,:,1))))); where x and y are d 2 images. i get a single row matrix as the output.

Best Answer

Hi, That's because you are using max() on a matrix, which returns by default the maximum values for each column. One thing you can do is to call max() on the initial max() output.
x = randn(10,10);
y = randn(10,10);
max(max(abs(xcorr2(x,y))))
Note however that xcorr2 is not a normalized cross correlation.
Wayne
Related Question