mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +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());
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
#include "../perf_precomp.hpp"
|
||||
@@ -134,6 +134,28 @@ INSTANTIATE_TEST_CASE_P(CannyPerfTestCPU, CannyPerfTest,
|
||||
Values(true, false),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GoodFeaturesPerfTestCPU, GoodFeaturesPerfTest,
|
||||
Combine(Values(AbsExactVector<cv::Point2f>().to_compare_f()),
|
||||
Values("cv/shared/pic5.png", "stitching/a1.png"),
|
||||
Values(CV_32FC1, CV_8UC1),
|
||||
Values(100, 500),
|
||||
Values(0.1, 0.01),
|
||||
Values(1.0),
|
||||
Values(3, 5),
|
||||
Values(true, false),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GoodFeaturesInternalPerfTestCPU, GoodFeaturesPerfTest,
|
||||
Combine(Values(AbsExactVector<cv::Point2f>().to_compare_f()),
|
||||
Values("cv/cascadeandhog/images/audrybt1.png"),
|
||||
Values(CV_32FC1, CV_8UC1),
|
||||
Values(100),
|
||||
Values(0.0000001),
|
||||
Values(5.0),
|
||||
Values(3),
|
||||
Values(true),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(EqHistPerfTestCPU, EqHistPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
|
||||
Reference in New Issue
Block a user