Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

matchTemplate with non-rectangular templ

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.

like image 685
Alex Rothberg Avatar asked May 02 '26 23:05

Alex Rothberg


1 Answers

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.

like image 114
Neeraj Komuravalli Avatar answered May 05 '26 16:05

Neeraj Komuravalli