Skip to content

Commit 55aa1d4

Browse files
committed
Merge pull request opencv#19975 from danielenricocahall:fix-template-matcher-sqdiff
2 parents 2f68c43 + 402bce1 commit 55aa1d4

File tree

2 files changed

+93
-1
lines changed

2 files changed

+93
-1
lines changed

modules/imgproc/src/templmatch.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,7 @@ static bool ipp_sqrDistance(const Mat& src, const Mat& tpl, Mat& dst)
10361036
buffer.allocate( bufSize );
10371037

10381038
status = CV_INSTRUMENT_FUN_IPP(ippiSqrDistanceNorm, src.ptr(), (int)src.step, srcRoiSize, tpl.ptr(), (int)tpl.step, tplRoiSize, dst.ptr<Ipp32f>(), (int)dst.step, funCfg, buffer);
1039+
dst = cv::max(dst, 0); // handle edge case from rounding in variance computation which can result in negative values
10391040
return status >= 0;
10401041
}
10411042

0 commit comments

Comments
 (0)