From 370eb5f53264b50e2f7b55dd723a4a4bb4f715f6 Mon Sep 17 00:00:00 2001 From: Suleyman TURKMEN Date: Tue, 22 Oct 2024 23:45:49 +0300 Subject: [PATCH] Update test_radon_transform.cpp --- .../ximgproc/test/test_radon_transform.cpp | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/modules/ximgproc/test/test_radon_transform.cpp b/modules/ximgproc/test/test_radon_transform.cpp index f84af99d3af..66fe8f44207 100644 --- a/modules/ximgproc/test/test_radon_transform.cpp +++ b/modules/ximgproc/test/test_radon_transform.cpp @@ -9,15 +9,13 @@ namespace opencv_test {namespace { TEST(RadonTransformTest, output_size) { Mat src(Size(256, 256), CV_8U, Scalar(0)); - circle(src, Point(128, 128), 64, Scalar(255), FILLED); Mat radon; - cv::ximgproc::RadonTransform(src, radon); + ximgproc::RadonTransform(src, radon); EXPECT_EQ(363, radon.rows); EXPECT_EQ(180, radon.cols); - cv::ximgproc::RadonTransform(src, radon, 1, 0, 180, true); - + ximgproc::RadonTransform(src, radon, 1, 0, 180, true); EXPECT_EQ(256, radon.rows); EXPECT_EQ(180, radon.cols); } @@ -25,21 +23,22 @@ TEST(RadonTransformTest, output_size) TEST(RadonTransformTest, output_type) { Mat src_int(Size(256, 256), CV_8U, Scalar(0)); - circle(src_int, Point(128, 128), 64, Scalar(255), FILLED); + Mat src_float(Size(256, 256), CV_32FC1, Scalar(0)); + Mat src_double(Size(256, 256), CV_64FC1, Scalar(0)); Mat radon, radon_norm; - cv::ximgproc::RadonTransform(src_int, radon); - cv::ximgproc::RadonTransform(src_int, radon_norm, 1, 0, 180, false, true); + ximgproc::RadonTransform(src_int, radon); + ximgproc::RadonTransform(src_int, radon_norm, 1, 0, 180, false, true); EXPECT_EQ(CV_32SC1, radon.type()); EXPECT_EQ(CV_8U, radon_norm.type()); - Mat src_float(Size(256, 256), CV_32FC1, Scalar(0)); - Mat src_double(Size(256, 256), CV_32FC1, Scalar(0)); - cv::ximgproc::RadonTransform(src_float, radon); - cv::ximgproc::RadonTransform(src_float, radon_norm, 1, 0, 180, false, true); + ximgproc::RadonTransform(src_float, radon); + ximgproc::RadonTransform(src_float, radon_norm, 1, 0, 180, false, true); EXPECT_EQ(CV_64FC1, radon.type()); EXPECT_EQ(CV_8U, radon_norm.type()); - cv::ximgproc::RadonTransform(src_double, radon); + + ximgproc::RadonTransform(src_double, radon); + ximgproc::RadonTransform(src_double, radon_norm, 1, 0, 180, false, true); EXPECT_EQ(CV_64FC1, radon.type()); EXPECT_EQ(CV_8U, radon_norm.type()); } @@ -49,12 +48,10 @@ TEST(RadonTransformTest, accuracy_by_pixel) Mat src(Size(256, 256), CV_8U, Scalar(0)); circle(src, Point(128, 128), 64, Scalar(255), FILLED); Mat radon; - cv::ximgproc::RadonTransform(src, radon); + ximgproc::RadonTransform(src, radon); ASSERT_EQ(CV_32SC1, radon.type()); - EXPECT_EQ(0, radon.at(0, 0)); - EXPECT_LT(18000, radon.at(128, 128)); EXPECT_GT(19000, radon.at(128, 128)); } @@ -62,18 +59,18 @@ TEST(RadonTransformTest, accuracy_by_pixel) TEST(RadonTransformTest, accuracy_uchar) { Mat src(Size(10, 10), CV_8UC1, Scalar(1)); - cv::Mat radon; - ximgproc::RadonTransform(src, radon, 45, 0, 180, false, false); + Mat radon; + ximgproc::RadonTransform(src, radon, 45, 0, 180, false, false); EXPECT_EQ(100, sum(radon.col(0))[0]); } TEST(RadonTransformTest, accuracy_float) { Mat src(Size(10, 10), CV_32FC1, Scalar(1.1)); - cv::Mat radon; - ximgproc::RadonTransform(src, radon, 45, 0, 180, false, false); + Mat radon; + ximgproc::RadonTransform(src, radon, 45, 0, 180, false, false); EXPECT_LT(109, sum(radon.col(0))[0]); EXPECT_GT(111, sum(radon.col(0))[0]); }