mkto
mkto

Reputation: 4664

how to analyze min max loc returned by opencv's cvMatchTemplate?

I am trying to detect objects in image on an iphone app.

I am using the cvMatchTemplate function, I manage to see some patterns returned by the cvMatchTemplate function (I chose CV_TM_CCOEFF_NORMED).

Positive Results (result image is 163x371):

http://encryptedpixel.files.wordpress.com/2011/07/photo-13-7-11-11-52-19-am.jpeg

cvMinMaxLoc returns: min (102,244) max(11,210) The min point is making some sense here, the position of the dark spot is really 102,244 in the result image of 163x371

Negative Results:

enter image description here

cvMinMaxLoc returns: min (114,370) max(0,0) This is not making sense, there is totally no results, why is there still a min point at 114,370?

I need to know how to analyze these results programatically so that I can say "Hey I found the object!" in objectiveC for iPhone app?

Thanks!

Upvotes: 2

Views: 2182

Answers (1)

cesarbs
cesarbs

Reputation: 934

cvMinMaxLoc will always return the position of the minimum and maximum values of their input. It only "doesn't make sense" in your particular application. You should check the value at the returned position for the minimum and do something like threshold it to see if that's a probable match for your template. A template match will yield a very low or a very high value, depending on the method you chose.

Upvotes: 2

Related Questions