From 83390ea4e14296f56718114ec0175166e0747faa Mon Sep 17 00:00:00 2001 From: Marina Kolpakova Date: Wed, 6 Jun 2012 14:45:33 +0000 Subject: [PATCH] performance test for INTER_AREA resize has been added. --- modules/gpu/perf/perf_imgproc.cpp | 5 +++-- modules/gpu/perf/perf_utility.hpp | 2 +- modules/gpu/perf_cpu/perf_imgproc.cpp | 5 +++-- modules/gpu/perf_cpu/perf_utility.hpp | 2 +- modules/gpu/src/cuda/resize.cu | 4 ++++ modules/gpu/test/test_resize.cpp | 2 +- modules/imgproc/test/test_imgwarp.cpp | 2 -- 7 files changed, 13 insertions(+), 9 deletions(-) diff --git a/modules/gpu/perf/perf_imgproc.cpp b/modules/gpu/perf/perf_imgproc.cpp index 42c5eb2..3a714c2 100644 --- a/modules/gpu/perf/perf_imgproc.cpp +++ b/modules/gpu/perf/perf_imgproc.cpp @@ -86,8 +86,9 @@ INSTANTIATE_TEST_CASE_P(ImgProc, Resize, testing::Combine( testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4), MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4), MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)), - testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)), - testing::Values(Scale(0.5), Scale(2.0)))); + testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), + Interpolation(cv::INTER_CUBIC), Interpolation(cv::INTER_AREA)), + testing::Values(Scale(0.5), Scale(0.3)/*, Scale(2.0)*/))); ////////////////////////////////////////////////////////////////////// // WarpAffine diff --git a/modules/gpu/perf/perf_utility.hpp b/modules/gpu/perf/perf_utility.hpp index 6bfc9c8..8693cfc 100644 --- a/modules/gpu/perf/perf_utility.hpp +++ b/modules/gpu/perf/perf_utility.hpp @@ -7,7 +7,7 @@ using perf::MatType; using perf::MatDepth; CV_ENUM(BorderMode, cv::BORDER_REFLECT101, cv::BORDER_REPLICATE, cv::BORDER_CONSTANT, cv::BORDER_REFLECT, cv::BORDER_WRAP) -CV_ENUM(Interpolation, cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_CUBIC) + CV_ENUM(Interpolation, cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_CUBIC, cv::INTER_AREA) CV_ENUM(NormType, cv::NORM_INF, cv::NORM_L1, cv::NORM_L2, cv::NORM_HAMMING) struct CvtColorInfo diff --git a/modules/gpu/perf_cpu/perf_imgproc.cpp b/modules/gpu/perf_cpu/perf_imgproc.cpp index 64f5862..68f38af 100644 --- a/modules/gpu/perf_cpu/perf_imgproc.cpp +++ b/modules/gpu/perf_cpu/perf_imgproc.cpp @@ -76,8 +76,9 @@ INSTANTIATE_TEST_CASE_P(ImgProc, Resize, testing::Combine( testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4), MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4), MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)), - testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)), - testing::Values(Scale(0.5), Scale(2.0)))); + testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), + Interpolation(cv::INTER_CUBIC), Interpolation(cv::INTER_AREA)), + testing::Values(Scale(0.5), Scale(0.3)/*, Scale(2.0)*/))); ////////////////////////////////////////////////////////////////////// // WarpAffine diff --git a/modules/gpu/perf_cpu/perf_utility.hpp b/modules/gpu/perf_cpu/perf_utility.hpp index 6bfc9c8..8693cfc 100644 --- a/modules/gpu/perf_cpu/perf_utility.hpp +++ b/modules/gpu/perf_cpu/perf_utility.hpp @@ -7,7 +7,7 @@ using perf::MatType; using perf::MatDepth; CV_ENUM(BorderMode, cv::BORDER_REFLECT101, cv::BORDER_REPLICATE, cv::BORDER_CONSTANT, cv::BORDER_REFLECT, cv::BORDER_WRAP) -CV_ENUM(Interpolation, cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_CUBIC) + CV_ENUM(Interpolation, cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_CUBIC, cv::INTER_AREA) CV_ENUM(NormType, cv::NORM_INF, cv::NORM_L1, cv::NORM_L2, cv::NORM_HAMMING) struct CvtColorInfo diff --git a/modules/gpu/src/cuda/resize.cu b/modules/gpu/src/cuda/resize.cu index 813bced..e1694db 100644 --- a/modules/gpu/src/cuda/resize.cu +++ b/modules/gpu/src/cuda/resize.cu @@ -105,6 +105,8 @@ namespace cv { namespace gpu { namespace device AreaFilter< BorderReader< PtrStep, BrdConstant > > filteredSrc(brdSrc, fx, fy); resize_area<<>>(filteredSrc, fx, fy, dst); cudaSafeCall( cudaGetLastError() ); + if (stream == 0) + cudaSafeCall( cudaDeviceSynchronize() ); } }; @@ -120,6 +122,8 @@ namespace cv { namespace gpu { namespace device IntegerAreaFilter< BorderReader< PtrStep, BrdConstant > > filteredSrc(brdSrc, fx, fy); resize_area<<>>(filteredSrc, fx, fy, dst); cudaSafeCall( cudaGetLastError() ); + if (stream == 0) + cudaSafeCall( cudaDeviceSynchronize() ); } }; diff --git a/modules/gpu/test/test_resize.cpp b/modules/gpu/test/test_resize.cpp index 2204833..22d7ba3 100644 --- a/modules/gpu/test/test_resize.cpp +++ b/modules/gpu/test/test_resize.cpp @@ -198,7 +198,7 @@ INSTANTIATE_TEST_CASE_P(GPU_ImgProc, ResizeArea, testing::Combine( ALL_DEVICES, DIFFERENT_SIZES, testing::Values(MatType(CV_8UC3), MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4), MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)), - testing::Values(/*0.3,*/0.5), + testing::Values(0.3, 0.5), testing::Values(Interpolation(cv::INTER_AREA)), WHOLE_SUBMAT)); diff --git a/modules/imgproc/test/test_imgwarp.cpp b/modules/imgproc/test/test_imgwarp.cpp index 5d45ccb..afc0bc5 100644 --- a/modules/imgproc/test/test_imgwarp.cpp +++ b/modules/imgproc/test/test_imgwarp.cpp @@ -1495,8 +1495,6 @@ TEST(Imgproc_resize_area, regression) cv::Mat expected(5,5,CV_16UC1, expected_data); cv::resize(src, actual, cv::Size(), 0.3, 0.3, INTER_AREA); - std::cout << actual << std::endl; - std::cout << expected << std::endl; ASSERT_EQ(actual.type(), expected.type()); ASSERT_EQ(actual.size(), expected.size()); -- 2.7.4