Merge pull request #25369 from dkurt:resolve_valgrind_warnings

Resolve valgrind warnings
pull/25099/head
Alexander Smorkalov 8 months ago committed by GitHub
commit f2c3d4dfe3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 10
      modules/core/test/test_arithm.cpp
  2. 2
      modules/dnn/src/layers/eltwise_layer.cpp

@ -3250,20 +3250,20 @@ typedef testing::TestWithParam<perf::MatDepth> NonZeroSupportedMatDepth;
TEST_P(NonZeroSupportedMatDepth, findNonZero) 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<Point> pts; vector<Point> pts;
EXPECT_NO_THROW(findNonZero(src, pts)); EXPECT_NO_THROW(findNonZero(src, pts));
} }
TEST_P(NonZeroSupportedMatDepth, countNonZero) 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)); EXPECT_NO_THROW(countNonZero(src));
} }
TEST_P(NonZeroSupportedMatDepth, hasNonZero) 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)); EXPECT_NO_THROW(hasNonZero(src));
} }
@ -3295,7 +3295,7 @@ typedef testing::TestWithParam<perf::MatDepth> MinMaxSupportedMatDepth;
TEST_P(MinMaxSupportedMatDepth, minMaxLoc) 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; double minV=0.0, maxV=0.0;
Point minLoc, maxLoc; Point minLoc, maxLoc;
EXPECT_NO_THROW(cv::minMaxLoc(src, &minV, &maxV, &minLoc, &maxLoc)); EXPECT_NO_THROW(cv::minMaxLoc(src, &minV, &maxV, &minLoc, &maxLoc));
@ -3303,7 +3303,7 @@ TEST_P(MinMaxSupportedMatDepth, minMaxLoc)
TEST_P(MinMaxSupportedMatDepth, minMaxIdx) 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; double minV=0.0, maxV=0.0;
int minIdx=0, maxIdx=0; int minIdx=0, maxIdx=0;
EXPECT_NO_THROW(cv::minMaxIdx(src, &minV, &maxV, &minIdx, &maxIdx)); EXPECT_NO_THROW(cv::minMaxIdx(src, &minV, &maxV, &minIdx, &maxIdx));

@ -233,7 +233,7 @@ public:
outputChannels = numChannels; outputChannels = numChannels;
outputs.assign(1, inputs[0]); outputs.assign(1, inputs[0]);
outputs[0][1] = numChannels; outputs[0][(dims == 1) ? 0 : 1] = numChannels;
if (dims >= 1) if (dims >= 1)
{ {

Loading…
Cancel
Save