Based on the SQDIFF formula: OpenCV: Object Detection
I expected to get a minValue of 0 when the template and the image are identical, because the square difference is 0 for each pixel in each channel, so the sum must be 0 too. However, I get different results, I have one example with a 3 channel color-image (using only black and white pixels though) where the minVal is 15266 where I expected 0.
I tried reproducing/understanding with a small-ish image, this is an image I used in my test:
![]()
It’s 18x15 pixels, 3 channels, all either black (0,0,0) or white (255,255,255). When I pass this to the template match function using SQDIFF (without mask), I get a minValue of 2 iso my expected 0.
Any ideas what I’m not understanding? Using OpenCV 4.13.0.
