Clear Filters
Clear Filters

Normalized 2D cross correlation

3 views (last 30 days)
MING-CHANG CHIU
MING-CHANG CHIU on 5 Apr 2015
Answered: Image Analyst on 5 Apr 2015
Hi, in this document normxcorr2, the example that Mathworks provide has the following snippet
c = normxcorr2(onion,peppers);
[ypeak, xpeak] = find(c==max(c(:)));
yoffSet = ypeak-size(onion,1);
xoffSet = xpeak-size(onion,2);
Does anyone know why the dimension of "c" is about (size(onion,1)+size(peppers,1)*)(size(onion,2)+size(peppers,2))? and what are the meanings of xoffset and yoffset? why do they need to be acquired like that?
In the example in the URL, the template is exactly croped from A. But what if my template and image are of different scales? How do I get the desired area?
thanks,

Answers (1)

Image Analyst
Image Analyst on 5 Apr 2015
When you correlate or convolve two images, the result is bigger because you will still have overlap even if only part of the images overlap, like one image is mostly outside the other image and only the right column of the left image overlap the left column of the right image.
By the way, I've attached my demo on template finding using normxcorr2.

Community Treasure Hunt

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

Start Hunting!