1#include "perf_precomp.hpp" 2 3using namespace std; 4using namespace cv; 5using namespace perf; 6using std::tr1::make_tuple; 7using std::tr1::get; 8 9typedef std::tr1::tuple<string, int, bool, std::tr1::tuple<double, double> > Img_Aperture_L2_thresholds_t; 10typedef perf::TestBaseWithParam<Img_Aperture_L2_thresholds_t> Img_Aperture_L2_thresholds; 11 12PERF_TEST_P(Img_Aperture_L2_thresholds, canny, 13 testing::Combine( 14 testing::Values( "cv/shared/lena.png", "stitching/b1.png", "cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png" ), 15 testing::Values( 3, 5 ), 16 testing::Bool(), 17 testing::Values( make_tuple(50.0, 100.0), make_tuple(0.0, 50.0), make_tuple(100.0, 120.0) ) 18 ) 19 ) 20{ 21 string filename = getDataPath(get<0>(GetParam())); 22 int aperture = get<1>(GetParam()); 23 bool useL2 = get<2>(GetParam()); 24 double thresh_low = get<0>(get<3>(GetParam())); 25 double thresh_high = get<1>(get<3>(GetParam())); 26 27 Mat img = imread(filename, IMREAD_GRAYSCALE); 28 if (img.empty()) 29 FAIL() << "Unable to load source image " << filename; 30 Mat edges(img.size(), img.type()); 31 32 declare.in(img).out(edges); 33 34 TEST_CYCLE() Canny(img, edges, thresh_low, thresh_high, aperture, useL2); 35 36 SANITY_CHECK(edges); 37} 38