Fixed meanStdDev() implementation for the case input matrix has more than 4 channels

This commit is contained in:
Vitaly Tuzov
2018-09-10 20:05:45 +03:00
committed by Sayed Adel
parent 0c8590027f
commit 1ff11c84ab
2 changed files with 24 additions and 7 deletions
+17
View File
@@ -2184,4 +2184,21 @@ TEST(Core_ConvertTo, regression_12121)
}
}
TEST(Core_MeanStdDev, regression_multichannel)
{
{
uchar buf[] = { 1, 2, 3, 4, 5, 6, 7, 8,
3, 4, 5, 6, 7, 8, 9, 10 };
double ref_buf[] = { 2., 3., 4., 5., 6., 7., 8., 9.,
1., 1., 1., 1., 1., 1., 1., 1. };
Mat src(1, 2, CV_MAKETYPE(CV_8U, 8), buf);
Mat ref_m(8, 1, CV_64FC1, ref_buf);
Mat ref_sd(8, 1, CV_64FC1, ref_buf + 8);
Mat dst_m, dst_sd;
meanStdDev(src, dst_m, dst_sd);
EXPECT_EQ(0, cv::norm(dst_m, ref_m, NORM_L1));
EXPECT_EQ(0, cv::norm(dst_sd, ref_sd, NORM_L1));
}
}
}} // namespace