From b58b04a31caebf5f7ae657c69faafa189a70665a Mon Sep 17 00:00:00 2001 From: Andrey Pavlenko Date: Wed, 7 Sep 2011 12:50:56 +0000 Subject: [PATCH] Perf Tests: updates to cvtColor() & integral() perf tests --- modules/imgproc/perf/perf_cvt_color.cpp | 25 ++++++- modules/imgproc/perf/perf_integral.cpp | 124 ++++++++++++++++++++++---------- 2 files changed, 110 insertions(+), 39 deletions(-) diff --git a/modules/imgproc/perf/perf_cvt_color.cpp b/modules/imgproc/perf/perf_cvt_color.cpp index dc5fb4f..0e7ae27 100644 --- a/modules/imgproc/perf/perf_cvt_color.cpp +++ b/modules/imgproc/perf/perf_cvt_color.cpp @@ -7,8 +7,9 @@ using namespace perf; CV_ENUM(CvtMode, CV_YUV2BGR, CV_YUV2RGB, //YUV CV_YUV420i2BGR, CV_YUV420i2RGB, CV_YUV420sp2BGR, CV_YUV420sp2RGB, //YUV420 CV_RGB2GRAY, CV_RGBA2GRAY, CV_BGR2GRAY, CV_BGRA2GRAY, //Gray - CV_GRAY2RGB, CV_GRAY2RGBA/*, CV_GRAY2BGR, CV_GRAY2BGRA*/ //Gray2 - ) + CV_GRAY2RGB, CV_GRAY2RGBA, /*CV_GRAY2BGR, CV_GRAY2BGRA*/ //Gray2 + CV_BGR2HSV, CV_RGB2HSV, CV_BGR2HLS, CV_RGB2HLS //H +) typedef std::tr1::tuple Size_CvtMode_t; typedef perf::TestBaseWithParam Size_CvtMode; @@ -109,3 +110,23 @@ PERF_TEST_P( Size_CvtMode, cvtColorGray2, SANITY_CHECK(dst); } +PERF_TEST_P( Size_CvtMode, cvtColorH, + testing::Combine( + testing::Values( TYPICAL_MAT_SIZES ), + testing::Values( (int)CV_BGR2HSV, (int)CV_RGB2HSV, (int)CV_BGR2HLS, (int)CV_RGB2HLS ) + ) +) +{ + Size sz = std::tr1::get<0>(GetParam()); + int mode = std::tr1::get<1>(GetParam()); + + Mat src(sz, CV_8UC3); + Mat dst(sz, CV_8UC3); + + declare.in(src, WARMUP_RNG).out(dst); + + TEST_CYCLE(100) { cvtColor(src, dst, mode); } + + SANITY_CHECK(dst); +} + diff --git a/modules/imgproc/perf/perf_integral.cpp b/modules/imgproc/perf/perf_integral.cpp index 0be744a..741b956 100644 --- a/modules/imgproc/perf/perf_integral.cpp +++ b/modules/imgproc/perf/perf_integral.cpp @@ -1,44 +1,94 @@ -#include "perf_precomp.hpp" - -using namespace std; -using namespace cv; -using namespace perf; - -typedef std::tr1::tuple Size_MatType_OutMatDepth_t; -typedef perf::TestBaseWithParam Size_MatType_OutMatDepth; - -/* +#include "perf_precomp.hpp" + +using namespace std; +using namespace cv; +using namespace perf; + +typedef std::tr1::tuple Size_MatType_OutMatDepth_t; +typedef perf::TestBaseWithParam Size_MatType_OutMatDepth; + +/* // void integral(InputArray image, OutputArray sum, int sdepth=-1 ) */ -PERF_TEST_P( Size_MatType_OutMatDepth, integral1, - testing::Combine( - testing::Values( TYPICAL_MAT_SIZES ), - testing::Values( CV_8UC1, CV_8UC4 ), - testing::Values( CV_32S, CV_32F, CV_64F ) - ) - ) -{ - Size sz = std::tr1::get<0>(GetParam()); - int matType = std::tr1::get<1>(GetParam()); - int sdepth = std::tr1::get<2>(GetParam()); - - Mat src(sz, matType); - Mat sum(sz, sdepth); - - declare.in(src, WARMUP_RNG); - - TEST_CYCLE(100) { integral(src, sum, sdepth); } - - SANITY_CHECK(sum); -} - - - -/* +PERF_TEST_P( Size_MatType_OutMatDepth, integral1, + testing::Combine( + testing::Values( TYPICAL_MAT_SIZES ), + testing::Values( CV_8UC1, CV_8UC4 ), + testing::Values( CV_32S, CV_32F, CV_64F ) + ) + ) +{ + Size sz = std::tr1::get<0>(GetParam()); + int matType = std::tr1::get<1>(GetParam()); + int sdepth = std::tr1::get<2>(GetParam()); + + Mat src(sz, matType); + Mat sum(sz, sdepth); + + declare.in(src, WARMUP_RNG).out(sum); + + TEST_CYCLE(100) { integral(src, sum, sdepth); } + + SANITY_CHECK(sum); +} + + + +/* // void integral(InputArray image, OutputArray sum, OutputArray sqsum, int sdepth=-1 ) */ +PERF_TEST_P( Size_MatType_OutMatDepth, integral2, + testing::Combine( + testing::Values( TYPICAL_MAT_SIZES ), + testing::Values( CV_8UC1, CV_8UC4 ), + testing::Values( CV_32S, CV_32F, CV_64F ) + ) + ) +{ + Size sz = std::tr1::get<0>(GetParam()); + int matType = std::tr1::get<1>(GetParam()); + int sdepth = std::tr1::get<2>(GetParam()); + Mat src(sz, matType); + Mat sum(sz, sdepth); + Mat sqsum(sz, sdepth); -/* + declare.in(src, WARMUP_RNG).out(sum, sqsum); + + TEST_CYCLE(100) { integral(src, sum, sqsum, sdepth); } + + SANITY_CHECK(sum); + SANITY_CHECK(sqsum); +} + + + +/* // void integral(InputArray image, OutputArray sum, OutputArray sqsum, OutputArray tilted, int sdepth=-1 ) -*/ \ No newline at end of file +*/ +PERF_TEST_P( Size_MatType_OutMatDepth, integral3, + testing::Combine( + testing::Values( TYPICAL_MAT_SIZES ), + testing::Values( CV_8UC1, CV_8UC4 ), + testing::Values( CV_32S, CV_32F, CV_64F ) + ) + ) +{ + Size sz = std::tr1::get<0>(GetParam()); + int matType = std::tr1::get<1>(GetParam()); + int sdepth = std::tr1::get<2>(GetParam()); + + Mat src(sz, matType); + Mat sum(sz, sdepth); + Mat sqsum(sz, sdepth); + Mat tilted(sz, sdepth); + + declare.in(src, WARMUP_RNG).out(sum, sqsum, tilted); + + TEST_CYCLE(100) { integral(src, sum, sqsum, sdepth); } + + SANITY_CHECK(sum); + SANITY_CHECK(sqsum); + SANITY_CHECK(tilted); +} + -- 2.7.4