mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
Merge pull request #16717 from OrestChura:oc/goodFeatures
- cv::gapi::goodFeaturesToTrack() kernel is implemented - tests (for exact check with cv::goodFeaturesToTrack() and for internal cases) are implemented - a custom comparison function for vectors and a custom test fixture implemented - some posiible issues as wrong/inexact sorting of two compared vectors are not taken into account - initializations of an input Mat using a picture from opencv_extra implemented (function from gapi_streaming_test used)
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
//
|
||||
// Copyright (C) 2018 Intel Corporation
|
||||
// Copyright (C) 2018-2020 Intel Corporation
|
||||
|
||||
|
||||
#ifndef OPENCV_GAPI_IMGPROC_PERF_TESTS_HPP
|
||||
@@ -33,6 +33,9 @@ class Dilate3x3PerfTest : public TestPerfParams<tuple<compare_f, MatType,cv::Siz
|
||||
class SobelPerfTest : public TestPerfParams<tuple<compare_f, MatType,int,cv::Size,int,int,int, cv::GCompileArgs>> {};
|
||||
class SobelXYPerfTest : public TestPerfParams<tuple<compare_f, MatType,int,cv::Size,int,int, cv::GCompileArgs>> {};
|
||||
class CannyPerfTest : public TestPerfParams<tuple<compare_f, MatType,cv::Size,double,double,int,bool, cv::GCompileArgs>> {};
|
||||
class GoodFeaturesPerfTest : public TestPerfParams<tuple<compare_vector_f<cv::Point2f>, std::string,
|
||||
int,int,double,double,int,bool,
|
||||
cv::GCompileArgs>> {};
|
||||
class EqHistPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs >> {};
|
||||
class RGB2GrayPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs >> {};
|
||||
class BGR2GrayPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs >> {};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
//
|
||||
// Copyright (C) 2018-2019 Intel Corporation
|
||||
// Copyright (C) 2018-2020 Intel Corporation
|
||||
|
||||
|
||||
#ifndef OPENCV_GAPI_IMGPROC_PERF_TESTS_INL_HPP
|
||||
@@ -622,6 +622,53 @@ PERF_TEST_P_(CannyPerfTest, TestPerformance)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(GoodFeaturesPerfTest, TestPerformance)
|
||||
{
|
||||
double k = 0.04;
|
||||
|
||||
compare_vector_f<cv::Point2f> cmpF;
|
||||
std::string fileName = "";
|
||||
int type = -1, maxCorners = -1, blockSize = -1;
|
||||
double qualityLevel = 0.0, minDistance = 0.0;
|
||||
bool useHarrisDetector = false;
|
||||
cv::GCompileArgs compileArgs;
|
||||
std::tie(cmpF, fileName, type, maxCorners, qualityLevel,
|
||||
minDistance, blockSize, useHarrisDetector, compileArgs) = GetParam();
|
||||
|
||||
initMatFromImage(type, fileName);
|
||||
std::vector<cv::Point2f> outVecOCV, outVecGAPI;
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::goodFeaturesToTrack(in_mat1, outVecOCV, maxCorners, qualityLevel, minDistance,
|
||||
cv::noArray(), blockSize, useHarrisDetector, k);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::goodFeaturesToTrack(in, maxCorners, qualityLevel, minDistance, cv::Mat(),
|
||||
blockSize, useHarrisDetector, k);
|
||||
cv::GComputation c(cv::GIn(in), cv::GOut(out));
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(cv::gin(in_mat1), cv::gout(outVecGAPI), std::move(compileArgs));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(cv::gin(in_mat1), cv::gout(outVecGAPI));
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(outVecGAPI, outVecOCV));
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(EqHistPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF = get<0>(GetParam());
|
||||
|
||||
Reference in New Issue
Block a user