Path: blob/master/modules/features2d/perf/opencl/perf_feature2d.cpp
16358 views
#include "../perf_precomp.hpp"1#include "opencv2/ts/ocl_perf.hpp"2#include "../perf_feature2d.hpp"34#ifdef HAVE_OPENCL56namespace opencv_test {7namespace ocl {89OCL_PERF_TEST_P(feature2d, detect, testing::Combine(Feature2DType::all(), TEST_IMAGES))10{11Ptr<Feature2D> detector = getFeature2D(get<0>(GetParam()));12std::string filename = getDataPath(get<1>(GetParam()));13Mat mimg = imread(filename, IMREAD_GRAYSCALE);1415ASSERT_FALSE(mimg.empty());16ASSERT_TRUE(detector);1718UMat img, mask;19mimg.copyTo(img);20declare.in(img);21vector<KeyPoint> points;2223OCL_TEST_CYCLE() detector->detect(img, points, mask);2425EXPECT_GT(points.size(), 20u);26SANITY_CHECK_NOTHING();27}2829OCL_PERF_TEST_P(feature2d, extract, testing::Combine(testing::Values(DETECTORS_EXTRACTORS), TEST_IMAGES))30{31Ptr<Feature2D> detector = AKAZE::create();32Ptr<Feature2D> extractor = getFeature2D(get<0>(GetParam()));33std::string filename = getDataPath(get<1>(GetParam()));34Mat mimg = imread(filename, IMREAD_GRAYSCALE);3536ASSERT_FALSE(mimg.empty());37ASSERT_TRUE(extractor);3839UMat img, mask;40mimg.copyTo(img);41declare.in(img);42vector<KeyPoint> points;43detector->detect(img, points, mask);4445EXPECT_GT(points.size(), 20u);4647UMat descriptors;4849OCL_TEST_CYCLE() extractor->compute(img, points, descriptors);5051EXPECT_EQ((size_t)descriptors.rows, points.size());52SANITY_CHECK_NOTHING();53}5455OCL_PERF_TEST_P(feature2d, detectAndExtract, testing::Combine(testing::Values(DETECTORS_EXTRACTORS), TEST_IMAGES))56{57Ptr<Feature2D> detector = getFeature2D(get<0>(GetParam()));58std::string filename = getDataPath(get<1>(GetParam()));59Mat mimg = imread(filename, IMREAD_GRAYSCALE);6061ASSERT_FALSE(mimg.empty());62ASSERT_TRUE(detector);6364UMat img, mask;65mimg.copyTo(img);66declare.in(img);67vector<KeyPoint> points;68UMat descriptors;6970OCL_TEST_CYCLE() detector->detectAndCompute(img, mask, points, descriptors, false);7172EXPECT_GT(points.size(), 20u);73EXPECT_EQ((size_t)descriptors.rows, points.size());74SANITY_CHECK_NOTHING();75}7677} // ocl78} // cvtest7980#endif // HAVE_OPENCL818283