Find size of template in image cross correlation

1 view (last 30 days)
Dear All;
I am using image cross correlation to determine the displacement of moving object but i have trouble to determine the size of the template . each time i change the size of the template i got something different . how can i resolve this problem .
Best Regards
  1 Comment
Tushar Sinha
Tushar Sinha on 11 Jan 2016
Hi Mustafa,
Could you please share a small example showing where exactly you are seeing the issue? Also, could you please clarify what you mean by changing the size of the template?
-Tushar

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 11 Jan 2016
Hopefully you're using normalized cross correlation, normxcorr2(), and not xcorr2(). It's a common misconception that regular correlation will locate a template. It can but it's not very robust. You can easily think of situations where the template won't be found, like where you have a dark template and bright other areas. And of course if you threshold the correlation then it's possible that there may be several possible areas that the template exists in the image. But you need to threshold because of the presence of noise - you can't just go for an exact match, though taking the highest value would get the location in most situations I believe. See my attached demo.

Community Treasure Hunt

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

Start Hunting!