From e59cff47d404cc41ce3a4c9cc7a407bdbf0bda90 Mon Sep 17 00:00:00 2001 From: "@lizhiyu3" Date: Wed, 20 Jul 2022 17:03:09 +0800 Subject: [PATCH] fix the right border --- modules/imgproc/src/pyramids.cpp | 2 +- modules/imgproc/test/test_pyramid.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/imgproc/src/pyramids.cpp b/modules/imgproc/src/pyramids.cpp index 5727e46255..9b4ad5d840 100644 --- a/modules/imgproc/src/pyramids.cpp +++ b/modules/imgproc/src/pyramids.cpp @@ -1079,7 +1079,7 @@ pyrUp_( const Mat& _src, Mat& _dst, int) if (dsize.width > ssize.width*2) { - row[(_dst.cols-1) + x] = row[dx + cn]; + row[(_dst.cols-1) * cn + x] = row[dx + cn]; } } diff --git a/modules/imgproc/test/test_pyramid.cpp b/modules/imgproc/test/test_pyramid.cpp index e02e5e343d..0556ce6fa6 100644 --- a/modules/imgproc/test/test_pyramid.cpp +++ b/modules/imgproc/test/test_pyramid.cpp @@ -11,7 +11,7 @@ TEST(Imgproc_PyrUp, pyrUp_regression_22184) Mat src(100,100,CV_16UC3,Scalar(255,255,255)); Mat dst(100 * 2 + 1, 100 * 2 + 1, CV_16UC3, Scalar(0,0,0)); pyrUp(src, dst, Size(dst.cols, dst.rows)); - double min_val; + double min_val = 0; minMaxLoc(dst, &min_val); ASSERT_GT(cvRound(min_val), 0); }