matchTemplate with non-rectangular templ

五迷三道 提交于 2019-12-22 10:20:01

问题


Is there some way for matchTemplate to work with a non-rectangular templ? For example to use the alpha channel, etc to ignore certain pixels when calculating the score?

The various formulas for scores SHOULD generalize to non-rectangular templates.


回答1:


If you are using openCV 3 you can use mask to do template match on non-rectangular regions.

But in case you are using openCV 2, you have to write your own function to mask your template and then do template match on the source image.



来源:https://stackoverflow.com/questions/27993074/matchtemplate-with-non-rectangular-templ

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!