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 typedef std::tr1::tuple<string, int, double, int, bool> Image_MaxCorners_QualityLevel_MinDistance_BlockSize_UseHarris_t; 10 typedef perf::TestBaseWithParam<Image_MaxCorners_QualityLevel_MinDistance_BlockSize_UseHarris_t> Image_MaxCorners_QualityLevel_MinDistance_BlockSize_UseHarris; 11 12 PERF_TEST_P(Image_MaxCorners_QualityLevel_MinDistance_BlockSize_UseHarris, goodFeaturesToTrack, 13 testing::Combine( 14 testing::Values( "stitching/a1.png", "cv/shared/pic5.png"), 15 testing::Values( 100, 500 ), 16 testing::Values( 0.1, 0.01 ), 17 testing::Values( 3, 5 ), 18 testing::Bool() 19 ) 20 ) 21 { 22 string filename = getDataPath(get<0>(GetParam())); 23 int maxCorners = get<1>(GetParam()); 24 double qualityLevel = get<2>(GetParam()); 25 int blockSize = get<3>(GetParam()); 26 bool useHarrisDetector = get<4>(GetParam()); 27 28 Mat image = imread(filename, IMREAD_GRAYSCALE); 29 if (image.empty()) 30 FAIL() << "Unable to load source image" << filename; 31 32 std::vector<Point2f> corners; 33 34 double minDistance = 1; 35 TEST_CYCLE() goodFeaturesToTrack(image, corners, maxCorners, qualityLevel, minDistance, noArray(), blockSize, useHarrisDetector); 36 37 if (corners.size() > 50) 38 corners.erase(corners.begin() + 50, corners.end()); 39 40 SANITY_CHECK(corners); 41 } 42