diff --git a/modules/core/test/test_arithm.cpp b/modules/core/test/test_arithm.cpp index 6908bf2beb..a48b90e385 100644 --- a/modules/core/test/test_arithm.cpp +++ b/modules/core/test/test_arithm.cpp @@ -3250,20 +3250,20 @@ typedef testing::TestWithParam NonZeroSupportedMatDepth; TEST_P(NonZeroSupportedMatDepth, findNonZero) { - cv::Mat src = cv::Mat(16,16, CV_MAKETYPE(GetParam(), 1)); + cv::Mat src = cv::Mat::zeros(16,16, CV_MAKETYPE(GetParam(), 1)); vector pts; EXPECT_NO_THROW(findNonZero(src, pts)); } TEST_P(NonZeroSupportedMatDepth, countNonZero) { - cv::Mat src = cv::Mat(16,16, CV_MAKETYPE(GetParam(), 1)); + cv::Mat src = cv::Mat::zeros(16,16, CV_MAKETYPE(GetParam(), 1)); EXPECT_NO_THROW(countNonZero(src)); } TEST_P(NonZeroSupportedMatDepth, hasNonZero) { - cv::Mat src = cv::Mat(16,16, CV_MAKETYPE(GetParam(), 1)); + cv::Mat src = cv::Mat::zeros(16,16, CV_MAKETYPE(GetParam(), 1)); EXPECT_NO_THROW(hasNonZero(src)); } @@ -3295,7 +3295,7 @@ typedef testing::TestWithParam MinMaxSupportedMatDepth; TEST_P(MinMaxSupportedMatDepth, minMaxLoc) { - cv::Mat src = cv::Mat(16,16, CV_MAKETYPE(GetParam(), 1)); + cv::Mat src = cv::Mat::zeros(16,16, CV_MAKETYPE(GetParam(), 1)); double minV=0.0, maxV=0.0; Point minLoc, maxLoc; EXPECT_NO_THROW(cv::minMaxLoc(src, &minV, &maxV, &minLoc, &maxLoc)); @@ -3303,7 +3303,7 @@ TEST_P(MinMaxSupportedMatDepth, minMaxLoc) TEST_P(MinMaxSupportedMatDepth, minMaxIdx) { - cv::Mat src = cv::Mat(16,16, CV_MAKETYPE(GetParam(), 1)); + cv::Mat src = cv::Mat::zeros(16,16, CV_MAKETYPE(GetParam(), 1)); double minV=0.0, maxV=0.0; int minIdx=0, maxIdx=0; EXPECT_NO_THROW(cv::minMaxIdx(src, &minV, &maxV, &minIdx, &maxIdx)); diff --git a/modules/dnn/src/layers/eltwise_layer.cpp b/modules/dnn/src/layers/eltwise_layer.cpp index 69090d4916..f82c11c849 100644 --- a/modules/dnn/src/layers/eltwise_layer.cpp +++ b/modules/dnn/src/layers/eltwise_layer.cpp @@ -233,7 +233,7 @@ public: outputChannels = numChannels; outputs.assign(1, inputs[0]); - outputs[0][1] = numChannels; + outputs[0][(dims == 1) ? 0 : 1] = numChannels; if (dims >= 1) {