From bfd1504de35a8653f221b2138dd67e35f64879bc Mon Sep 17 00:00:00 2001 From: Dmitry Kurtaev Date: Mon, 8 Apr 2024 09:35:21 +0300 Subject: [PATCH] Resolve valgrind warnings --- modules/core/test/test_arithm.cpp | 10 +++++----- modules/dnn/src/layers/eltwise_layer.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) 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) {