Ask Your Question

Revision history [back]

Have somebody working code for matchTemplate with mask?

Here is a link: https://stackoverflow.com/questions/15459090/how-to-find-a-template-in-an-image-using-a-mask-or-transparency-with-opencv-an I have a problem with multiplating matrix. I element is 255 multiplated by 255 it will be still 255, becouse it is higher value of matrix element.

Have somebody working code for matchTemplate with mask?

Here is a link: https://stackoverflow.com/questions/15459090/how-to-find-a-template-in-an-image-using-a-mask-or-transparency-with-opencv-an I have a problem with multiplating matrix. I If element is 255 multiplated by 255 it will be still 255, becouse it is higher value of matrix element.

click to hide/show revision 3
None

updated 2017-09-14 09:29:43 -0600

berak gravatar image

Have somebody working code for matchTemplate with mask?

Here is a link: https://stackoverflow.com/questions/15459090/how-to-find-a-template-in-an-image-using-a-mask-or-transparency-with-opencv-an I have a problem with multiplating matrix. If element is 255 multiplated by 255 it will be still 255, becouse it is higher value of matrix element.

OpenCV have no template matching with mask, but it can be done follows steps: result = matchTemplate(I^2, W, method=2) - matchTemplate(I, 2*W*T, method=2) + as.scalar(sum(W*T^2))

Here I need to multiply matrix per-elements, but I can not do it with simple mul() becouse it cv::Mat can not store values more then maximal values (255 for example). When I multiply 255 by 255 it still stay 255. This is a problem.