1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Fixed matchTemplate function. #23585

This commit is contained in:
captain-n3m0
2023-05-15 17:31:43 +05:30
committed by Dmitry Kurtaev
parent 26a7b332cb
commit 6157db6462
+5 -3
View File
@@ -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);