Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 1
    Is there also a way to do this when the template image can sometimes be a little different from the original image? I need to do this on multiple images but because of JPEG compression, the symbols are slightly different every time. Commented Nov 14, 2019 at 9:19
  • 1
    I have found another way to use multiple templates to detect symbols i have also posted my answer below. Commented Nov 14, 2019 at 12:00
  • 2
    It should still work if your template is slightly different due to JPEG compression since it determines the "best" correlation value so even if your template not exactly the same, you should still obtain a pretty good estimate. Take a look at template matching for multiple objects but this method assumes that the template and the desired object to find are exactly the same size. Commented Nov 14, 2019 at 19:50
  • @NizarB. I'm not sure what you mean, the bounding box coordinates are found in start_x, start_y, end_x, and end_y. You could calculate the centroid from there Commented Feb 10, 2020 at 20:49
  • 1
    No that calculation is wrong, to find centroid its x=start_x +(end_x - start_x)/2 and y=start_y + (end_y - start_y)/2. Draw the points out to visualize the box Commented Feb 11, 2020 at 20:35