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.