From ce0b808e3c2f6753344939d94e8c256d99cd9b87 Mon Sep 17 00:00:00 2001 From: Elena Gvozdeva Date: Thu, 15 May 2014 13:05:27 +0400 Subject: [PATCH] IPP: fixed ipp_matchTemplate --- modules/imgproc/src/templmatch.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/imgproc/src/templmatch.cpp b/modules/imgproc/src/templmatch.cpp index 3565eee9a..511c8bd76 100644 --- a/modules/imgproc/src/templmatch.cpp +++ b/modules/imgproc/src/templmatch.cpp @@ -634,7 +634,9 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result, #endif #if defined HAVE_IPP - if (method == CV_TM_SQDIFF && cn == 1) + bool useIppMT = (templ.rows < img.rows/2 && templ.cols < img.cols/2); + + if (method == CV_TM_SQDIFF && cn == 1 && useIppMT) { if (ipp_sqrDistance(img, templ, result)) return; @@ -643,7 +645,7 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result, #endif #if defined HAVE_IPP - if (cn == 1) + if (cn == 1 && useIppMT) { if (!ipp_crossCorr(img, templ, result)) {