minMaxLoc, maxVal always is 1
Hi everyone
When i use minMaxLoc, to find the best score of matchtemplating, in maxVal i have always value 1.
My code:
void MatchingMethod(int, void*)
{
Mat img_display;
img.copyTo(img_display);
int result_cols = img.cols - templ.cols + 1;
int result_rows = img.rows - templ.rows + 1;
result.create(result_rows, result_cols, CV_32F);
matchTemplate(img_display, templ, result, CV_TM_SQDIFF);
normalize(result, result, 0, 1, NORM_MINMAX, -1, Mat());
/// Localizing the best match with minMaxLoc
double minVal; double maxVal; Point minLoc; Point maxLoc;Point matchLoc;
minMaxLoc(result, &minVal, &maxVal, &minLoc, &maxLoc, Mat());
scores = maxVal;
if (scores > 0.0)
{
printf("\nWynik:%\F", minVal);
printf(" %\F", maxVal);
printf(" %\F", minLoc);
printf(" %\F", maxLoc);
};
if someone can help me?
why the normalize() ?
I used example from: http://docs.opencv.org/2.4/doc/tutori...
do you understand, what the normalize() does ?
I thnk so. Normalize the values in array to defined range?
I want to see the result from funkction minMaxLoc, in range 0.0 - 1.0 where 1.0 is the best score.
so, the maximal value after that is 1, and the minimal value is 0.
again, if you don't want that, you'd have to remove the normalize() call.
btw,
printf(" %f", maxLoc);
(there's no escape sequence like\F
anywhere in c/c++)