Ask Your Question

tsolre's profile - activity

2013-02-14 09:20:38 -0600 commented answer matchTemplate function, result processing

I think I found a easy way. For example i use this peace of code

       img = cv2.imread("main.bmp", cv.CV_LOAD_IMAGE_GRAYSCALE)
       img = cv2.imread("templ.bmp", cv.CV_LOAD_IMAGE_GRAYSCALE)
       result = cv2.matchTemplate(img,template,cv.CV_TM_SQDIFF)
       (min,max,minloc,maxloc) = cv2.minMaxLoc(result)
       (x,y) = minloc

But it's not enough. How I can get from result all values and coordinetes one by one from min to max ?

2013-02-11 08:34:00 -0600 received badge  Scholar (source)
2013-02-11 08:15:14 -0600 commented answer matchTemplate function, result processing

Thanks for answer. As I understood, I should to find this threshold by myself with experimentally way? And still got a chance to have false-positive reaction? Could you please explain a little bit more about method of finding centers of connected components?

2013-02-11 06:44:44 -0600 asked a question matchTemplate function, result processing

I'am using opencv for some project. And have a task which should be solved. Task is quite simple. I have a main picture and have a template(s) than I compare main pic with template. I use matchTemplate() function. I'am just curiosity about one moment. In documentation I found following info: To identify the matching area, we have to compare the template image against the source image by sliding it. By sliding, we mean moving the patch one pixel at a time (left to right, up to down). At each location, a metric is calculated so it represents how “good” or “bad” the match at that location is (or how similar the patch is to that particular area of the source image). For each location of T over I, you store the metric in the result matrix (R). Each location in R contains the match metric.

So, for example you have the main picture and the template. And you know that there is one entry of template at least in main pic. And it works fine. Also it works fine if you have more then one entry, but you still know how many entries do you have. But if you do not know how many templates are in the main picture 0 or 10? Is any way to calculate it ? Which algorithm should be used? Thanks in advance.