Path: blob/master/modules/imgproc/perf/perf_canny.cpp
16339 views
// This file is part of OpenCV project.1// It is subject to the license terms in the LICENSE file found in the top-level directory2// of this distribution and at http://opencv.org/license.html.3#include "perf_precomp.hpp"45namespace opencv_test {67typedef tuple<string, int, bool, tuple<double, double> > Img_Aperture_L2_thresholds_t;8typedef perf::TestBaseWithParam<Img_Aperture_L2_thresholds_t> Img_Aperture_L2_thresholds;910PERF_TEST_P(Img_Aperture_L2_thresholds, canny,11testing::Combine(12testing::Values( "cv/shared/lena.png", "stitching/b1.png", "cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png" ),13testing::Values( 3, 5 ),14testing::Bool(),15testing::Values( make_tuple(50.0, 100.0), make_tuple(0.0, 50.0), make_tuple(100.0, 120.0) )16)17)18{19string filename = getDataPath(get<0>(GetParam()));20int aperture = get<1>(GetParam());21bool useL2 = get<2>(GetParam());22double thresh_low = get<0>(get<3>(GetParam()));23double thresh_high = get<1>(get<3>(GetParam()));2425Mat img = imread(filename, IMREAD_GRAYSCALE);26if (img.empty())27FAIL() << "Unable to load source image " << filename;28Mat edges(img.size(), img.type());2930declare.in(img).out(edges);3132PERF_SAMPLE_BEGIN();33Canny(img, edges, thresh_low, thresh_high, aperture, useL2);34PERF_SAMPLE_END();3536SANITY_CHECK(edges);37}3839} // namespace404142