Ask Your Question

Revision history [back]

When I use template matching with TM_CCOEFF_NORMED, I get

0.83 score for Image1 & Image2 and

0.37 score for Image1 & Image3

    Mat image1Img = imread("image1.png", IMREAD_COLOR);
Mat image2Img = imread("image2.png", IMREAD_COLOR);
Mat image3Img = imread("image3.png", IMREAD_COLOR);

Mat scoreImg;
double maxScore;

matchTemplate(image1Img, image2Img, scoreImg, TM_CCOEFF_NORMED);
minMaxLoc(scoreImg, 0, &maxScore);
wxLogMessage(wxString::Format("score <%.2f>", maxScore));

matchTemplate(image1Img, image3Img, scoreImg, TM_CCOEFF_NORMED);
minMaxLoc(scoreImg, 0, &maxScore);
wxLogMessage(wxString::Format("score <%.2f>", maxScore));