1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge pull request #19215 from OrestChura:oc/bRect_perftests

[G-API]: Performance tests for boundingRect

* Update boundingRect() tests with the changes from fitLine() PR

* Add performance tests for boundingRect

* Applying comment about g_type_of_t

* Addressing comments

* Addressing comment: replace cmp_f by CompareF in perf.tests + add the default constructor for CompareF

* Fix typo
This commit is contained in:
Orest Chura
2021-01-13 00:33:05 +03:00
committed by GitHub
parent 3eaeca58da
commit d34a34f328
8 changed files with 181 additions and 128 deletions
@@ -43,6 +43,12 @@ class CannyPerfTest : public TestPerfParams<tuple<compare_f, MatType,c
class GoodFeaturesPerfTest : public TestPerfParams<tuple<compare_vector_f<cv::Point2f>, std::string,
int,int,double,double,int,bool,
cv::GCompileArgs>> {};
class BoundingRectMatPerfTest :
public TestPerfParams<tuple<CompareRects, MatType,cv::Size,bool, cv::GCompileArgs>> {};
class BoundingRectVector32SPerfTest :
public TestPerfParams<tuple<CompareRects, cv::Size, cv::GCompileArgs>> {};
class BoundingRectVector32FPerfTest :
public TestPerfParams<tuple<CompareRects, cv::Size, cv::GCompileArgs>> {};
class EqHistPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs>> {};
class BGR2RGBPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs>> {};
class RGB2GrayPerfTest : public TestPerfParams<tuple<compare_f, cv::Size, cv::GCompileArgs>> {};
@@ -11,6 +11,8 @@
#include "gapi_imgproc_perf_tests.hpp"
#include "../../test/common/gapi_imgproc_tests_common.hpp"
namespace opencv_test
{
@@ -793,6 +795,82 @@ PERF_TEST_P_(GoodFeaturesPerfTest, TestPerformance)
//------------------------------------------------------------------------------
PERF_TEST_P_(BoundingRectMatPerfTest, TestPerformance)
{
CompareRects cmpF;
cv::Size sz;
MatType type;
bool initByVector = false;
cv::GCompileArgs compile_args;
std::tie(cmpF, type, sz, initByVector, compile_args) = GetParam();
if (initByVector)
{
initMatByPointsVectorRandU<cv::Point_>(type, sz, -1);
}
else
{
initMatrixRandU(type, sz, -1, false);
}
cv::Rect out_rect_gapi;
cv::GComputation c(boundingRectTestGAPI(in_mat1, std::move(compile_args), out_rect_gapi));
TEST_CYCLE()
{
c.apply(cv::gin(in_mat1), cv::gout(out_rect_gapi));
}
boundingRectTestOpenCVCompare(in_mat1, out_rect_gapi, cmpF);
SANITY_CHECK_NOTHING();
}
PERF_TEST_P_(BoundingRectVector32SPerfTest, TestPerformance)
{
CompareRects cmpF;
cv::Size sz;
cv::GCompileArgs compile_args;
std::tie(cmpF, sz, compile_args) = GetParam();
std::vector<cv::Point2i> in_vector;
initPointsVectorRandU(sz.width, in_vector);
cv::Rect out_rect_gapi;
cv::GComputation c(boundingRectTestGAPI(in_vector, std::move(compile_args), out_rect_gapi));
TEST_CYCLE()
{
c.apply(cv::gin(in_vector), cv::gout(out_rect_gapi));
}
boundingRectTestOpenCVCompare(in_vector, out_rect_gapi, cmpF);
SANITY_CHECK_NOTHING();
}
PERF_TEST_P_(BoundingRectVector32FPerfTest, TestPerformance)
{
CompareRects cmpF;
cv::Size sz;
cv::GCompileArgs compile_args;
std::tie(cmpF, sz, compile_args) = GetParam();
std::vector<cv::Point2f> in_vector;
initPointsVectorRandU(sz.width, in_vector);
cv::Rect out_rect_gapi;
cv::GComputation c(boundingRectTestGAPI(in_vector, std::move(compile_args), out_rect_gapi));
TEST_CYCLE()
{
c.apply(cv::gin(in_vector), cv::gout(out_rect_gapi));
}
boundingRectTestOpenCVCompare(in_vector, out_rect_gapi, cmpF);
SANITY_CHECK_NOTHING();
}
//------------------------------------------------------------------------------
PERF_TEST_P_(EqHistPerfTest, TestPerformance)
{
compare_f cmpF = get<0>(GetParam());