perf_houghLines.cpp 1.58 KB
Newer Older
wester committed
1 2 3 4 5 6 7 8 9 10
#include "perf_precomp.hpp"

#include "cmath"

using namespace std;
using namespace cv;
using namespace perf;
using std::tr1::make_tuple;
using std::tr1::get;

wester committed
11
typedef std::tr1::tuple<String, double, double, int> Image_RhoStep_ThetaStep_Threshold_t;
wester committed
12 13
typedef perf::TestBaseWithParam<Image_RhoStep_ThetaStep_Threshold_t> Image_RhoStep_ThetaStep_Threshold;

wester committed
14 15 16 17 18 19 20 21 22 23 24
#ifdef __aarch64__
// In case of  aarch64 the function produces one more line than expected
PERF_TEST_P(Image_RhoStep_ThetaStep_Threshold, DISABLED_HoughLines,
            testing::Combine(
                testing::Values( "cv/shared/pic5.png", "stitching/a1.png" ),
                testing::Values( 1, 10 ),
                testing::Values( 0.01, 0.1 ),
                testing::Values( 300, 500 )
                )
            )
#else
wester committed
25 26 27 28 29
PERF_TEST_P(Image_RhoStep_ThetaStep_Threshold, HoughLines,
            testing::Combine(
                testing::Values( "cv/shared/pic5.png", "stitching/a1.png" ),
                testing::Values( 1, 10 ),
                testing::Values( 0.01, 0.1 ),
a  
Kai Westerkamp committed
30
                testing::Values( 300, 500 )
wester committed
31 32
                )
            )
wester committed
33
#endif
wester committed
34
{
wester committed
35
    String filename = getDataPath(get<0>(GetParam()));
wester committed
36 37
    double rhoStep = get<1>(GetParam());
    double thetaStep = get<2>(GetParam());
a  
Kai Westerkamp committed
38
    int threshold = get<3>(GetParam());
wester committed
39 40 41 42 43

    Mat image = imread(filename, IMREAD_GRAYSCALE);
    if (image.empty())
        FAIL() << "Unable to load source image" << filename;

a  
Kai Westerkamp committed
44
    Canny(image, image, 0, 0);
wester committed
45

a  
Kai Westerkamp committed
46
    Mat lines;
wester committed
47 48 49 50
    declare.time(60);

    TEST_CYCLE() HoughLines(image, lines, rhoStep, thetaStep, threshold);

a  
Kai Westerkamp committed
51
    SANITY_CHECK(lines);
wester committed
52
}