Commit 02f226a9 authored by Vladislav Vinogradov's avatar Vladislav Vinogradov

fixed bug in gpu::pyrDown

parent 0e27c772
...@@ -75,7 +75,7 @@ namespace cv { namespace gpu { namespace device ...@@ -75,7 +75,7 @@ namespace cv { namespace gpu { namespace device
if (threadIdx.x < 2) if (threadIdx.x < 2)
{ {
const int left_x = x - 2 + threadIdx.x; const int left_x = x - 2;
sum = VecTraits<value_type>::all(0); sum = VecTraits<value_type>::all(0);
...@@ -90,7 +90,7 @@ namespace cv { namespace gpu { namespace device ...@@ -90,7 +90,7 @@ namespace cv { namespace gpu { namespace device
if (threadIdx.x > 253) if (threadIdx.x > 253)
{ {
const int right_x = x + threadIdx.x + 2; const int right_x = x + 2;
sum = VecTraits<value_type>::all(0); sum = VecTraits<value_type>::all(0);
......
...@@ -3484,10 +3484,9 @@ PARAM_TEST_CASE(PyrDown, cv::gpu::DeviceInfo, MatType, UseRoi) ...@@ -3484,10 +3484,9 @@ PARAM_TEST_CASE(PyrDown, cv::gpu::DeviceInfo, MatType, UseRoi)
cv::gpu::DeviceInfo devInfo; cv::gpu::DeviceInfo devInfo;
int type; int type;
bool useRoi; bool useRoi;
cv::Size size;
cv::Mat src; cv::Mat src;
cv::Mat dst_gold; cv::Mat dst_gold;
virtual void SetUp() virtual void SetUp()
...@@ -3500,7 +3499,7 @@ PARAM_TEST_CASE(PyrDown, cv::gpu::DeviceInfo, MatType, UseRoi) ...@@ -3500,7 +3499,7 @@ PARAM_TEST_CASE(PyrDown, cv::gpu::DeviceInfo, MatType, UseRoi)
cv::RNG& rng = TS::ptr()->get_rng(); cv::RNG& rng = TS::ptr()->get_rng();
size = cv::Size(rng.uniform(100, 200), rng.uniform(100, 200)); cv::Size size(rng.uniform(100, 200), rng.uniform(100, 200));
src = randomMat(rng, size, type, 0.0, 255.0, false); src = randomMat(rng, size, type, 0.0, 255.0, false);
...@@ -3518,12 +3517,7 @@ TEST_P(PyrDown, Accuracy) ...@@ -3518,12 +3517,7 @@ TEST_P(PyrDown, Accuracy)
d_dst.download(dst); d_dst.download(dst);
ASSERT_EQ(dst_gold.cols, dst.cols); EXPECT_MAT_NEAR(dst_gold, dst, src.depth() == CV_32F ? 1e-4 : 1.0);
ASSERT_EQ(dst_gold.rows, dst.rows);
ASSERT_EQ(dst_gold.type(), dst.type());
double err = crossCorr(dst_gold, dst) / (cv::norm(dst_gold, cv::NORM_L2) * cv::norm(dst, cv::NORM_L2));
ASSERT_NEAR(err, 1., 1e-2);
} }
INSTANTIATE_TEST_CASE_P(ImgProc, PyrDown, Combine( INSTANTIATE_TEST_CASE_P(ImgProc, PyrDown, Combine(
...@@ -3573,12 +3567,7 @@ TEST_P(PyrUp, Accuracy) ...@@ -3573,12 +3567,7 @@ TEST_P(PyrUp, Accuracy)
d_dst.download(dst); d_dst.download(dst);
ASSERT_EQ(dst_gold.cols, dst.cols); EXPECT_MAT_NEAR(dst_gold, dst, src.depth() == CV_32F ? 1e-4 : 1.0);
ASSERT_EQ(dst_gold.rows, dst.rows);
ASSERT_EQ(dst_gold.type(), dst.type());
double err = cvtest::crossCorr(dst_gold, dst) / (cv::norm(dst_gold, cv::NORM_L2) * cv::norm(dst, cv::NORM_L2));
ASSERT_NEAR(err, 1., 1e-2);
} }
INSTANTIATE_TEST_CASE_P(ImgProc, PyrUp, Combine( INSTANTIATE_TEST_CASE_P(ImgProc, PyrUp, Combine(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment