Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/imgproc/perf/perf_canny.cpp
16339 views
1
// This file is part of OpenCV project.
2
// It is subject to the license terms in the LICENSE file found in the top-level directory
3
// of this distribution and at http://opencv.org/license.html.
4
#include "perf_precomp.hpp"
5
6
namespace opencv_test {
7
8
typedef tuple<string, int, bool, tuple<double, double> > Img_Aperture_L2_thresholds_t;
9
typedef perf::TestBaseWithParam<Img_Aperture_L2_thresholds_t> Img_Aperture_L2_thresholds;
10
11
PERF_TEST_P(Img_Aperture_L2_thresholds, canny,
12
testing::Combine(
13
testing::Values( "cv/shared/lena.png", "stitching/b1.png", "cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png" ),
14
testing::Values( 3, 5 ),
15
testing::Bool(),
16
testing::Values( make_tuple(50.0, 100.0), make_tuple(0.0, 50.0), make_tuple(100.0, 120.0) )
17
)
18
)
19
{
20
string filename = getDataPath(get<0>(GetParam()));
21
int aperture = get<1>(GetParam());
22
bool useL2 = get<2>(GetParam());
23
double thresh_low = get<0>(get<3>(GetParam()));
24
double thresh_high = get<1>(get<3>(GetParam()));
25
26
Mat img = imread(filename, IMREAD_GRAYSCALE);
27
if (img.empty())
28
FAIL() << "Unable to load source image " << filename;
29
Mat edges(img.size(), img.type());
30
31
declare.in(img).out(edges);
32
33
PERF_SAMPLE_BEGIN();
34
Canny(img, edges, thresh_low, thresh_high, aperture, useL2);
35
PERF_SAMPLE_END();
36
37
SANITY_CHECK(edges);
38
}
39
40
} // namespace
41
42