[opencv] 02/251: core(perf): added Hamming tests

Nobuhiro Iwamatsu iwamatsu at moszumanska.debian.org
Sun Aug 27 23:27:17 UTC 2017


This is an automated email from the git hooks/post-receive script.

iwamatsu pushed a commit to annotated tag 3.3.0
in repository opencv.

commit 582bb3c311dac87ce2ce1ccb7647895a099c0598
Author: Alexander Alekhin <alexander.a.alekhin at gmail.com>
Date:   Fri Jun 30 22:47:27 2017 +0000

    core(perf): added Hamming tests
---
 modules/core/perf/perf_norm.cpp | 58 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 57 insertions(+), 1 deletion(-)

diff --git a/modules/core/perf/perf_norm.cpp b/modules/core/perf/perf_norm.cpp
index 2df2d4a..1ea6b2a 100644
--- a/modules/core/perf/perf_norm.cpp
+++ b/modules/core/perf/perf_norm.cpp
@@ -6,8 +6,10 @@ using namespace perf;
 using std::tr1::make_tuple;
 using std::tr1::get;
 
+#define HAMMING_NORM_SIZES cv::Size(640, 480), cv::Size(1920, 1080)
+#define HAMMING_NORM_TYPES CV_8UC1
 
-CV_FLAGS(NormType, NORM_INF, NORM_L1, NORM_L2, NORM_TYPE_MASK, NORM_RELATIVE, NORM_MINMAX)
+CV_FLAGS(NormType, NORM_HAMMING2, NORM_HAMMING, NORM_INF, NORM_L1, NORM_L2, NORM_TYPE_MASK, NORM_RELATIVE, NORM_MINMAX)
 typedef std::tr1::tuple<Size, MatType, NormType> Size_MatType_NormType_t;
 typedef perf::TestBaseWithParam<Size_MatType_NormType_t> Size_MatType_NormType;
 
@@ -103,6 +105,60 @@ PERF_TEST_P(Size_MatType_NormType, norm2_mask,
     SANITY_CHECK(n, 1e-5, ERROR_RELATIVE);
 }
 
+namespace {
+typedef std::tr1::tuple<NormType, MatType, Size> PerfHamming_t;
+typedef perf::TestBaseWithParam<PerfHamming_t> PerfHamming;
+
+PERF_TEST_P(PerfHamming, norm,
+            testing::Combine(
+                testing::Values(NORM_HAMMING, NORM_HAMMING2),
+                testing::Values(HAMMING_NORM_TYPES),
+                testing::Values(HAMMING_NORM_SIZES)
+                )
+            )
+{
+    Size sz = get<2>(GetParam());
+    int matType = get<1>(GetParam());
+    int normType = get<0>(GetParam());
+
+    Mat src(sz, matType);
+    double n;
+
+    declare.in(src, WARMUP_RNG);
+
+    TEST_CYCLE() n = norm(src, normType);
+
+    (void)n;
+    SANITY_CHECK_NOTHING();
+}
+
+PERF_TEST_P(PerfHamming, norm2,
+            testing::Combine(
+                testing::Values(NORM_HAMMING, NORM_HAMMING2),
+                testing::Values(HAMMING_NORM_TYPES),
+                testing::Values(HAMMING_NORM_SIZES)
+                )
+            )
+{
+    Size sz = get<2>(GetParam());
+    int matType = get<1>(GetParam());
+    int normType = get<0>(GetParam());
+
+    Mat src1(sz, matType);
+    Mat src2(sz, matType);
+    double n;
+
+    declare.in(src1, src2, WARMUP_RNG);
+
+    TEST_CYCLE() n = norm(src1, src2, normType);
+
+    (void)n;
+    SANITY_CHECK_NOTHING();
+}
+
+}
+
+
 PERF_TEST_P(Size_MatType_NormType, normalize,
             testing::Combine(
                 testing::Values(TYPICAL_MAT_SIZES),

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opencv.git



More information about the debian-science-commits mailing list