What's the best way for template matching with a mask?

asked 2018-01-08 11:54:28 -0600


Im trying to template match some UI components in a game (e.g. detect if the UI component is there, and where).
I've looked into template matching and the way proposed here is pretty good, so using TM_CCOEFF_NORMED and treshhold the maximum value.
However this doesn't allow masking, which is pretty bad considering whats actually in the UI element is often variable. The problem is, the only normed method that works with masks is CV_TM_CCORR_NORMED which is... uh... pretty bad.

Now the workaround I've found for now is feature matching the template and comparing the matches with the spot found by template matching. This resolves the issue to see if the template is actually on screen, but doesn't do anything against miscalculation from CV_TM_CCORR_NORMED which can happen sometimes depending on the environment.

Is there a better way for all this?

edit retag flag offensive close merge delete


<<learning opencv="">> suggests you may try these method ,and find a best one.

jsxyhelu gravatar imagejsxyhelu ( 2018-01-08 23:27:34 -0600 )edit