fixes in imgproc
This commit is contained in:
@@ -347,9 +347,6 @@ typedef IppStatus (CV_STDCALL * ippimatchTemplate)(const void*, int, IppiSize, c
|
||||
|
||||
static bool ipp_crossCorr(const Mat& src, const Mat& tpl, Mat& dst)
|
||||
{
|
||||
if (src.channels()!= 1)
|
||||
return false;
|
||||
|
||||
IppStatus status;
|
||||
|
||||
IppiSize srcRoiSize = {src.cols,src.rows};
|
||||
@@ -383,9 +380,6 @@ static bool ipp_crossCorr(const Mat& src, const Mat& tpl, Mat& dst)
|
||||
|
||||
static bool ipp_sqrDistance(const Mat& src, const Mat& tpl, Mat& dst)
|
||||
{
|
||||
if (src.channels()!= 1)
|
||||
return false;
|
||||
|
||||
IppStatus status;
|
||||
|
||||
IppiSize srcRoiSize = {src.cols,src.rows};
|
||||
@@ -423,12 +417,6 @@ void crossCorr( const Mat& img, const Mat& _templ, Mat& corr,
|
||||
Size corrsize, int ctype,
|
||||
Point anchor, double delta, int borderType )
|
||||
{
|
||||
#if defined HAVE_IPP && IPP_VERSION_MAJOR >= 7 && !defined HAVE_IPP_ICV_ONLY
|
||||
if (ipp_crossCorr(img, _templ, corr))
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
#endif
|
||||
|
||||
const double blockScale = 4.5;
|
||||
const int minBlockSize = 256;
|
||||
std::vector<uchar> buf;
|
||||
@@ -613,8 +601,9 @@ void crossCorr( const Mat& img, const Mat& _templ, Mat& corr,
|
||||
|
||||
void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result, int method )
|
||||
{
|
||||
int type = _img.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||
CV_Assert( CV_TM_SQDIFF <= method && method <= CV_TM_CCOEFF_NORMED );
|
||||
CV_Assert( (_img.depth() == CV_8U || _img.depth() == CV_32F) && _img.type() == _templ.type() && _img.dims() <= 2 );
|
||||
CV_Assert( (depth == CV_8U || depth == CV_32F) && type == _templ.type() && _img.dims() <= 2 );
|
||||
|
||||
bool needswap = _img.size().height < _templ.size().height || _img.size().width < _templ.size().width;
|
||||
if (needswap)
|
||||
@@ -645,7 +634,7 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result,
|
||||
#endif
|
||||
|
||||
#if defined HAVE_IPP && IPP_VERSION_MAJOR >= 7 && !defined HAVE_IPP_ICV_ONLY
|
||||
if (method == CV_TM_SQDIFF)
|
||||
if (method == CV_TM_SQDIFF && cn == 1)
|
||||
{
|
||||
if (ipp_sqrDistance(img, templ, result))
|
||||
return;
|
||||
@@ -653,10 +642,16 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result,
|
||||
}
|
||||
#endif
|
||||
|
||||
int cn = img.channels();
|
||||
|
||||
#if defined HAVE_IPP && IPP_VERSION_MAJOR >= 7 && !defined HAVE_IPP_ICV_ONLY
|
||||
if (!ipp_crossCorr(img, templ, result))
|
||||
if (cn == 1)
|
||||
{
|
||||
if (!ipp_crossCorr(img, templ, result))
|
||||
{
|
||||
setIppErrorStatus();
|
||||
crossCorr( img, templ, result, result.size(), result.type(), Point(0,0), 0, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
crossCorr( img, templ, result, result.size(), result.type(), Point(0,0), 0, 0);
|
||||
|
||||
|
Reference in New Issue
Block a user