matchTemplate unsatisfying results (OpenCV 3.4.1/C++)

asked 2018-04-05 13:29:02 -0500

Graf gravatar image

updated 2018-04-05 13:32:14 -0500

Hey guys!

I try to find two markers (kinda like image description) on a white peace of paper showing in a live webcam feed. In a basic test without the webcam, just using two static pictures and if the marker is the same size in the comparing picture i get good results. If i change the size of the marker in the picture i'd like matchTemplate to find, it won't work. So i guess there is a size problem i have to solve first.

There are a few matchTemplate examples out there but non of them work if the marker image differs.

Since i don't really know where to start or if it is even possible to use matchTemplate this way, i hope some one here can point me in the right direction or maybe got an alternative to matchTemplate.


edit retag flag offensive close merge delete


"showing in a live webcam feed" -- note , that template matching is not invariant to scaling / rotation / perspective.

(it's probably the wrong tool for your job)

please have a look at aruco markers , those will work much better here.

berak gravatar imageberak ( 2018-04-05 13:31:12 -0500 )edit

Thank you for your comment. I did look into aruco markers yesterday but they look like overkill for my little project. I just try to accomplish to find two markers on a paper and draw a rectangle between them. At least it sounds simple and all 2d based.

Graf gravatar imageGraf ( 2018-04-05 13:41:57 -0500 )edit