0
$\begingroup$

I am using OpenCv's built in template matching function to search for an object in image. I am using Normalized Cross Correlation Method.The function is returning a value which I think indication of similarity so the larger value the more similar template.The problem is NCC value when object is matched is 0.93 whereas NCC value when different regions are found is 0.91 .

Is the value returned by NCC percentage of similarity ? If so how can different templates produce high score ?

$\endgroup$
5
  • $\begingroup$ Without seeing them, my guess is that you're not subtracting the mean. See pre-whitening : sites.google.com/site/kootsoop/prewhitening $\endgroup$
    – Peter K.
    Commented Dec 17, 2014 at 12:39
  • $\begingroup$ @PeterK. I am applying histogram equalization.Also I am applying this operation to Local Binary Patterns image of image.LBP should be independent of light. $\endgroup$ Commented Dec 17, 2014 at 13:12
  • $\begingroup$ The trouble with histogram equalization is that it will make the statistics of everything look the same. That may be a bad thing if you're using NCC. Try some simpler pre-processing of the image: 1) remove the mean. 2) do a simple whitening (e.g. diff the rows from each other). What you're aiming for is to make the template look as different from the rest of the image as possible. $\endgroup$
    – Peter K.
    Commented Dec 17, 2014 at 13:35
  • $\begingroup$ Thank you.But after 1st operation difference between matching and non-matching regions are being clear. As for 2nd operation it is distorting the image and template matching.If I am not missing "diff the rows from each other" means subtract previous row from a row,right? $\endgroup$ Commented Dec 17, 2014 at 15:36
  • $\begingroup$ Right. I'm wondering if the diff operation is causing too much change to the template compared with the image. Perhaps look at using a high-pass filter as the aim is to make the spectrum "whiter" (closer to uniform across all frequencies). The whiter the spectrum, the narrower the image's autocorrelation, so the bigger difference between matching and non-matching areas. $\endgroup$
    – Peter K.
    Commented Dec 17, 2014 at 21:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.