Fixed matchTemplate function. #23585

pull/23694/head
captain-n3m0 2 years ago committed by Dmitry Kurtaev
parent 26a7b332cb
commit 6157db6462
  1. 8
      modules/imgproc/src/templmatch.cpp

@ -779,9 +779,11 @@ static void matchTemplateMask( InputArray _img, InputArray _templ, OutputArray _
}
if (mask.depth() == CV_8U)
{
// To keep compatibility to other masks in OpenCV: CV_8U masks are binary masks
threshold(mask, mask, 0/*threshold*/, 1.0/*maxVal*/, THRESH_BINARY);
mask.convertTo(mask, CV_32F);
Mat mask_copy = mask.clone(); // Create a copy of the mask
threshold(mask_copy, mask_copy, 0/*threshold*/, 1.0/*maxVal*/, THRESH_BINARY);
mask_copy.convertTo(mask_copy, CV_32F);
}
Size corrSize(img.cols - templ.cols + 1, img.rows - templ.rows + 1);

Loading…
Cancel
Save