问题
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