Added perf tests for histogram
authorDaniil Osokin <daniil.osokin@itseez.com>
Fri, 10 Aug 2012 11:43:03 +0000 (15:43 +0400)
committerDaniil Osokin <daniil.osokin@itseez.com>
Fri, 10 Aug 2012 11:43:03 +0000 (15:43 +0400)
modules/imgproc/perf/perf_histogram.cpp [new file with mode: 0644]

diff --git a/modules/imgproc/perf/perf_histogram.cpp b/modules/imgproc/perf/perf_histogram.cpp
new file mode 100644 (file)
index 0000000..77b4d16
--- /dev/null
@@ -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, MatType> Size_Source_t;
+typedef TestBaseWithParam<Size_Source_t> Size_Source;
+
+typedef TestBaseWithParam<Size> 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