From e9805e444f66487a177b91032ee6eced7fccb0c8 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Fri, 17 Jan 2014 14:49:42 +0400 Subject: [PATCH 1/2] Fixed an overly-narrow assertion in cv::norm. size() requires that the matrix is two-dimensional, and norm() works on higher dimensions. --- modules/core/src/stat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index eac823995..050716268 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -2295,7 +2295,7 @@ static bool ocl_norm( InputArray _src1, InputArray _src2, int normType, double & double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _mask ) { - CV_Assert( _src1.size() == _src2.size() && _src1.type() == _src2.type() ); + CV_Assert( _src1.sameSize(_src2) && _src1.type() == _src2.type() ); double _result = 0; if (ocl::useOpenCL() && _mask.empty() && _src1.isUMat() && _src2.isUMat() && From 0de799b3b03c1320b84d2c702a629867362b9fc3 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Fri, 17 Jan 2014 18:25:28 +0400 Subject: [PATCH 2/2] Removed some duplicate assertions. --- modules/core/src/stat.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index 050716268..d74de29fc 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -2307,8 +2307,6 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) Mat src1 = _src1.getMat(), src2 = _src2.getMat(), mask = _mask.getMat(); - CV_Assert( src1.size == src2.size && src1.type() == src2.type() ); - normType &= 7; CV_Assert( normType == NORM_INF || normType == NORM_L1 || normType == NORM_L2 || normType == NORM_L2SQR || ((normType == NORM_HAMMING || normType == NORM_HAMMING2) && src1.type() == CV_8U) ); @@ -2387,8 +2385,6 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m Mat src1 = _src1.getMat(), src2 = _src2.getMat(), mask = _mask.getMat(); int depth = src1.depth(), cn = src1.channels(); - CV_Assert( src1.size == src2.size ); - normType &= 7; CV_Assert( normType == NORM_INF || normType == NORM_L1 || normType == NORM_L2 || normType == NORM_L2SQR ||