From dfa04a11bbe6d690c7ff81ee83f7537d0c5d02a0 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Wed, 25 Apr 2018 19:32:53 +0300 Subject: [PATCH] core: norm with mask 16UC3 regression test --- modules/core/test/test_arithm.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/modules/core/test/test_arithm.cpp b/modules/core/test/test_arithm.cpp index 5e80a55c65..6c90c1c857 100644 --- a/modules/core/test/test_arithm.cpp +++ b/modules/core/test/test_arithm.cpp @@ -2084,4 +2084,22 @@ TEST(Core_Set, regression_11044) EXPECT_EQ(std::numeric_limits::infinity(), testDouble.at(0, 0)); } +TEST(Core_Norm, IPP_regression_NORM_L1_16UC3_small) +{ + int cn = 3; + Size sz(9, 4); // width < 16 + Mat a(sz, CV_MAKE_TYPE(CV_16U, cn), Scalar::all(1)); + Mat b(sz, CV_MAKE_TYPE(CV_16U, cn), Scalar::all(2)); + uchar mask_[9*4] = { + 255, 255, 255, 0, 255, 255, 0, 255, 0, + 0, 255, 0, 0, 255, 255, 255, 255, 0, + 0, 0, 0, 255, 0, 255, 0, 255, 255, + 0, 0, 255, 0, 255, 255, 255, 0, 255 +}; + Mat mask(sz, CV_8UC1, mask_); + + EXPECT_EQ((double)9*4*cn, cv::norm(a, b, NORM_L1)); // without mask, IPP works well + EXPECT_EQ((double)20*cn, cv::norm(a, b, NORM_L1, mask)); +} + }} // namespace