From 3d25d706279b1b7859d4a62d715b637451b8d066 Mon Sep 17 00:00:00 2001 From: Alessandro Trebbi Date: Fri, 18 Apr 2014 13:42:47 +0200 Subject: [PATCH 1/8] fix for compiling 2.4 opencv with xcode 5.1 --- modules/world/CMakeLists.txt | 1 + platforms/ios/build_framework.py | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/world/CMakeLists.txt b/modules/world/CMakeLists.txt index f65447dc02..6a84c1b6ae 100644 --- a/modules/world/CMakeLists.txt +++ b/modules/world/CMakeLists.txt @@ -103,6 +103,7 @@ macro(ios_include_3party_libs) list(APPEND objlist "\"${objpath3}\"") endforeach() # (srcname ${sources}) endforeach() + ocv_list_filterout(objlist jmemansi) # <<= dirty fix endmacro() if(IOS AND WITH_PNG) diff --git a/platforms/ios/build_framework.py b/platforms/ios/build_framework.py index e9a68c32f1..4d4f7e3d03 100755 --- a/platforms/ios/build_framework.py +++ b/platforms/ios/build_framework.py @@ -40,6 +40,7 @@ def build_opencv(srcroot, buildroot, target, arch): "-DCMAKE_BUILD_TYPE=Release " + "-DCMAKE_TOOLCHAIN_FILE=%s/platforms/ios/cmake/Toolchains/Toolchain-%s_Xcode.cmake " + "-DBUILD_opencv_world=ON " + + "-DCMAKE_C_FLAGS=\"-Wno-implicit-function-declaration\" " + "-DCMAKE_INSTALL_PREFIX=install") % (srcroot, target) # if cmake cache exists, just rerun cmake to update OpenCV.xproj if necessary if os.path.isfile(os.path.join(builddir, "CMakeCache.txt")): From c1aee0c312311ac1bc98ceaf126f537216484fb2 Mon Sep 17 00:00:00 2001 From: Michael Vukadinovic Date: Thu, 1 May 2014 11:52:49 -0700 Subject: [PATCH 2/8] Fixed bug in IPPMorphOp function when looping over elements of the morphology kernel. --- modules/imgproc/src/morph.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/imgproc/src/morph.cpp b/modules/imgproc/src/morph.cpp index 19636bc963..fa1f8acbf3 100644 --- a/modules/imgproc/src/morph.cpp +++ b/modules/imgproc/src/morph.cpp @@ -1234,7 +1234,7 @@ static bool IPPMorphOp(int op, InputArray _src, OutputArray _dst, return false; } } - for( x = 0; y < kernel.cols; x++ ) + for( x = 0; x < kernel.cols; x++ ) { if( kernel.at(anchor.y, x) != 0 ) continue; From 897d0a9aaf4994d915d2ddb8e3e4a21d9c0d102b Mon Sep 17 00:00:00 2001 From: PhilLab Date: Mon, 5 May 2014 12:16:48 +0200 Subject: [PATCH 3/8] Updated documentation: library names updated the library names to OpenCV version 2.4.9 --- .../windows_visual_studio_Opencv.rst | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.rst b/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.rst index 3fd734f35d..2ec616fbc7 100644 --- a/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.rst +++ b/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.rst @@ -90,17 +90,25 @@ A full list, for the latest version would contain: .. code-block:: bash - opencv_core231d.lib - opencv_imgproc231d.lib - opencv_highgui231d.lib - opencv_ml231d.lib - opencv_video231d.lib - opencv_features2d231d.lib - opencv_calib3d231d.lib - opencv_objdetect231d.lib - opencv_contrib231d.lib - opencv_legacy231d.lib - opencv_flann231d.lib + opencv_calib3d249d.lib + opencv_contrib249d.lib + opencv_core249d.lib + opencv_features2d249d.lib + opencv_flann249d.lib + opencv_gpu249d.lib + opencv_highgui249d.lib + opencv_imgproc249d.lib + opencv_legacy249d.lib + opencv_ml249d.lib + opencv_nonfree249d.lib + opencv_objdetect249d.lib + opencv_ocl249d.lib + opencv_photo249d.lib + opencv_stitching249d.lib + opencv_superres249d.lib + opencv_ts249d.lib + opencv_video249d.lib + opencv_videostab249d.lib The letter *d* at the end just indicates that these are the libraries required for the debug. Now click ok to save and do the same with a new property inside the Release rule section. Make sure to omit the *d* letters from the library names and to save the property sheets with the save icon above them. From 4c66614e07319b66537b6327e2dcf871c5aa6829 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Wed, 7 May 2014 13:15:19 +0400 Subject: [PATCH 4/8] fix cv::subtract function: call dst.create(...) before using it --- modules/core/src/arithm.cpp | 6 +++++- modules/core/test/test_arithm.cpp | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/core/src/arithm.cpp b/modules/core/src/arithm.cpp index 0517a5fae6..f0ef920554 100644 --- a/modules/core/src/arithm.cpp +++ b/modules/core/src/arithm.cpp @@ -1562,8 +1562,12 @@ void cv::subtract( InputArray src1, InputArray src2, OutputArray dst, if (dtype == -1 && dst.fixedType()) dtype = dst.depth(); - if (!dst.fixedType() || dtype == dst.depth()) + dtype = CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src1.channels()); + + if (!dst.fixedType() || dtype == dst.type()) { + dst.create(src1.size(), dtype); + if (dtype == CV_16S) { Mat _dst = dst.getMat(); diff --git a/modules/core/test/test_arithm.cpp b/modules/core/test/test_arithm.cpp index a240941847..1687285a60 100644 --- a/modules/core/test/test_arithm.cpp +++ b/modules/core/test/test_arithm.cpp @@ -1579,3 +1579,13 @@ TEST_P(Mul1, One) } INSTANTIATE_TEST_CASE_P(Arithm, Mul1, testing::Values(Size(2, 2), Size(1, 1))); + +TEST(Subtract8u8u16s, EmptyOutputMat) +{ + cv::Mat src1 = cv::Mat::zeros(16, 16, CV_8UC1); + cv::Mat src2 = cv::Mat::zeros(16, 16, CV_8UC1); + cv::Mat dst; + cv::subtract(src1, src2, dst, cv::noArray(), CV_16S); + ASSERT_FALSE(dst.empty()); + ASSERT_EQ(0, cv::countNonZero(dst)); +} From 629461c83652e2416ccb6c8685a0788bb6fb15f5 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Wed, 7 May 2014 19:52:35 +0400 Subject: [PATCH 5/8] fix output matrix allocation in cv::subtract --- modules/core/src/arithm.cpp | 47 ++++++++++++++++++++----------- modules/core/test/test_arithm.cpp | 19 +++++++++---- 2 files changed, 45 insertions(+), 21 deletions(-) diff --git a/modules/core/src/arithm.cpp b/modules/core/src/arithm.cpp index f0ef920554..4058856fff 100644 --- a/modules/core/src/arithm.cpp +++ b/modules/core/src/arithm.cpp @@ -1553,43 +1553,58 @@ void cv::add( InputArray src1, InputArray src2, OutputArray dst, arithm_op(src1, src2, dst, mask, dtype, getAddTab() ); } -void cv::subtract( InputArray src1, InputArray src2, OutputArray dst, +void cv::subtract( InputArray _src1, InputArray _src2, OutputArray _dst, InputArray mask, int dtype ) { #ifdef HAVE_TEGRA_OPTIMIZATION - if (mask.empty() && src1.depth() == CV_8U && src2.depth() == CV_8U) + int kind1 = _src1.kind(), kind2 = _src2.kind(); + Mat src1 = _src1.getMat(), src2 = _src2.getMat(); + bool src1Scalar = checkScalar(src1, _src2.type(), kind1, kind2); + bool src2Scalar = checkScalar(src2, _src1.type(), kind2, kind1); + + if (!src1Scalar && !src2Scalar && mask.empty() && + src1.depth() == CV_8U && src2.depth() == CV_8U) { - if (dtype == -1 && dst.fixedType()) - dtype = dst.depth(); - - dtype = CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src1.channels()); - - if (!dst.fixedType() || dtype == dst.type()) + if (dtype == -1) { - dst.create(src1.size(), dtype); + if (_dst.fixedType()) + { + dtype = _dst.depth(); + } + else + { + dtype = src1.depth(); + } + } + + dtype = CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), _src1.channels()); + + if (dtype == _dst.type()) + { + _dst.create(_src1.size(), dtype); if (dtype == CV_16S) { - Mat _dst = dst.getMat(); - if(tegra::subtract_8u8u16s(src1.getMat(), src2.getMat(), _dst)) + Mat dst = _dst.getMat(); + if(tegra::subtract_8u8u16s(src1, src2, dst)) return; } else if (dtype == CV_32F) { - Mat _dst = dst.getMat(); - if(tegra::subtract_8u8u32f(src1.getMat(), src2.getMat(), _dst)) + Mat dst = _dst.getMat(); + if(tegra::subtract_8u8u32f(src1, src2, dst)) return; } else if (dtype == CV_8S) { - Mat _dst = dst.getMat(); - if(tegra::subtract_8u8u8s(src1.getMat(), src2.getMat(), _dst)) + Mat dst = _dst.getMat(); + if(tegra::subtract_8u8u8s(src1, src2, dst)) return; } } } #endif - arithm_op(src1, src2, dst, mask, dtype, getSubTab() ); + arithm_op(_src1, _src2, _dst, mask, dtype, getSubTab() ); } void cv::absdiff( InputArray src1, InputArray src2, OutputArray dst ) diff --git a/modules/core/test/test_arithm.cpp b/modules/core/test/test_arithm.cpp index 1687285a60..68b06267b2 100644 --- a/modules/core/test/test_arithm.cpp +++ b/modules/core/test/test_arithm.cpp @@ -1580,12 +1580,21 @@ TEST_P(Mul1, One) INSTANTIATE_TEST_CASE_P(Arithm, Mul1, testing::Values(Size(2, 2), Size(1, 1))); -TEST(Subtract8u8u16s, EmptyOutputMat) +TEST(Subtract, EmptyOutputMat) { cv::Mat src1 = cv::Mat::zeros(16, 16, CV_8UC1); cv::Mat src2 = cv::Mat::zeros(16, 16, CV_8UC1); - cv::Mat dst; - cv::subtract(src1, src2, dst, cv::noArray(), CV_16S); - ASSERT_FALSE(dst.empty()); - ASSERT_EQ(0, cv::countNonZero(dst)); + cv::Mat dst1, dst2, dst3; + + cv::subtract(src1, src2, dst1, cv::noArray(), CV_16S); + cv::subtract(src1, src2, dst2); + cv::subtract(src1, cv::Scalar::all(0), dst3, cv::noArray(), CV_16S); + + ASSERT_FALSE(dst1.empty()); + ASSERT_FALSE(dst2.empty()); + ASSERT_FALSE(dst3.empty()); + + ASSERT_EQ(0, cv::countNonZero(dst1)); + ASSERT_EQ(0, cv::countNonZero(dst2)); + ASSERT_EQ(0, cv::countNonZero(dst3)); } From 99475e2976df676c0a076f556d1539c6db089846 Mon Sep 17 00:00:00 2001 From: StevenPuttemans Date: Thu, 8 May 2014 10:45:51 +0200 Subject: [PATCH 6/8] fixed wrong download link in tutorial --- doc/tutorials/introduction/windows_install/windows_install.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/tutorials/introduction/windows_install/windows_install.rst b/doc/tutorials/introduction/windows_install/windows_install.rst index a99b270d88..abb39cd13e 100644 --- a/doc/tutorials/introduction/windows_install/windows_install.rst +++ b/doc/tutorials/introduction/windows_install/windows_install.rst @@ -55,7 +55,7 @@ Building the OpenCV library from scratch requires a couple of tools installed be .. |TortoiseGit| replace:: TortoiseGit .. _TortoiseGit: http://code.google.com/p/tortoisegit/wiki/Download .. |Python_Libraries| replace:: Python libraries -.. _Python_Libraries: http://www.python.org/getit/ +.. _Python_Libraries: http://www.python.org/downloads/ .. |Numpy| replace:: Numpy .. _Numpy: http://numpy.scipy.org/ .. |IntelTBB| replace:: Intel |copy| Threading Building Blocks (*TBB*) From 77275031abd858a82ad863e5fff1b16e7b884ef2 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Thu, 8 May 2014 11:59:30 +0400 Subject: [PATCH 7/8] finally fix cv::subtract --- modules/core/src/arithm.cpp | 14 +- modules/core/test/test_arithm.cpp | 220 ++++++++++++++++++++++++++++-- 2 files changed, 215 insertions(+), 19 deletions(-) diff --git a/modules/core/src/arithm.cpp b/modules/core/src/arithm.cpp index 4058856fff..00194b628f 100644 --- a/modules/core/src/arithm.cpp +++ b/modules/core/src/arithm.cpp @@ -1562,10 +1562,12 @@ void cv::subtract( InputArray _src1, InputArray _src2, OutputArray _dst, bool src1Scalar = checkScalar(src1, _src2.type(), kind1, kind2); bool src2Scalar = checkScalar(src2, _src1.type(), kind2, kind1); - if (!src1Scalar && !src2Scalar && mask.empty() && - src1.depth() == CV_8U && src2.depth() == CV_8U) + if (!src1Scalar && !src2Scalar && + src1.depth() == CV_8U && src2.type() == src1.type() && + src1.dims == 2 && src2.size() == src1.size() && + mask.empty()) { - if (dtype == -1) + if (dtype < 0) { if (_dst.fixedType()) { @@ -1577,11 +1579,11 @@ void cv::subtract( InputArray _src1, InputArray _src2, OutputArray _dst, } } - dtype = CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), _src1.channels()); + dtype = CV_MAT_DEPTH(dtype); - if (dtype == _dst.type()) + if (!_dst.fixedType() || dtype == _dst.depth()) { - _dst.create(_src1.size(), dtype); + _dst.create(src1.size(), CV_MAKE_TYPE(dtype, src1.channels())); if (dtype == CV_16S) { diff --git a/modules/core/test/test_arithm.cpp b/modules/core/test/test_arithm.cpp index 68b06267b2..f3faa57fce 100644 --- a/modules/core/test/test_arithm.cpp +++ b/modules/core/test/test_arithm.cpp @@ -1580,21 +1580,215 @@ TEST_P(Mul1, One) INSTANTIATE_TEST_CASE_P(Arithm, Mul1, testing::Values(Size(2, 2), Size(1, 1))); -TEST(Subtract, EmptyOutputMat) +class SubtractOutputMatNotEmpty : public testing::TestWithParam< std::tr1::tuple > { - cv::Mat src1 = cv::Mat::zeros(16, 16, CV_8UC1); - cv::Mat src2 = cv::Mat::zeros(16, 16, CV_8UC1); - cv::Mat dst1, dst2, dst3; +public: + cv::Size size; + int src_type; + int dst_depth; + bool fixed; - cv::subtract(src1, src2, dst1, cv::noArray(), CV_16S); - cv::subtract(src1, src2, dst2); - cv::subtract(src1, cv::Scalar::all(0), dst3, cv::noArray(), CV_16S); + void SetUp() + { + size = std::tr1::get<0>(GetParam()); + src_type = std::tr1::get<1>(GetParam()); + dst_depth = std::tr1::get<2>(GetParam()); + fixed = std::tr1::get<3>(GetParam()); + } +}; - ASSERT_FALSE(dst1.empty()); - ASSERT_FALSE(dst2.empty()); - ASSERT_FALSE(dst3.empty()); +TEST_P(SubtractOutputMatNotEmpty, Mat_Mat) +{ + cv::Mat src1(size, src_type, cv::Scalar::all(16)); + cv::Mat src2(size, src_type, cv::Scalar::all(16)); - ASSERT_EQ(0, cv::countNonZero(dst1)); - ASSERT_EQ(0, cv::countNonZero(dst2)); - ASSERT_EQ(0, cv::countNonZero(dst3)); + cv::Mat dst; + + if (!fixed) + { + cv::subtract(src1, src2, dst, cv::noArray(), dst_depth); + } + else + { + const cv::Mat fixed_dst(size, CV_MAKE_TYPE((dst_depth > 0 ? dst_depth : CV_16S), src1.channels())); + cv::subtract(src1, src2, fixed_dst, cv::noArray(), dst_depth); + dst = fixed_dst; + dst_depth = fixed_dst.depth(); + } + + ASSERT_FALSE(dst.empty()); + ASSERT_EQ(src1.size(), dst.size()); + ASSERT_EQ(dst_depth > 0 ? dst_depth : src1.depth(), dst.depth()); + ASSERT_EQ(0, cv::countNonZero(dst.reshape(1))); } + +TEST_P(SubtractOutputMatNotEmpty, Mat_Mat_WithMask) +{ + cv::Mat src1(size, src_type, cv::Scalar::all(16)); + cv::Mat src2(size, src_type, cv::Scalar::all(16)); + cv::Mat mask(size, CV_8UC1, cv::Scalar::all(255)); + + cv::Mat dst; + + if (!fixed) + { + cv::subtract(src1, src2, dst, mask, dst_depth); + } + else + { + const cv::Mat fixed_dst(size, CV_MAKE_TYPE((dst_depth > 0 ? dst_depth : CV_16S), src1.channels())); + cv::subtract(src1, src2, fixed_dst, mask, dst_depth); + dst = fixed_dst; + dst_depth = fixed_dst.depth(); + } + + ASSERT_FALSE(dst.empty()); + ASSERT_EQ(src1.size(), dst.size()); + ASSERT_EQ(dst_depth > 0 ? dst_depth : src1.depth(), dst.depth()); + ASSERT_EQ(0, cv::countNonZero(dst.reshape(1))); +} + +TEST_P(SubtractOutputMatNotEmpty, Mat_Mat_Expr) +{ + cv::Mat src1(size, src_type, cv::Scalar::all(16)); + cv::Mat src2(size, src_type, cv::Scalar::all(16)); + + cv::Mat dst = src1 - src2; + + ASSERT_FALSE(dst.empty()); + ASSERT_EQ(src1.size(), dst.size()); + ASSERT_EQ(src1.depth(), dst.depth()); + ASSERT_EQ(0, cv::countNonZero(dst.reshape(1))); +} + +TEST_P(SubtractOutputMatNotEmpty, Mat_Scalar) +{ + cv::Mat src(size, src_type, cv::Scalar::all(16)); + + cv::Mat dst; + + if (!fixed) + { + cv::subtract(src, cv::Scalar::all(16), dst, cv::noArray(), dst_depth); + } + else + { + const cv::Mat fixed_dst(size, CV_MAKE_TYPE((dst_depth > 0 ? dst_depth : CV_16S), src.channels())); + cv::subtract(src, cv::Scalar::all(16), fixed_dst, cv::noArray(), dst_depth); + dst = fixed_dst; + dst_depth = fixed_dst.depth(); + } + + ASSERT_FALSE(dst.empty()); + ASSERT_EQ(src.size(), dst.size()); + ASSERT_EQ(dst_depth > 0 ? dst_depth : src.depth(), dst.depth()); + ASSERT_EQ(0, cv::countNonZero(dst.reshape(1))); +} + +TEST_P(SubtractOutputMatNotEmpty, Mat_Scalar_WithMask) +{ + cv::Mat src(size, src_type, cv::Scalar::all(16)); + cv::Mat mask(size, CV_8UC1, cv::Scalar::all(255)); + + cv::Mat dst; + + if (!fixed) + { + cv::subtract(src, cv::Scalar::all(16), dst, mask, dst_depth); + } + else + { + const cv::Mat fixed_dst(size, CV_MAKE_TYPE((dst_depth > 0 ? dst_depth : CV_16S), src.channels())); + cv::subtract(src, cv::Scalar::all(16), fixed_dst, mask, dst_depth); + dst = fixed_dst; + dst_depth = fixed_dst.depth(); + } + + ASSERT_FALSE(dst.empty()); + ASSERT_EQ(src.size(), dst.size()); + ASSERT_EQ(dst_depth > 0 ? dst_depth : src.depth(), dst.depth()); + ASSERT_EQ(0, cv::countNonZero(dst.reshape(1))); +} + +TEST_P(SubtractOutputMatNotEmpty, Scalar_Mat) +{ + cv::Mat src(size, src_type, cv::Scalar::all(16)); + + cv::Mat dst; + + if (!fixed) + { + cv::subtract(cv::Scalar::all(16), src, dst, cv::noArray(), dst_depth); + } + else + { + const cv::Mat fixed_dst(size, CV_MAKE_TYPE((dst_depth > 0 ? dst_depth : CV_16S), src.channels())); + cv::subtract(cv::Scalar::all(16), src, fixed_dst, cv::noArray(), dst_depth); + dst = fixed_dst; + dst_depth = fixed_dst.depth(); + } + + ASSERT_FALSE(dst.empty()); + ASSERT_EQ(src.size(), dst.size()); + ASSERT_EQ(dst_depth > 0 ? dst_depth : src.depth(), dst.depth()); + ASSERT_EQ(0, cv::countNonZero(dst.reshape(1))); +} + +TEST_P(SubtractOutputMatNotEmpty, Scalar_Mat_WithMask) +{ + cv::Mat src(size, src_type, cv::Scalar::all(16)); + cv::Mat mask(size, CV_8UC1, cv::Scalar::all(255)); + + cv::Mat dst; + + if (!fixed) + { + cv::subtract(cv::Scalar::all(16), src, dst, mask, dst_depth); + } + else + { + const cv::Mat fixed_dst(size, CV_MAKE_TYPE((dst_depth > 0 ? dst_depth : CV_16S), src.channels())); + cv::subtract(cv::Scalar::all(16), src, fixed_dst, mask, dst_depth); + dst = fixed_dst; + dst_depth = fixed_dst.depth(); + } + + ASSERT_FALSE(dst.empty()); + ASSERT_EQ(src.size(), dst.size()); + ASSERT_EQ(dst_depth > 0 ? dst_depth : src.depth(), dst.depth()); + ASSERT_EQ(0, cv::countNonZero(dst.reshape(1))); +} + +TEST_P(SubtractOutputMatNotEmpty, Mat_Mat_3d) +{ + int dims[] = {5, size.height, size.width}; + + cv::Mat src1(3, dims, src_type, cv::Scalar::all(16)); + cv::Mat src2(3, dims, src_type, cv::Scalar::all(16)); + + cv::Mat dst; + + if (!fixed) + { + cv::subtract(src1, src2, dst, cv::noArray(), dst_depth); + } + else + { + const cv::Mat fixed_dst(3, dims, CV_MAKE_TYPE((dst_depth > 0 ? dst_depth : CV_16S), src1.channels())); + cv::subtract(src1, src2, fixed_dst, cv::noArray(), dst_depth); + dst = fixed_dst; + dst_depth = fixed_dst.depth(); + } + + ASSERT_FALSE(dst.empty()); + ASSERT_EQ(src1.dims, dst.dims); + ASSERT_EQ(src1.size, dst.size); + ASSERT_EQ(dst_depth > 0 ? dst_depth : src1.depth(), dst.depth()); + ASSERT_EQ(0, cv::countNonZero(dst.reshape(1))); +} + +INSTANTIATE_TEST_CASE_P(Arithm, SubtractOutputMatNotEmpty, testing::Combine( + testing::Values(cv::Size(16, 16), cv::Size(13, 13), cv::Size(16, 13), cv::Size(13, 16)), + testing::Values(perf::MatType(CV_8UC1), CV_8UC3, CV_8UC4, CV_16SC1, CV_16SC3), + testing::Values(-1, CV_16S, CV_32S, CV_32F), + testing::Bool())); From 19a2495067cbbd576ea9fafc54fb6a6e7ee7645c Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Wed, 7 May 2014 17:33:34 +0400 Subject: [PATCH 8/8] fixed IPP related warnings --- .../core/include/opencv2/core/internal.hpp | 7 ++ modules/core/src/arithm.cpp | 52 ++++----- modules/core/src/stat.cpp | 8 +- modules/imgproc/src/color.cpp | 2 + modules/imgproc/src/imgwarp.cpp | 103 +++++++++--------- modules/objdetect/src/haar.cpp | 12 +- modules/objdetect/src/hog.cpp | 10 +- 7 files changed, 103 insertions(+), 91 deletions(-) diff --git a/modules/core/include/opencv2/core/internal.hpp b/modules/core/include/opencv2/core/internal.hpp index 3cd2f90f65..6c9d3d2f13 100644 --- a/modules/core/include/opencv2/core/internal.hpp +++ b/modules/core/include/opencv2/core/internal.hpp @@ -97,6 +97,13 @@ CV_INLINE IppiSize ippiSize(int width, int height) IppiSize size = { width, height }; return size; } + +CV_INLINE IppiSize ippiSize(const cv::Size & _size) +{ + IppiSize size = { _size.width, _size.height }; + return size; +} + #endif #ifndef IPPI_CALL diff --git a/modules/core/src/arithm.cpp b/modules/core/src/arithm.cpp index 0517a5fae6..d06450f745 100644 --- a/modules/core/src/arithm.cpp +++ b/modules/core/src/arithm.cpp @@ -533,7 +533,7 @@ static void add8u( const uchar* src1, size_t step1, uchar* dst, size_t step, Size sz, void* ) { IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiAdd_8u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz, 0), + ippiAdd_8u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0), (vBinOp8, IF_SIMD(_VAdd8u)>(src1, step1, src2, step2, dst, step, sz))); } @@ -549,7 +549,7 @@ static void add16u( const ushort* src1, size_t step1, ushort* dst, size_t step, Size sz, void* ) { IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiAdd_16u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz, 0), + ippiAdd_16u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0), (vBinOp16, IF_SIMD(_VAdd16u)>(src1, step1, src2, step2, dst, step, sz))); } @@ -558,7 +558,7 @@ static void add16s( const short* src1, size_t step1, short* dst, size_t step, Size sz, void* ) { IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiAdd_16s_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz, 0), + ippiAdd_16s_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0), (vBinOp16, IF_SIMD(_VAdd16s)>(src1, step1, src2, step2, dst, step, sz))); } @@ -574,7 +574,7 @@ static void add32f( const float* src1, size_t step1, float* dst, size_t step, Size sz, void* ) { IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiAdd_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), + ippiAdd_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)), (vBinOp32f, IF_SIMD(_VAdd32f)>(src1, step1, src2, step2, dst, step, sz))); } @@ -590,7 +590,7 @@ static void sub8u( const uchar* src1, size_t step1, uchar* dst, size_t step, Size sz, void* ) { IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiSub_8u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz, 0), + ippiSub_8u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz), 0), (vBinOp8, IF_SIMD(_VSub8u)>(src1, step1, src2, step2, dst, step, sz))); } @@ -606,7 +606,7 @@ static void sub16u( const ushort* src1, size_t step1, ushort* dst, size_t step, Size sz, void* ) { IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiSub_16u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz, 0), + ippiSub_16u_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz), 0), (vBinOp16, IF_SIMD(_VSub16u)>(src1, step1, src2, step2, dst, step, sz))); } @@ -615,7 +615,7 @@ static void sub16s( const short* src1, size_t step1, short* dst, size_t step, Size sz, void* ) { IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiSub_16s_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz, 0), + ippiSub_16s_C1RSfs(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz), 0), (vBinOp16, IF_SIMD(_VSub16s)>(src1, step1, src2, step2, dst, step, sz))); } @@ -631,7 +631,7 @@ static void sub32f( const float* src1, size_t step1, float* dst, size_t step, Size sz, void* ) { IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiSub_32f_C1R(src2, (int)step2, src1, (int)step1, dst, (int)step, (IppiSize&)sz), + ippiSub_32f_C1R(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(sz)), (vBinOp32f, IF_SIMD(_VSub32f)>(src1, step1, src2, step2, dst, step, sz))); } @@ -668,7 +668,7 @@ static void max8u( const uchar* src1, size_t step1, #endif // IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); -// ippiMaxEvery_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (IppiSize&)sz), +// ippiMaxEvery_8u_C1R(src1, (int)step1, src2, (int)step2, dst, ippiSize(sz)), // (vBinOp8, IF_SIMD(_VMax8u)>(src1, step1, src2, step2, dst, step, sz))); } @@ -702,7 +702,7 @@ static void max16u( const ushort* src1, size_t step1, #endif // IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); -// ippiMaxEvery_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (IppiSize&)sz), +// ippiMaxEvery_16u_C1R(src1, (int)step1, src2, (int)step2, dst, ippiSize(sz)), // (vBinOp16, IF_SIMD(_VMax16u)>(src1, step1, src2, step2, dst, step, sz))); } @@ -742,7 +742,7 @@ static void max32f( const float* src1, size_t step1, vBinOp32f, IF_SIMD(_VMax32f)>(src1, step1, src2, step2, dst, step, sz); #endif // IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); -// ippiMaxEvery_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (IppiSize&)sz), +// ippiMaxEvery_32f_C1R(src1, (int)step1, src2, (int)step2, dst, ippiSize(sz)), // (vBinOp32f, IF_SIMD(_VMax32f)>(src1, step1, src2, step2, dst, step, sz))); } @@ -776,7 +776,7 @@ static void min8u( const uchar* src1, size_t step1, #endif // IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); -// ippiMinEvery_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (IppiSize&)sz), +// ippiMinEvery_8u_C1R(src1, (int)step1, src2, (int)step2, dst, ippiSize(sz)), // (vBinOp8, IF_SIMD(_VMin8u)>(src1, step1, src2, step2, dst, step, sz))); } @@ -810,7 +810,7 @@ static void min16u( const ushort* src1, size_t step1, #endif // IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); -// ippiMinEvery_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (IppiSize&)sz), +// ippiMinEvery_16u_C1R(src1, (int)step1, src2, (int)step2, dst, ippiSize(sz)), // (vBinOp16, IF_SIMD(_VMin16u)>(src1, step1, src2, step2, dst, step, sz))); } @@ -850,7 +850,7 @@ static void min32f( const float* src1, size_t step1, vBinOp32f, IF_SIMD(_VMin32f)>(src1, step1, src2, step2, dst, step, sz); #endif // IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); -// ippiMinEvery_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (IppiSize&)sz), +// ippiMinEvery_32f_C1R(src1, (int)step1, src2, (int)step2, dst, ippiSize(sz)), // (vBinOp32f, IF_SIMD(_VMin32f)>(src1, step1, src2, step2, dst, step, sz))); } @@ -866,7 +866,7 @@ static void absdiff8u( const uchar* src1, size_t step1, uchar* dst, size_t step, Size sz, void* ) { IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiAbsDiff_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), + ippiAbsDiff_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)), (vBinOp8, IF_SIMD(_VAbsDiff8u)>(src1, step1, src2, step2, dst, step, sz))); } @@ -882,7 +882,7 @@ static void absdiff16u( const ushort* src1, size_t step1, ushort* dst, size_t step, Size sz, void* ) { IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiAbsDiff_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), + ippiAbsDiff_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)), (vBinOp16, IF_SIMD(_VAbsDiff16u)>(src1, step1, src2, step2, dst, step, sz))); } @@ -905,7 +905,7 @@ static void absdiff32f( const float* src1, size_t step1, float* dst, size_t step, Size sz, void* ) { IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiAbsDiff_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), + ippiAbsDiff_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)), (vBinOp32f, IF_SIMD(_VAbsDiff32f)>(src1, step1, src2, step2, dst, step, sz))); } @@ -922,7 +922,7 @@ static void and8u( const uchar* src1, size_t step1, uchar* dst, size_t step, Size sz, void* ) { IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiAnd_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), + ippiAnd_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)), (vBinOp8, IF_SIMD(_VAnd8u)>(src1, step1, src2, step2, dst, step, sz))); } @@ -931,7 +931,7 @@ static void or8u( const uchar* src1, size_t step1, uchar* dst, size_t step, Size sz, void* ) { IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiOr_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), + ippiOr_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)), (vBinOp8, IF_SIMD(_VOr8u)>(src1, step1, src2, step2, dst, step, sz))); } @@ -940,7 +940,7 @@ static void xor8u( const uchar* src1, size_t step1, uchar* dst, size_t step, Size sz, void* ) { IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); - ippiXor_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)sz), + ippiXor_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)), (vBinOp8, IF_SIMD(_VXor8u)>(src1, step1, src2, step2, dst, step, sz))); } @@ -948,8 +948,8 @@ static void not8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, Size sz, void* ) { - IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); (void *)src2; - ippiNot_8u_C1R(src1, (int)step1, dst, (int)step, (IppiSize&)sz), + IF_IPP(fixSteps(sz, sizeof(dst[0]), step1, step2, step); (void)src2; + ippiNot_8u_C1R(src1, (int)step1, dst, (int)step, ippiSize(sz)), (vBinOp8, IF_SIMD(_VNot8u)>(src1, step1, src2, step2, dst, step, sz))); } @@ -2184,7 +2184,7 @@ static void cmp8u(const uchar* src1, size_t step1, const uchar* src2, size_t ste if( op >= 0 ) { fixSteps(size, sizeof(dst[0]), step1, step2, step); - if( ippiCompare_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)size, op) >= 0 ) + if( ippiCompare_8u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(size), op) >= 0 ) return; } #endif @@ -2267,7 +2267,7 @@ static void cmp16u(const ushort* src1, size_t step1, const ushort* src2, size_t if( op >= 0 ) { fixSteps(size, sizeof(dst[0]), step1, step2, step); - if( ippiCompare_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)size, op) >= 0 ) + if( ippiCompare_16u_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(size), op) >= 0 ) return; } #endif @@ -2282,7 +2282,7 @@ static void cmp16s(const short* src1, size_t step1, const short* src2, size_t st if( op > 0 ) { fixSteps(size, sizeof(dst[0]), step1, step2, step); - if( ippiCompare_16s_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)size, op) >= 0 ) + if( ippiCompare_16s_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(size), op) >= 0 ) return; } #endif @@ -2388,7 +2388,7 @@ static void cmp32f(const float* src1, size_t step1, const float* src2, size_t st if( op >= 0 ) { fixSteps(size, sizeof(dst[0]), step1, step2, step); - if( ippiCompare_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, (IppiSize&)size, op) >= 0 ) + if( ippiCompare_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(size), op) >= 0 ) return; } #endif diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index eb3e22900c..8ad2aabb8b 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -728,10 +728,10 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input dcn_stddev = (int)stddev.total(); pstddev = (Ipp64f *)stddev.data; } - for( int k = cn; k < dcn_mean; k++ ) - pmean[k] = 0; - for( int k = cn; k < dcn_stddev; k++ ) - pstddev[k] = 0; + for( int c = cn; c < dcn_mean; c++ ) + pmean[c] = 0; + for( int c = cn; c < dcn_stddev; c++ ) + pstddev[c] = 0; IppiSize sz = { cols, rows }; int type = src.type(); if( !mask.empty() ) diff --git a/modules/imgproc/src/color.cpp b/modules/imgproc/src/color.cpp index 08f27aef97..a0ff714bb5 100644 --- a/modules/imgproc/src/color.cpp +++ b/modules/imgproc/src/color.cpp @@ -301,6 +301,7 @@ static ippiReorderFunc ippiSwapChannelsC4RTab[] = 0, (ippiReorderFunc)ippiSwapChannels_32f_AC4R, 0, 0 }; +#if 0 static ippiColor2GrayFunc ippiColor2GrayC3Tab[] = { (ippiColor2GrayFunc)ippiColorToGray_8u_C3C1R, 0, (ippiColor2GrayFunc)ippiColorToGray_16u_C3C1R, 0, @@ -312,6 +313,7 @@ static ippiColor2GrayFunc ippiColor2GrayC4Tab[] = (ippiColor2GrayFunc)ippiColorToGray_8u_AC4C1R, 0, (ippiColor2GrayFunc)ippiColorToGray_16u_AC4C1R, 0, 0, (ippiColor2GrayFunc)ippiColorToGray_32f_AC4C1R, 0, 0 }; +#endif static ippiGeneralFunc ippiRGB2GrayC3Tab[] = { diff --git a/modules/imgproc/src/imgwarp.cpp b/modules/imgproc/src/imgwarp.cpp index 6cbb416c9e..dcd718fb68 100644 --- a/modules/imgproc/src/imgwarp.cpp +++ b/modules/imgproc/src/imgwarp.cpp @@ -72,7 +72,7 @@ namespace cv return func(values, dataPointer, step, size) >= 0; } - bool IPPSet(const cv::Scalar &value, void *dataPointer, int step, IppiSize &size, int channels, int depth) + static bool IPPSet(const cv::Scalar &value, void *dataPointer, int step, IppiSize &size, int channels, int depth) { if( channels == 1 ) { @@ -3404,31 +3404,33 @@ class IPPwarpAffineInvoker : public ParallelLoopBody { public: - IPPwarpAffineInvoker(Mat &_src, Mat &_dst, double (&_coeffs)[2][3], int &_interpolation, int &_borderType, const Scalar &_borderValue, ippiWarpAffineBackFunc _func, bool *_ok) : - ParallelLoopBody(), src(_src), dst(_dst), mode(_interpolation), coeffs(_coeffs), borderType(_borderType), borderValue(_borderValue), func(_func), ok(_ok) - { - *ok = true; - } + IPPwarpAffineInvoker(Mat &_src, Mat &_dst, double (&_coeffs)[2][3], int &_interpolation, int &_borderType, + const Scalar &_borderValue, ippiWarpAffineBackFunc _func, bool *_ok) : + ParallelLoopBody(), src(_src), dst(_dst), coeffs(_coeffs), mode(_interpolation), borderType(_borderType), + borderValue(_borderValue), func(_func), ok(_ok) + { + *ok = true; + } - virtual void operator() (const Range& range) const - { - IppiSize srcsize = { src.cols, src.rows }; - IppiRect srcroi = { 0, 0, src.cols, src.rows }; - IppiRect dstroi = { 0, range.start, dst.cols, range.end - range.start }; - int cnn = src.channels(); - if( borderType == BORDER_CONSTANT ) - { - IppiSize setSize = { dst.cols, range.end - range.start }; - void *dataPointer = dst.data + dst.step[0] * range.start; - if( !IPPSet( borderValue, dataPointer, (int)dst.step[0], setSize, cnn, src.depth() ) ) - { - *ok = false; - return; - } - } - if( func( src.data, srcsize, (int)src.step[0], srcroi, dst.data, (int)dst.step[0], dstroi, coeffs, mode ) < 0) ////Aug 2013: problem in IPP 7.1, 8.0 : sometimes function return ippStsCoeffErr - *ok = false; - } + virtual void operator() (const Range& range) const + { + IppiSize srcsize = { src.cols, src.rows }; + IppiRect srcroi = { 0, 0, src.cols, src.rows }; + IppiRect dstroi = { 0, range.start, dst.cols, range.end - range.start }; + int cnn = src.channels(); + if( borderType == BORDER_CONSTANT ) + { + IppiSize setSize = { dst.cols, range.end - range.start }; + void *dataPointer = dst.data + dst.step[0] * range.start; + if( !IPPSet( borderValue, dataPointer, (int)dst.step[0], setSize, cnn, src.depth() ) ) + { + *ok = false; + return; + } + } + if( func( src.data, srcsize, (int)src.step[0], srcroi, dst.data, (int)dst.step[0], dstroi, coeffs, mode ) < 0) ////Aug 2013: problem in IPP 7.1, 8.0 : sometimes function return ippStsCoeffErr + *ok = false; + } private: Mat &src; Mat &dst; @@ -3552,7 +3554,6 @@ class warpPerspectiveInvoker : public ParallelLoopBody { public: - warpPerspectiveInvoker(const Mat &_src, Mat &_dst, double *_M, int _interpolation, int _borderType, const Scalar &_borderValue) : ParallelLoopBody(), src(_src), dst(_dst), M(_M), interpolation(_interpolation), @@ -3644,32 +3645,34 @@ class IPPwarpPerspectiveInvoker : public ParallelLoopBody { public: - IPPwarpPerspectiveInvoker(Mat &_src, Mat &_dst, double (&_coeffs)[3][3], int &_interpolation, int &_borderType, const Scalar &_borderValue, ippiWarpPerspectiveBackFunc _func, bool *_ok) : - ParallelLoopBody(), src(_src), dst(_dst), mode(_interpolation), coeffs(_coeffs), borderType(_borderType), borderValue(_borderValue), func(_func), ok(_ok) - { - *ok = true; - } + IPPwarpPerspectiveInvoker(Mat &_src, Mat &_dst, double (&_coeffs)[3][3], int &_interpolation, + int &_borderType, const Scalar &_borderValue, ippiWarpPerspectiveBackFunc _func, bool *_ok) : + ParallelLoopBody(), src(_src), dst(_dst), coeffs(_coeffs), mode(_interpolation), + borderType(_borderType), borderValue(_borderValue), func(_func), ok(_ok) + { + *ok = true; + } - virtual void operator() (const Range& range) const - { - IppiSize srcsize = {src.cols, src.rows}; - IppiRect srcroi = {0, 0, src.cols, src.rows}; - IppiRect dstroi = {0, range.start, dst.cols, range.end - range.start}; - int cnn = src.channels(); + virtual void operator() (const Range& range) const + { + IppiSize srcsize = {src.cols, src.rows}; + IppiRect srcroi = {0, 0, src.cols, src.rows}; + IppiRect dstroi = {0, range.start, dst.cols, range.end - range.start}; + int cnn = src.channels(); - if( borderType == BORDER_CONSTANT ) - { - IppiSize setSize = {dst.cols, range.end - range.start}; - void *dataPointer = dst.data + dst.step[0] * range.start; - if( !IPPSet( borderValue, dataPointer, (int)dst.step[0], setSize, cnn, src.depth() ) ) - { - *ok = false; - return; - } - } - if( func(src.data, srcsize, (int)src.step[0], srcroi, dst.data, (int)dst.step[0], dstroi, coeffs, mode) < 0) - *ok = false; - } + if( borderType == BORDER_CONSTANT ) + { + IppiSize setSize = {dst.cols, range.end - range.start}; + void *dataPointer = dst.data + dst.step[0] * range.start; + if( !IPPSet( borderValue, dataPointer, (int)dst.step[0], setSize, cnn, src.depth() ) ) + { + *ok = false; + return; + } + } + if( func(src.data, srcsize, (int)src.step[0], srcroi, dst.data, (int)dst.step[0], dstroi, coeffs, mode) < 0) + *ok = false; + } private: Mat &src; Mat &dst; diff --git a/modules/objdetect/src/haar.cpp b/modules/objdetect/src/haar.cpp index 7d22feed9c..d8230d1dfd 100644 --- a/modules/objdetect/src/haar.cpp +++ b/modules/objdetect/src/haar.cpp @@ -1317,9 +1317,9 @@ public: if( cascade->hid_cascade->ipp_stages ) { IppiRect iequRect = {equRect.x, equRect.y, equRect.width, equRect.height}; - ippiRectStdDev_32f_C1R(sum1.ptr(y1), sum1.step, - sqsum1.ptr(y1), sqsum1.step, - norm1->ptr(y1), norm1->step, + ippiRectStdDev_32f_C1R(sum1.ptr(y1), (int)sum1.step, + sqsum1.ptr(y1), (int)sqsum1.step, + norm1->ptr(y1), (int)norm1->step, ippiSize(ssz.width, ssz.height), iequRect ); int positive = (ssz.width/ystep)*((ssz.height + ystep-1)/ystep); @@ -1340,9 +1340,9 @@ public: for( int j = 0; j < cascade->count; j++ ) { if( ippiApplyHaarClassifier_32f_C1R( - sum1.ptr(y1), sum1.step, - norm1->ptr(y1), norm1->step, - mask1->ptr(y1), mask1->step, + sum1.ptr(y1), (int)sum1.step, + norm1->ptr(y1), (int)norm1->step, + mask1->ptr(y1), (int)mask1->step, ippiSize(ssz.width, ssz.height), &positive, cascade->hid_cascade->stage_classifier[j].threshold, (IppiHaarClassifier_32f*)cascade->hid_cascade->ipp_stages[j]) < 0 ) diff --git a/modules/objdetect/src/hog.cpp b/modules/objdetect/src/hog.cpp index c140f3bf72..1c0fbf2aea 100644 --- a/modules/objdetect/src/hog.cpp +++ b/modules/objdetect/src/hog.cpp @@ -747,7 +747,7 @@ void HOGCache::normalizeBlockHistogram(float* _hist) const float sum = 0; #ifdef HAVE_IPP - ippsDotProd_32f(hist,hist,sz,&sum); + ippsDotProd_32f(hist,hist,(int)sz,&sum); #else for( i = 0; i < sz; i++ ) sum += hist[i]*hist[i]; @@ -755,9 +755,9 @@ void HOGCache::normalizeBlockHistogram(float* _hist) const float scale = 1.f/(std::sqrt(sum)+sz*0.1f), thresh = (float)descriptor->L2HysThreshold; #ifdef HAVE_IPP - ippsMulC_32f_I(scale,hist,sz); - ippsThreshold_32f_I( hist, sz, thresh, ippCmpGreater ); - ippsDotProd_32f(hist,hist,sz,&sum); + ippsMulC_32f_I(scale,hist,(int)sz); + ippsThreshold_32f_I( hist, (int)sz, thresh, ippCmpGreater ); + ippsDotProd_32f(hist,hist,(int)sz,&sum); #else for( i = 0, sum = 0; i < sz; i++ ) { @@ -768,7 +768,7 @@ void HOGCache::normalizeBlockHistogram(float* _hist) const scale = 1.f/(std::sqrt(sum)+1e-3f); #ifdef HAVE_IPP - ippsMulC_32f_I(scale,hist,sz); + ippsMulC_32f_I(scale,hist,(int)sz); #else for( i = 0; i < sz; i++ ) hist[i] *= scale;