I am trying to match 2 images using the following matchTemplate code.
int match_method = Imgproc.TM_CCOEFF_NORMED;
int result_colsAB = matB.cols() - matA.cols() + 1;
int result_rowsAB = matB.rows() - matA.rows() + 1;
Mat resultAB = new Mat(result_rowsAB, result_colsAB, CvType.CV_8UC1);
Imgproc.matchTemplate(matA, matB, resultAB,match_method);
//Core.normalize(resultAB, resultAB, 0.0, 1.0, Core.NORM_MINMAX, -1, new Mat());
MinMaxLocResult mmr = Core.minMaxLoc(resultAB);
System.out.println( mmr.maxVal);
It gives the expected .99 when comparing 2 filled circles as expected
But it gives a 1.0 when comparing a filled circle and a filled square of almost the same size.
what am i doing wrong? The images are in black and white.