From: Daniil Osokin Date: Fri, 10 Aug 2012 11:43:03 +0000 (+0400) Subject: Added perf tests for histogram X-Git-Tag: accepted/2.0/20130307.220821~364^2~261 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b97b48ecb6c785371d7367dc0655cecf88e0efc5;p=profile%2Fivi%2Fopencv.git Added perf tests for histogram --- diff --git a/modules/imgproc/perf/perf_histogram.cpp b/modules/imgproc/perf/perf_histogram.cpp new file mode 100644 index 0000000..77b4d16 --- /dev/null +++ b/modules/imgproc/perf/perf_histogram.cpp @@ -0,0 +1,56 @@ +#include "perf_precomp.hpp" + +using namespace std; +using namespace cv; +using namespace perf; +using namespace testing; +using std::tr1::make_tuple; +using std::tr1::get; + +typedef tr1::tuple Size_Source_t; +typedef TestBaseWithParam Size_Source; + +typedef TestBaseWithParam MatSize; + + +PERF_TEST_P(Size_Source, calcHist, + testing::Combine(testing::Values(TYPICAL_MAT_SIZES), + testing::Values(CV_8U, CV_32F) + ) + ) +{ + Size size = get<0>(GetParam()); + MatType type = get<1>(GetParam()); + Mat source(size.height, size.width, type); + Mat hist; + int channels [] = {0}; + int histSize [] = {256}; + + const float r[] = {0.0f, 256.0f}; + const float* ranges[] = {r}; + + declare.in(source, WARMUP_RNG).time(20).iterations(1000); + TEST_CYCLE() + { + calcHist(&source, 1, channels, Mat(), hist, 1, histSize, ranges); + } + + SANITY_CHECK(hist); +} + +PERF_TEST_P(MatSize, equalizeHist, + testing::Values(TYPICAL_MAT_SIZES) + ) +{ + Size size = GetParam(); + Mat source(size.height, size.width, CV_8U); + Mat destination; + declare.in(source, WARMUP_RNG); + + TEST_CYCLE() + { + equalizeHist(source, destination); + } + + SANITY_CHECK(destination); +} \ No newline at end of file