cv2.matchTemplate using non-rectangular template?

asked 2018-10-22 07:25:25 -0500

sazr gravatar image

I have a specific kernel and I want to search an image/matrix and find all areas where this kernel occurs (or something close to it). The problem is that the kernel is not rectangular. The kernel is an L shape…

0     X   X
0     X   X
315  270 270

Can I still use cv2.matchTemplate() even though the template (kernel) is not rectangular? WHat value should I place in the X's? A -1? I think that will lead to never detecting my target areas wont it?

Maybe you can do cv2.matchTemplate() but specify a mask for my template?

edit retag flag offensive close merge delete