~paparazzi-uav/paparazzi/v5.0-manual

« back to all changes in this revision

Viewing changes to sw/ext/opencv_bebop/opencv/modules/imgproc/perf/perf_pyramids.cpp

  • Committer: Paparazzi buildbot
  • Date: 2016-05-18 15:00:29 UTC
  • Revision ID: felix.ruess+docbot@gmail.com-20160518150029-e8lgzi5kvb4p7un9
Manual import commit 4b8bbb730080dac23cf816b98908dacfabe2a8ec from v5.0 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "perf_precomp.hpp"
 
2
 
 
3
using namespace std;
 
4
using namespace cv;
 
5
using namespace perf;
 
6
using std::tr1::make_tuple;
 
7
using std::tr1::get;
 
8
 
 
9
PERF_TEST_P(Size_MatType, pyrDown, testing::Combine(
 
10
                testing::Values(sz1080p, sz720p, szVGA, szQVGA, szODD),
 
11
                testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16SC1, CV_16SC3, CV_16SC4, CV_32FC1, CV_32FC3, CV_32FC4)
 
12
                )
 
13
            )
 
14
{
 
15
    Size sz = get<0>(GetParam());
 
16
    int matType = get<1>(GetParam());
 
17
    const double eps = CV_MAT_DEPTH(matType) <= CV_32S ? 1 : 1e-5;
 
18
    perf::ERROR_TYPE error_type = CV_MAT_DEPTH(matType) <= CV_32S ? ERROR_ABSOLUTE : ERROR_RELATIVE;
 
19
 
 
20
    Mat src(sz, matType);
 
21
    Mat dst((sz.height + 1)/2, (sz.width + 1)/2, matType);
 
22
 
 
23
    declare.in(src, WARMUP_RNG).out(dst);
 
24
 
 
25
    TEST_CYCLE() pyrDown(src, dst);
 
26
 
 
27
    SANITY_CHECK(dst, eps, error_type);
 
28
}
 
29
 
 
30
PERF_TEST_P(Size_MatType, pyrUp, testing::Combine(
 
31
                testing::Values(sz720p, szVGA, szQVGA, szODD),
 
32
                testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16SC1, CV_16SC3, CV_16SC4, CV_32FC1, CV_32FC3, CV_32FC4)
 
33
                )
 
34
            )
 
35
{
 
36
    Size sz = get<0>(GetParam());
 
37
    int matType = get<1>(GetParam());
 
38
    const double eps = CV_MAT_DEPTH(matType) <= CV_32S ? 1 : 1e-5;
 
39
    perf::ERROR_TYPE error_type = CV_MAT_DEPTH(matType) <= CV_32S ? ERROR_ABSOLUTE : ERROR_RELATIVE;
 
40
 
 
41
    Mat src(sz, matType);
 
42
    Mat dst(sz.height*2, sz.width*2, matType);
 
43
 
 
44
    declare.in(src, WARMUP_RNG).out(dst);
 
45
 
 
46
    TEST_CYCLE() pyrUp(src, dst);
 
47
 
 
48
    SANITY_CHECK(dst, eps, error_type);
 
49
}
 
50
 
 
51
PERF_TEST_P(Size_MatType, buildPyramid, testing::Combine(
 
52
                testing::Values(sz1080p, sz720p, szVGA, szQVGA, szODD),
 
53
                testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_32FC1, CV_32FC3, CV_32FC4)
 
54
                )
 
55
            )
 
56
{
 
57
    Size sz = get<0>(GetParam());
 
58
    int matType = get<1>(GetParam());
 
59
    int maxLevel = 5;
 
60
    const double eps = CV_MAT_DEPTH(matType) <= CV_32S ? 1 : 1e-5;
 
61
    perf::ERROR_TYPE error_type = CV_MAT_DEPTH(matType) <= CV_32S ? ERROR_ABSOLUTE : ERROR_RELATIVE;
 
62
    Mat src(sz, matType);
 
63
    std::vector<Mat> dst(maxLevel);
 
64
 
 
65
    declare.in(src, WARMUP_RNG);
 
66
 
 
67
    TEST_CYCLE() buildPyramid(src, dst, maxLevel);
 
68
 
 
69
    Mat dst0 = dst[0], dst1 = dst[1], dst2 = dst[2], dst3 = dst[3], dst4 = dst[4];
 
70
 
 
71
    SANITY_CHECK(dst0, eps, error_type);
 
72
    SANITY_CHECK(dst1, eps, error_type);
 
73
    SANITY_CHECK(dst2, eps, error_type);
 
74
    SANITY_CHECK(dst3, eps, error_type);
 
75
    SANITY_CHECK(dst4, eps, error_type);
 
76
}