Matching template images with masks using OpenCV and C++
问题 How can I match a masked image using matchTemplate() in OpenCV with C++? This is my masked template image: And this is my source image: 回答1: Look at opencv example. You gotta call the matchTemplate function: matchTemplate( img, templ, result, match_method ); 回答2: matchTemplate 's fifth argument is a mask array which you can use for this purpose. In your case, you'll want a binary mask. That is, a Mat with: depth CV_8U , and dimensions equal to your template image, and the pixels you want to