mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 11:10:21 +08:00
Merge pull request #19337 from OrestChura:oc/fLine_fCont_perftests
[G-API]: Performance tests for fitLine and findContours * Perf.Test for findContours(H) * Perf.Test for fitLine(2D.3D;Mat,vector<Point2i/2f/2d/3i/3f/3d>) * Reducing the template specializations number * Applying comments
This commit is contained in:
parent
cd59516433
commit
e982ad2284
@ -43,12 +43,44 @@ 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 FindContoursPerfTest : public TestPerfParams<tuple<CompareMats, MatType,cv::Size,
|
||||
cv::RetrievalModes,
|
||||
cv::ContourApproximationModes,
|
||||
cv::GCompileArgs>> {};
|
||||
class FindContoursHPerfTest : public TestPerfParams<tuple<CompareMats, MatType,cv::Size,
|
||||
cv::RetrievalModes,
|
||||
cv::ContourApproximationModes,
|
||||
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 FitLine2DMatVectorPerfTest : public TestPerfParams<tuple<CompareVecs<float, 4>,
|
||||
MatType,cv::Size,cv::DistanceTypes,
|
||||
cv::GCompileArgs>> {};
|
||||
class FitLine2DVector32SPerfTest : public TestPerfParams<tuple<CompareVecs<float, 4>,
|
||||
cv::Size,cv::DistanceTypes,
|
||||
cv::GCompileArgs>> {};
|
||||
class FitLine2DVector32FPerfTest : public TestPerfParams<tuple<CompareVecs<float, 4>,
|
||||
cv::Size,cv::DistanceTypes,
|
||||
cv::GCompileArgs>> {};
|
||||
class FitLine2DVector64FPerfTest : public TestPerfParams<tuple<CompareVecs<float, 4>,
|
||||
cv::Size,cv::DistanceTypes,
|
||||
cv::GCompileArgs>> {};
|
||||
class FitLine3DMatVectorPerfTest : public TestPerfParams<tuple<CompareVecs<float, 6>,
|
||||
MatType,cv::Size,cv::DistanceTypes,
|
||||
cv::GCompileArgs>> {};
|
||||
class FitLine3DVector32SPerfTest : public TestPerfParams<tuple<CompareVecs<float, 6>,
|
||||
cv::Size,cv::DistanceTypes,
|
||||
cv::GCompileArgs>> {};
|
||||
class FitLine3DVector32FPerfTest : public TestPerfParams<tuple<CompareVecs<float, 6>,
|
||||
cv::Size,cv::DistanceTypes,
|
||||
cv::GCompileArgs>> {};
|
||||
class FitLine3DVector64FPerfTest : public TestPerfParams<tuple<CompareVecs<float, 6>,
|
||||
cv::Size,cv::DistanceTypes,
|
||||
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>> {};
|
||||
|
@ -795,6 +795,64 @@ PERF_TEST_P_(GoodFeaturesPerfTest, TestPerformance)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(FindContoursPerfTest, TestPerformance)
|
||||
{
|
||||
CompareMats cmpF;
|
||||
MatType type;
|
||||
cv::Size sz;
|
||||
cv::RetrievalModes mode;
|
||||
cv::ContourApproximationModes method;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, type, sz, mode, method, compile_args) = GetParam();
|
||||
|
||||
cv::Mat in;
|
||||
initMatForFindingContours(in, sz, type);
|
||||
cv::Point offset = cv::Point();
|
||||
std::vector<cv::Vec4i> out_hier_gapi = std::vector<cv::Vec4i>();
|
||||
|
||||
std::vector<std::vector<cv::Point>> out_cnts_gapi;
|
||||
cv::GComputation c(findContoursTestGAPI(in, mode, method, std::move(compile_args),
|
||||
out_cnts_gapi, out_hier_gapi, offset));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(gin(in, offset), gout(out_cnts_gapi));
|
||||
}
|
||||
|
||||
findContoursTestOpenCVCompare(in, mode, method, out_cnts_gapi, out_hier_gapi, cmpF);
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(FindContoursHPerfTest, TestPerformance)
|
||||
{
|
||||
CompareMats cmpF;
|
||||
MatType type;
|
||||
cv::Size sz;
|
||||
cv::RetrievalModes mode;
|
||||
cv::ContourApproximationModes method;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, type, sz, mode, method, compile_args) = GetParam();
|
||||
|
||||
cv::Mat in;
|
||||
initMatForFindingContours(in, sz, type);
|
||||
cv::Point offset = cv::Point();
|
||||
|
||||
std::vector<std::vector<cv::Point>> out_cnts_gapi;
|
||||
std::vector<cv::Vec4i> out_hier_gapi;
|
||||
cv::GComputation c(findContoursTestGAPI<HIERARCHY>(in, mode, method, std::move(compile_args),
|
||||
out_cnts_gapi, out_hier_gapi, offset));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(gin(in, offset), gout(out_cnts_gapi, out_hier_gapi));
|
||||
}
|
||||
|
||||
findContoursTestOpenCVCompare<HIERARCHY>(in, mode, method, out_cnts_gapi, out_hier_gapi, cmpF);
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(BoundingRectMatPerfTest, TestPerformance)
|
||||
{
|
||||
CompareRects cmpF;
|
||||
@ -871,6 +929,198 @@ PERF_TEST_P_(BoundingRectVector32FPerfTest, TestPerformance)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(FitLine2DMatVectorPerfTest, TestPerformance)
|
||||
{
|
||||
CompareVecs<float, 4> cmpF;
|
||||
cv::Size sz;
|
||||
MatType type;
|
||||
cv::DistanceTypes distType;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, type, sz, distType, compile_args) = GetParam();
|
||||
|
||||
initMatByPointsVectorRandU<cv::Point_>(type, sz, -1);
|
||||
|
||||
cv::Vec4f out_vec_gapi;
|
||||
cv::GComputation c(fitLineTestGAPI(in_mat1, distType, std::move(compile_args), out_vec_gapi));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(cv::gin(in_mat1), cv::gout(out_vec_gapi));
|
||||
}
|
||||
|
||||
fitLineTestOpenCVCompare(in_mat1, distType, out_vec_gapi, cmpF);
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(FitLine2DVector32SPerfTest, TestPerformance)
|
||||
{
|
||||
CompareVecs<float, 4> cmpF;
|
||||
cv::Size sz;
|
||||
cv::DistanceTypes distType;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, sz, distType, compile_args) = GetParam();
|
||||
|
||||
std::vector<cv::Point2i> in_vector;
|
||||
initPointsVectorRandU(sz.width, in_vector);
|
||||
|
||||
cv::Vec4f out_vec_gapi;
|
||||
cv::GComputation c(fitLineTestGAPI(in_vector, distType, std::move(compile_args),
|
||||
out_vec_gapi));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(cv::gin(in_vector), cv::gout(out_vec_gapi));
|
||||
}
|
||||
|
||||
fitLineTestOpenCVCompare(in_vector, distType, out_vec_gapi, cmpF);
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(FitLine2DVector32FPerfTest, TestPerformance)
|
||||
{
|
||||
CompareVecs<float, 4> cmpF;
|
||||
cv::Size sz;
|
||||
cv::DistanceTypes distType;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, sz, distType, compile_args) = GetParam();
|
||||
|
||||
std::vector<cv::Point2f> in_vector;
|
||||
initPointsVectorRandU(sz.width, in_vector);
|
||||
|
||||
cv::Vec4f out_vec_gapi;
|
||||
cv::GComputation c(fitLineTestGAPI(in_vector, distType, std::move(compile_args),
|
||||
out_vec_gapi));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(cv::gin(in_vector), cv::gout(out_vec_gapi));
|
||||
}
|
||||
|
||||
fitLineTestOpenCVCompare(in_vector, distType, out_vec_gapi, cmpF);
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(FitLine2DVector64FPerfTest, TestPerformance)
|
||||
{
|
||||
CompareVecs<float, 4> cmpF;
|
||||
cv::Size sz;
|
||||
cv::DistanceTypes distType;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, sz, distType, compile_args) = GetParam();
|
||||
|
||||
std::vector<cv::Point2d> in_vector;
|
||||
initPointsVectorRandU(sz.width, in_vector);
|
||||
|
||||
cv::Vec4f out_vec_gapi;
|
||||
cv::GComputation c(fitLineTestGAPI(in_vector, distType, std::move(compile_args),
|
||||
out_vec_gapi));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(cv::gin(in_vector), cv::gout(out_vec_gapi));
|
||||
}
|
||||
|
||||
fitLineTestOpenCVCompare(in_vector, distType, out_vec_gapi, cmpF);
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(FitLine3DMatVectorPerfTest, TestPerformance)
|
||||
{
|
||||
CompareVecs<float, 6> cmpF;
|
||||
cv::Size sz;
|
||||
MatType type;
|
||||
cv::DistanceTypes distType;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, type, sz, distType, compile_args) = GetParam();
|
||||
|
||||
initMatByPointsVectorRandU<cv::Point3_>(type, sz, -1);
|
||||
|
||||
cv::Vec6f out_vec_gapi;
|
||||
cv::GComputation c(fitLineTestGAPI(in_mat1, distType, std::move(compile_args), out_vec_gapi));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(cv::gin(in_mat1), cv::gout(out_vec_gapi));
|
||||
}
|
||||
|
||||
fitLineTestOpenCVCompare(in_mat1, distType, out_vec_gapi, cmpF);
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(FitLine3DVector32SPerfTest, TestPerformance)
|
||||
{
|
||||
CompareVecs<float, 6> cmpF;
|
||||
cv::Size sz;
|
||||
cv::DistanceTypes distType;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, sz, distType, compile_args) = GetParam();
|
||||
|
||||
std::vector<cv::Point3i> in_vector;
|
||||
initPointsVectorRandU(sz.width, in_vector);
|
||||
|
||||
cv::Vec6f out_vec_gapi;
|
||||
cv::GComputation c(fitLineTestGAPI(in_vector, distType, std::move(compile_args),
|
||||
out_vec_gapi));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(cv::gin(in_vector), cv::gout(out_vec_gapi));
|
||||
}
|
||||
|
||||
fitLineTestOpenCVCompare(in_vector, distType, out_vec_gapi, cmpF);
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(FitLine3DVector32FPerfTest, TestPerformance)
|
||||
{
|
||||
CompareVecs<float, 6> cmpF;
|
||||
cv::Size sz;
|
||||
cv::DistanceTypes distType;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, sz, distType, compile_args) = GetParam();
|
||||
|
||||
std::vector<cv::Point3f> in_vector;
|
||||
initPointsVectorRandU(sz.width, in_vector);
|
||||
|
||||
cv::Vec6f out_vec_gapi;
|
||||
cv::GComputation c(fitLineTestGAPI(in_vector, distType, std::move(compile_args),
|
||||
out_vec_gapi));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(cv::gin(in_vector), cv::gout(out_vec_gapi));
|
||||
}
|
||||
|
||||
fitLineTestOpenCVCompare(in_vector, distType, out_vec_gapi, cmpF);
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(FitLine3DVector64FPerfTest, TestPerformance)
|
||||
{
|
||||
CompareVecs<float, 6> cmpF;
|
||||
cv::Size sz;
|
||||
cv::DistanceTypes distType;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, sz, distType, compile_args) = GetParam();
|
||||
|
||||
std::vector<cv::Point3d> in_vector;
|
||||
initPointsVectorRandU(sz.width, in_vector);
|
||||
|
||||
cv::Vec6f out_vec_gapi;
|
||||
cv::GComputation c(fitLineTestGAPI(in_vector, distType, std::move(compile_args),
|
||||
out_vec_gapi));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(cv::gin(in_vector), cv::gout(out_vec_gapi));
|
||||
}
|
||||
|
||||
fitLineTestOpenCVCompare(in_vector, distType, out_vec_gapi, cmpF);
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(EqHistPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF = get<0>(GetParam());
|
||||
|
@ -194,6 +194,42 @@ INSTANTIATE_TEST_CASE_P(GoodFeaturesInternalPerfTestCPU, GoodFeaturesPerfTest,
|
||||
Values(true),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(FindContoursPerfTestCPU, FindContoursPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_obj()),
|
||||
Values(CV_8UC1),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(RETR_EXTERNAL, RETR_LIST, RETR_CCOMP, RETR_TREE),
|
||||
Values(CHAIN_APPROX_NONE, CHAIN_APPROX_SIMPLE,
|
||||
CHAIN_APPROX_TC89_L1, CHAIN_APPROX_TC89_KCOS),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(FindContours32SPerfTestCPU, FindContoursPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_obj()),
|
||||
Values(CV_32SC1),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(RETR_CCOMP, RETR_FLOODFILL),
|
||||
Values(CHAIN_APPROX_NONE, CHAIN_APPROX_SIMPLE,
|
||||
CHAIN_APPROX_TC89_L1, CHAIN_APPROX_TC89_KCOS),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(FindContoursHPerfTestCPU, FindContoursHPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_obj()),
|
||||
Values(CV_8UC1),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(RETR_EXTERNAL, RETR_LIST, RETR_CCOMP, RETR_TREE),
|
||||
Values(CHAIN_APPROX_NONE, CHAIN_APPROX_SIMPLE,
|
||||
CHAIN_APPROX_TC89_L1, CHAIN_APPROX_TC89_KCOS),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(FindContoursH32SPerfTestCPU, FindContoursHPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_obj()),
|
||||
Values(CV_32SC1),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(RETR_CCOMP, RETR_FLOODFILL),
|
||||
Values(CHAIN_APPROX_NONE, CHAIN_APPROX_SIMPLE,
|
||||
CHAIN_APPROX_TC89_L1, CHAIN_APPROX_TC89_KCOS),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BoundingRectMatPerfTestCPU, BoundingRectMatPerfTest,
|
||||
Combine(Values(IoUToleranceRect(0).to_compare_obj()),
|
||||
Values(CV_8UC1),
|
||||
@ -218,6 +254,66 @@ INSTANTIATE_TEST_CASE_P(BoundingRectVector32FPerfTestCPU, BoundingRectVector32FP
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(FitLine2DMatVectorPerfTestCPU, FitLine2DMatVectorPerfTest,
|
||||
Combine(Values(RelDiffToleranceVec<float, 4>(0.01).to_compare_obj()),
|
||||
Values(CV_8U, CV_8S, CV_16U, CV_16S,
|
||||
CV_32S, CV_32F, CV_64F),
|
||||
Values(cv::Size(8, 0), cv::Size(1024, 0)),
|
||||
Values(DIST_L1, DIST_L2, DIST_L12, DIST_FAIR,
|
||||
DIST_WELSCH, DIST_HUBER),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(FitLine2DVector32SPerfTestCPU, FitLine2DVector32SPerfTest,
|
||||
Combine(Values(RelDiffToleranceVec<float, 4>(0.01).to_compare_obj()),
|
||||
Values(cv::Size(8, 0), cv::Size(1024, 0)),
|
||||
Values(DIST_L1, DIST_L2, DIST_L12, DIST_FAIR,
|
||||
DIST_WELSCH, DIST_HUBER),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(FitLine2DVector32FPerfTestCPU, FitLine2DVector32FPerfTest,
|
||||
Combine(Values(RelDiffToleranceVec<float, 4>(0.01).to_compare_obj()),
|
||||
Values(cv::Size(8, 0), cv::Size(1024, 0)),
|
||||
Values(DIST_L1, DIST_L2, DIST_L12, DIST_FAIR,
|
||||
DIST_WELSCH, DIST_HUBER),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(FitLine2DVector64FPerfTestCPU, FitLine2DVector64FPerfTest,
|
||||
Combine(Values(RelDiffToleranceVec<float, 4>(0.01).to_compare_obj()),
|
||||
Values(cv::Size(8, 0), cv::Size(1024, 0)),
|
||||
Values(DIST_L1, DIST_L2, DIST_L12, DIST_FAIR,
|
||||
DIST_WELSCH, DIST_HUBER),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(FitLine3DMatVectorPerfTestCPU, FitLine3DMatVectorPerfTest,
|
||||
Combine(Values(RelDiffToleranceVec<float, 6>(0.01).to_compare_obj()),
|
||||
Values(CV_8U, CV_8S, CV_16U, CV_16S,
|
||||
CV_32S, CV_32F, CV_64F),
|
||||
Values(cv::Size(8, 0), cv::Size(1024, 0)),
|
||||
Values(DIST_L1, DIST_L2, DIST_L12, DIST_FAIR,
|
||||
DIST_WELSCH, DIST_HUBER),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(FitLine3DVector32SPerfTestCPU, FitLine3DVector32SPerfTest,
|
||||
Combine(Values(RelDiffToleranceVec<float, 6>(0.01).to_compare_obj()),
|
||||
Values(cv::Size(8, 0), cv::Size(1024, 0)),
|
||||
Values(DIST_L1, DIST_L2, DIST_L12, DIST_FAIR,
|
||||
DIST_WELSCH, DIST_HUBER),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(FitLine3DVector32FPerfTestCPU, FitLine3DVector32FPerfTest,
|
||||
Combine(Values(RelDiffToleranceVec<float, 6>(0.01).to_compare_obj()),
|
||||
Values(cv::Size(8, 0), cv::Size(1024, 0)),
|
||||
Values(DIST_L1, DIST_L2, DIST_L12, DIST_FAIR,
|
||||
DIST_WELSCH, DIST_HUBER),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(FitLine3DVector64FPerfTestCPU, FitLine3DVector64FPerfTest,
|
||||
Combine(Values(RelDiffToleranceVec<float, 6>(0.01).to_compare_obj()),
|
||||
Values(cv::Size(8, 0), cv::Size(1024, 0)),
|
||||
Values(DIST_L1, DIST_L2, DIST_L12, DIST_FAIR,
|
||||
DIST_WELSCH, DIST_HUBER),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(EqHistPerfTestCPU, EqHistPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
|
@ -68,13 +68,13 @@ GAPI_TEST_FIXTURE_SPEC_PARAMS(GoodFeaturesTest,
|
||||
blockSize, useHarrisDetector)
|
||||
GAPI_TEST_FIXTURE_SPEC_PARAMS(FindContoursNoOffsetTest,
|
||||
FIXTURE_API(cv::Size,MatType2,cv::RetrievalModes,
|
||||
cv::ContourApproximationModes),
|
||||
4, sz, type, mode, method)
|
||||
cv::ContourApproximationModes, CompareMats),
|
||||
5, sz, type, mode, method, cmpF)
|
||||
GAPI_TEST_FIXTURE_SPEC_PARAMS(FindContoursOffsetTest, <>, 0)
|
||||
GAPI_TEST_FIXTURE_SPEC_PARAMS(FindContoursHNoOffsetTest,
|
||||
FIXTURE_API(cv::Size,MatType2,cv::RetrievalModes,
|
||||
cv::ContourApproximationModes),
|
||||
4, sz, type, mode, method)
|
||||
cv::ContourApproximationModes, CompareMats),
|
||||
5, sz, type, mode, method, cmpF)
|
||||
GAPI_TEST_FIXTURE_SPEC_PARAMS(FindContoursHOffsetTest, <>, 0)
|
||||
GAPI_TEST_FIXTURE(BoundingRectMatTest, initNothing, FIXTURE_API(CompareRects,bool),
|
||||
2, cmpF, initByVector)
|
||||
|
@ -14,6 +14,105 @@
|
||||
|
||||
namespace opencv_test
|
||||
{
|
||||
// Draw random ellipses on given cv::Mat of given size and type
|
||||
static void initMatForFindingContours(cv::Mat& mat, const cv::Size& sz, const int type)
|
||||
{
|
||||
cv::RNG& rng = theRNG();
|
||||
mat = cv::Mat(sz, type, cv::Scalar::all(0));
|
||||
const size_t numEllipses = rng.uniform(1, 10);
|
||||
|
||||
for( size_t i = 0; i < numEllipses; i++ )
|
||||
{
|
||||
cv::Point center;
|
||||
cv::Size axes;
|
||||
center.x = rng.uniform(0, sz.width);
|
||||
center.y = rng.uniform(0, sz.height);
|
||||
axes.width = rng.uniform(2, sz.width);
|
||||
axes.height = rng.uniform(2, sz.height);
|
||||
const int color = rng.uniform(1, 256);
|
||||
const double angle = rng.uniform(0., 180.);
|
||||
cv::ellipse(mat, center, axes, angle, 0., 360., color, 1, FILLED);
|
||||
}
|
||||
}
|
||||
|
||||
enum OptionalFindContoursOutput {NONE, HIERARCHY};
|
||||
|
||||
template<OptionalFindContoursOutput optional = NONE>
|
||||
cv::GComputation findContoursTestGAPI(const cv::Mat& in, const cv::RetrievalModes mode,
|
||||
const cv::ContourApproximationModes method,
|
||||
cv::GCompileArgs&& args,
|
||||
std::vector<std::vector<cv::Point>>& out_cnts_gapi,
|
||||
std::vector<cv::Vec4i>& /*out_hier_gapi*/,
|
||||
const cv::Point& offset = cv::Point())
|
||||
{
|
||||
cv::GMat g_in;
|
||||
cv::GOpaque<cv::Point> gOffset;
|
||||
cv::GArray<cv::GArray<cv::Point>> outCts;
|
||||
outCts = cv::gapi::findContours(g_in, mode, method, gOffset);
|
||||
cv::GComputation c(GIn(g_in, gOffset), GOut(outCts));
|
||||
c.apply(gin(in, offset), gout(out_cnts_gapi), std::move(args));
|
||||
return c;
|
||||
}
|
||||
|
||||
template<> cv::GComputation findContoursTestGAPI<HIERARCHY> (
|
||||
const cv::Mat& in, const cv::RetrievalModes mode, const cv::ContourApproximationModes method,
|
||||
cv::GCompileArgs&& args, std::vector<std::vector<cv::Point>>& out_cnts_gapi,
|
||||
std::vector<cv::Vec4i>& out_hier_gapi, const cv::Point& offset)
|
||||
{
|
||||
cv::GMat g_in;
|
||||
cv::GOpaque<cv::Point> gOffset;
|
||||
cv::GArray<cv::GArray<cv::Point>> outCts;
|
||||
cv::GArray<cv::Vec4i> outHier;
|
||||
std::tie(outCts, outHier) = cv::gapi::findContoursH(g_in, mode, method, gOffset);
|
||||
cv::GComputation c(GIn(g_in, gOffset), GOut(outCts, outHier));
|
||||
c.apply(gin(in, offset), gout(out_cnts_gapi, out_hier_gapi), std::move(args));
|
||||
return c;
|
||||
}
|
||||
|
||||
template<OptionalFindContoursOutput optional = NONE>
|
||||
void findContoursTestOpenCVCompare(const cv::Mat& in, const cv::RetrievalModes mode,
|
||||
const cv::ContourApproximationModes method,
|
||||
const std::vector<std::vector<cv::Point>>& out_cnts_gapi,
|
||||
const std::vector<cv::Vec4i>& out_hier_gapi,
|
||||
const CompareMats& cmpF, const cv::Point& offset = cv::Point())
|
||||
{
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
std::vector<std::vector<cv::Point>> out_cnts_ocv;
|
||||
std::vector<cv::Vec4i> out_hier_ocv;
|
||||
cv::findContours(in, out_cnts_ocv, out_hier_ocv, mode, method, offset);
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
EXPECT_TRUE(out_cnts_gapi.size() == out_cnts_ocv.size());
|
||||
|
||||
cv::Mat out_mat_ocv = cv::Mat(cv::Size{ in.cols, in.rows }, in.type(), cv::Scalar::all(0));
|
||||
cv::Mat out_mat_gapi = cv::Mat(cv::Size{ in.cols, in.rows }, in.type(), cv::Scalar::all(0));
|
||||
cv::fillPoly(out_mat_ocv, out_cnts_ocv, cv::Scalar::all(1));
|
||||
cv::fillPoly(out_mat_gapi, out_cnts_gapi, cv::Scalar::all(1));
|
||||
EXPECT_TRUE(cmpF(out_mat_ocv, out_mat_gapi));
|
||||
if (optional == HIERARCHY)
|
||||
{
|
||||
EXPECT_TRUE(out_hier_ocv.size() == out_hier_gapi.size());
|
||||
EXPECT_TRUE(AbsExactVector<cv::Vec4i>().to_compare_f()(out_hier_ocv, out_hier_gapi));
|
||||
}
|
||||
}
|
||||
|
||||
template<OptionalFindContoursOutput optional = NONE>
|
||||
void findContoursTestBody(const cv::Size& sz, const MatType2& type, const cv::RetrievalModes mode,
|
||||
const cv::ContourApproximationModes method, const CompareMats& cmpF,
|
||||
cv::GCompileArgs&& args, const cv::Point& offset = cv::Point())
|
||||
{
|
||||
cv::Mat in;
|
||||
initMatForFindingContours(in, sz, type);
|
||||
|
||||
std::vector<std::vector<cv::Point>> out_cnts_gapi;
|
||||
std::vector<cv::Vec4i> out_hier_gapi;
|
||||
findContoursTestGAPI<optional>(in, mode, method, std::move(args), out_cnts_gapi, out_hier_gapi,
|
||||
offset);
|
||||
findContoursTestOpenCVCompare<optional>(in, mode, method, out_cnts_gapi, out_hier_gapi, cmpF,
|
||||
offset);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
template<typename In>
|
||||
static cv::GComputation boundingRectTestGAPI(const In& in, cv::GCompileArgs&& args,
|
||||
cv::Rect& out_rect_gapi)
|
||||
@ -40,10 +139,59 @@ static void boundingRectTestBody(const In& in, const CompareRects& cmpF, cv::GCo
|
||||
{
|
||||
cv::Rect out_rect_gapi;
|
||||
boundingRectTestGAPI(in, std::move(args), out_rect_gapi);
|
||||
|
||||
boundingRectTestOpenCVCompare(in, out_rect_gapi, cmpF);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
template<typename In>
|
||||
static cv::GComputation fitLineTestGAPI(const In& in, const cv::DistanceTypes distType,
|
||||
cv::GCompileArgs&& args, cv::Vec4f& out_vec_gapi)
|
||||
{
|
||||
const double paramDefault = 0., repsDefault = 0., aepsDefault = 0.;
|
||||
|
||||
cv::detail::g_type_of_t<In> g_in;
|
||||
auto out = cv::gapi::fitLine2D(g_in, distType, paramDefault, repsDefault, aepsDefault);
|
||||
cv::GComputation c(cv::GIn(g_in), cv::GOut(out));
|
||||
c.apply(cv::gin(in), cv::gout(out_vec_gapi), std::move(args));
|
||||
return c;
|
||||
}
|
||||
|
||||
template<typename In>
|
||||
static cv::GComputation fitLineTestGAPI(const In& in, const cv::DistanceTypes distType,
|
||||
cv::GCompileArgs&& args, cv::Vec6f& out_vec_gapi)
|
||||
{
|
||||
const double paramDefault = 0., repsDefault = 0., aepsDefault = 0.;
|
||||
|
||||
cv::detail::g_type_of_t<In> g_in;
|
||||
auto out = cv::gapi::fitLine3D(g_in, distType, paramDefault, repsDefault, aepsDefault);
|
||||
cv::GComputation c(cv::GIn(g_in), cv::GOut(out));
|
||||
c.apply(cv::gin(in), cv::gout(out_vec_gapi), std::move(args));
|
||||
return c;
|
||||
}
|
||||
|
||||
template<typename In, int dim>
|
||||
static void fitLineTestOpenCVCompare(const In& in, const cv::DistanceTypes distType,
|
||||
const cv::Vec<float, dim>& out_vec_gapi,
|
||||
const CompareVecs<float, dim>& cmpF)
|
||||
{
|
||||
const double paramDefault = 0., repsDefault = 0., aepsDefault = 0.;
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
cv::Vec<float, dim> out_vec_ocv;
|
||||
cv::fitLine(in, out_vec_ocv, distType, paramDefault, repsDefault, aepsDefault);
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
EXPECT_TRUE(cmpF(out_vec_gapi, out_vec_ocv));
|
||||
}
|
||||
|
||||
template<typename In, int dim>
|
||||
static void fitLineTestBody(const In& in, const cv::DistanceTypes distType,
|
||||
const CompareVecs<float, dim>& cmpF, cv::GCompileArgs&& args)
|
||||
{
|
||||
cv::Vec<float, dim> out_vec_gapi;
|
||||
fitLineTestGAPI(in, distType, std::move(args), out_vec_gapi);
|
||||
fitLineTestOpenCVCompare(in, distType, out_vec_gapi, cmpF);
|
||||
}
|
||||
} // namespace opencv_test
|
||||
|
||||
#endif // OPENCV_GAPI_VIDEO_TESTS_COMMON_HPP
|
||||
|
@ -52,27 +52,6 @@ namespace
|
||||
rgb2yuyv(in_line_p, out_line_p, in.cols);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw random ellipses on given mat of given size and type
|
||||
void initMatForFindingContours(cv::Mat& mat, const cv::Size& sz, const int type)
|
||||
{
|
||||
cv::RNG& rng = theRNG();
|
||||
mat = cv::Mat(sz, type, cv::Scalar::all(0));
|
||||
size_t numEllipses = rng.uniform(1, 10);
|
||||
|
||||
for( size_t i = 0; i < numEllipses; i++ )
|
||||
{
|
||||
cv::Point center;
|
||||
cv::Size axes;
|
||||
center.x = rng.uniform(0, sz.width);
|
||||
center.y = rng.uniform(0, sz.height);
|
||||
axes.width = rng.uniform(2, sz.width);
|
||||
axes.height = rng.uniform(2, sz.height);
|
||||
int color = rng.uniform(1, 256);
|
||||
double angle = rng.uniform(0., 180.);
|
||||
cv::ellipse(mat, center, axes, angle, 0., 360., color, 1, FILLED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(Filter2DTest, AccuracyTest)
|
||||
@ -495,29 +474,7 @@ TEST_P(GoodFeaturesTest, AccuracyTest)
|
||||
|
||||
TEST_P(FindContoursNoOffsetTest, AccuracyTest)
|
||||
{
|
||||
std::vector<std::vector<cv::Point>> outCtsOCV, outCtsGAPI;
|
||||
|
||||
initMatForFindingContours(in_mat1, sz, type);
|
||||
out_mat_gapi = cv::Mat(sz, type, cv::Scalar::all(0));
|
||||
out_mat_ocv = cv::Mat(sz, type, cv::Scalar::all(0));
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::findContours(in_mat1, outCtsOCV, mode, method);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
cv::GArray<cv::GArray<cv::Point>> outCts;
|
||||
outCts = cv::gapi::findContours(in, mode, method);
|
||||
cv::GComputation c(GIn(in), GOut(outCts));
|
||||
c.apply(gin(in_mat1), gout(outCtsGAPI), getCompileArgs());
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
EXPECT_TRUE(outCtsGAPI.size() == outCtsOCV.size());
|
||||
cv::fillPoly(out_mat_ocv, outCtsOCV, cv::Scalar::all(1));
|
||||
cv::fillPoly(out_mat_gapi, outCtsGAPI, cv::Scalar::all(1));
|
||||
EXPECT_TRUE(AbsExact().to_compare_f()(out_mat_ocv, out_mat_gapi));
|
||||
findContoursTestBody(sz, type, mode, method, cmpF, getCompileArgs());
|
||||
}
|
||||
|
||||
TEST_P(FindContoursOffsetTest, AccuracyTest)
|
||||
@ -526,63 +483,15 @@ TEST_P(FindContoursOffsetTest, AccuracyTest)
|
||||
const MatType2 type = CV_8UC1;
|
||||
const cv::RetrievalModes mode = cv::RETR_EXTERNAL;
|
||||
const cv::ContourApproximationModes method = cv::CHAIN_APPROX_NONE;
|
||||
const CompareMats cmpF = AbsExact().to_compare_obj();
|
||||
const cv::Point offset(15, 15);
|
||||
std::vector<std::vector<cv::Point>> outCtsOCV, outCtsGAPI;
|
||||
|
||||
initMatForFindingContours(in_mat1, sz, type);
|
||||
out_mat_gapi = cv::Mat(sz, type, cv::Scalar::all(0));
|
||||
out_mat_ocv = cv::Mat(sz, type, cv::Scalar::all(0));
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::findContours(in_mat1, outCtsOCV, mode, method, offset);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
GOpaque<Point> gOffset;
|
||||
cv::GArray<cv::GArray<cv::Point>> outCts;
|
||||
outCts = cv::gapi::findContours(in, mode, method, gOffset);
|
||||
cv::GComputation c(GIn(in, gOffset), GOut(outCts));
|
||||
c.apply(gin(in_mat1, offset), gout(outCtsGAPI), getCompileArgs());
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
EXPECT_TRUE(outCtsGAPI.size() == outCtsOCV.size());
|
||||
cv::fillPoly(out_mat_ocv, outCtsOCV, cv::Scalar::all(1));
|
||||
cv::fillPoly(out_mat_gapi, outCtsGAPI, cv::Scalar::all(1));
|
||||
EXPECT_TRUE(AbsExact().to_compare_f()(out_mat_ocv, out_mat_gapi));
|
||||
findContoursTestBody(sz, type, mode, method, cmpF, getCompileArgs(), offset);
|
||||
}
|
||||
|
||||
TEST_P(FindContoursHNoOffsetTest, AccuracyTest)
|
||||
{
|
||||
std::vector<std::vector<cv::Point>> outCtsOCV, outCtsGAPI;
|
||||
std::vector<cv::Vec4i> outHierOCV, outHierGAPI;
|
||||
|
||||
initMatForFindingContours(in_mat1, sz, type);
|
||||
out_mat_gapi = cv::Mat(sz, type, cv::Scalar::all(0));
|
||||
out_mat_ocv = cv::Mat(sz, type, cv::Scalar::all(0));
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::findContours(in_mat1, outCtsOCV, outHierOCV, mode, method);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
cv::GArray<cv::GArray<cv::Point>> outCts;
|
||||
cv::GArray<cv::Vec4i> outHier;
|
||||
std::tie(outCts, outHier) = cv::gapi::findContoursH(in, mode, method);
|
||||
cv::GComputation c(GIn(in), GOut(outCts, outHier));
|
||||
c.apply(gin(in_mat1), gout(outCtsGAPI, outHierGAPI), getCompileArgs());
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
EXPECT_TRUE(outCtsGAPI.size() == outCtsOCV.size());
|
||||
cv::fillPoly(out_mat_ocv, outCtsOCV, cv::Scalar::all(1));
|
||||
cv::fillPoly(out_mat_gapi, outCtsGAPI, cv::Scalar::all(1));
|
||||
EXPECT_TRUE(AbsExact().to_compare_f()(out_mat_ocv, out_mat_gapi));
|
||||
|
||||
EXPECT_TRUE(outCtsGAPI.size() == outCtsOCV.size());
|
||||
EXPECT_TRUE(AbsExactVector<cv::Vec4i>().to_compare_f()(outHierOCV, outHierGAPI));
|
||||
findContoursTestBody<HIERARCHY>(sz, type, mode, method, cmpF, getCompileArgs());
|
||||
}
|
||||
|
||||
TEST_P(FindContoursHOffsetTest, AccuracyTest)
|
||||
@ -591,36 +500,12 @@ TEST_P(FindContoursHOffsetTest, AccuracyTest)
|
||||
const MatType2 type = CV_8UC1;
|
||||
const cv::RetrievalModes mode = cv::RETR_EXTERNAL;
|
||||
const cv::ContourApproximationModes method = cv::CHAIN_APPROX_NONE;
|
||||
const CompareMats cmpF = AbsExact().to_compare_obj();
|
||||
const cv::Point offset(15, 15);
|
||||
std::vector<std::vector<cv::Point>> outCtsOCV, outCtsGAPI;
|
||||
std::vector<cv::Vec4i> outHierOCV, outHierGAPI;
|
||||
|
||||
initMatForFindingContours(in_mat1, sz, type);
|
||||
out_mat_gapi = cv::Mat(sz, type, cv::Scalar::all(0));
|
||||
out_mat_ocv = cv::Mat(sz, type, cv::Scalar::all(0));
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::findContours(in_mat1, outCtsOCV, outHierOCV, mode, method, offset);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
GOpaque<Point> gOffset;
|
||||
cv::GArray<cv::GArray<cv::Point>> outCts;
|
||||
cv::GArray<cv::Vec4i> outHier;
|
||||
std::tie(outCts, outHier) = cv::gapi::findContoursH(in, mode, method, gOffset);
|
||||
cv::GComputation c(GIn(in, gOffset), GOut(outCts, outHier));
|
||||
c.apply(gin(in_mat1, offset), gout(outCtsGAPI, outHierGAPI), getCompileArgs());
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
EXPECT_TRUE(outCtsGAPI.size() == outCtsOCV.size());
|
||||
cv::fillPoly(out_mat_ocv, outCtsOCV, cv::Scalar::all(1));
|
||||
cv::fillPoly(out_mat_gapi, outCtsGAPI, cv::Scalar::all(1));
|
||||
EXPECT_TRUE(AbsExact().to_compare_f()(out_mat_ocv, out_mat_gapi));
|
||||
|
||||
EXPECT_TRUE(outCtsGAPI.size() == outCtsOCV.size());
|
||||
EXPECT_TRUE(AbsExactVector<cv::Vec4i>().to_compare_f()(outHierOCV, outHierGAPI));
|
||||
findContoursTestBody<HIERARCHY>(sz, type, mode, method, cmpF, getCompileArgs(), offset);
|
||||
}
|
||||
|
||||
TEST_P(BoundingRectMatTest, AccuracyTest)
|
||||
@ -655,188 +540,60 @@ TEST_P(BoundingRectVector32FTest, AccuracyTest)
|
||||
|
||||
TEST_P(FitLine2DMatVectorTest, AccuracyTest)
|
||||
{
|
||||
cv::Vec4f out_vec_gapi, out_vec_ocv;
|
||||
double paramDefault = 0., repsDefault = 0., aepsDefault = 0.;
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::fitLine2D(in, distType, paramDefault, repsDefault, aepsDefault);
|
||||
|
||||
cv::GComputation c(cv::GIn(in), cv::GOut(out));
|
||||
c.apply(cv::gin(in_mat1), cv::gout(out_vec_gapi), getCompileArgs());
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::fitLine(in_mat1, out_vec_ocv, distType, paramDefault, repsDefault, aepsDefault);
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_vec_gapi, out_vec_ocv));
|
||||
}
|
||||
fitLineTestBody(in_mat1, distType, cmpF, getCompileArgs());
|
||||
}
|
||||
|
||||
TEST_P(FitLine2DVector32STest, AccuracyTest)
|
||||
{
|
||||
cv::Vec4f out_vec_gapi, out_vec_ocv;
|
||||
double paramDefault = 0., repsDefault = 0., aepsDefault = 0.;
|
||||
|
||||
std::vector<cv::Point2i> in_vec;
|
||||
initPointsVectorRandU(sz.width, in_vec);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GArray<cv::Point2i> in;
|
||||
auto out = cv::gapi::fitLine2D(in, distType, paramDefault, repsDefault, aepsDefault);
|
||||
|
||||
cv::GComputation c(cv::GIn(in), cv::GOut(out));
|
||||
c.apply(cv::gin(in_vec), cv::gout(out_vec_gapi), getCompileArgs());
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::fitLine(in_vec, out_vec_ocv, distType, paramDefault, repsDefault, aepsDefault);
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_vec_gapi, out_vec_ocv));
|
||||
}
|
||||
fitLineTestBody(in_vec, distType, cmpF, getCompileArgs());
|
||||
}
|
||||
|
||||
TEST_P(FitLine2DVector32FTest, AccuracyTest)
|
||||
{
|
||||
cv::Vec4f out_vec_gapi, out_vec_ocv;
|
||||
double paramDefault = 0., repsDefault = 0., aepsDefault = 0.;
|
||||
|
||||
std::vector<cv::Point2f> in_vec;
|
||||
initPointsVectorRandU(sz.width, in_vec);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GArray<cv::Point2f> in;
|
||||
auto out = cv::gapi::fitLine2D(in, distType, paramDefault, repsDefault, aepsDefault);
|
||||
|
||||
cv::GComputation c(cv::GIn(in), cv::GOut(out));
|
||||
c.apply(cv::gin(in_vec), cv::gout(out_vec_gapi), getCompileArgs());
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::fitLine(in_vec, out_vec_ocv, distType, paramDefault, repsDefault, aepsDefault);
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_vec_gapi, out_vec_ocv));
|
||||
}
|
||||
fitLineTestBody(in_vec, distType, cmpF, getCompileArgs());
|
||||
}
|
||||
|
||||
TEST_P(FitLine2DVector64FTest, AccuracyTest)
|
||||
{
|
||||
cv::Vec4f out_vec_gapi, out_vec_ocv;
|
||||
double paramDefault = 0., repsDefault = 0., aepsDefault = 0.;
|
||||
|
||||
std::vector<cv::Point2d> in_vec;
|
||||
initPointsVectorRandU(sz.width, in_vec);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GArray<cv::Point2d> in;
|
||||
auto out = cv::gapi::fitLine2D(in, distType, paramDefault, repsDefault, aepsDefault);
|
||||
|
||||
cv::GComputation c(cv::GIn(in), cv::GOut(out));
|
||||
c.apply(cv::gin(in_vec), cv::gout(out_vec_gapi), getCompileArgs());
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::fitLine(in_vec, out_vec_ocv, distType, paramDefault, repsDefault, aepsDefault);
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_vec_gapi, out_vec_ocv));
|
||||
}
|
||||
fitLineTestBody(in_vec, distType, cmpF, getCompileArgs());
|
||||
}
|
||||
|
||||
TEST_P(FitLine3DMatVectorTest, AccuracyTest)
|
||||
{
|
||||
cv::Vec6f out_vec_gapi, out_vec_ocv;
|
||||
double paramDefault = 0., repsDefault = 0., aepsDefault = 0.;
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::fitLine3D(in, distType, paramDefault, repsDefault, aepsDefault);
|
||||
|
||||
cv::GComputation c(cv::GIn(in), cv::GOut(out));
|
||||
c.apply(cv::gin(in_mat1), cv::gout(out_vec_gapi), getCompileArgs());
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::fitLine(in_mat1, out_vec_ocv, distType, paramDefault, repsDefault, aepsDefault);
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_vec_gapi, out_vec_ocv));
|
||||
}
|
||||
fitLineTestBody(in_mat1, distType, cmpF, getCompileArgs());
|
||||
}
|
||||
|
||||
TEST_P(FitLine3DVector32STest, AccuracyTest)
|
||||
{
|
||||
cv::Vec6f out_vec_gapi, out_vec_ocv;
|
||||
double paramDefault = 0., repsDefault = 0., aepsDefault = 0.;
|
||||
|
||||
std::vector<cv::Point3i> in_vec;
|
||||
initPointsVectorRandU(sz.width, in_vec);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GArray<cv::Point3i> in;
|
||||
auto out = cv::gapi::fitLine3D(in, distType, paramDefault, repsDefault, aepsDefault);
|
||||
|
||||
cv::GComputation c(cv::GIn(in), cv::GOut(out));
|
||||
c.apply(cv::gin(in_vec), cv::gout(out_vec_gapi), getCompileArgs());
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::fitLine(in_vec, out_vec_ocv, distType, paramDefault, repsDefault, aepsDefault);
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_vec_gapi, out_vec_ocv));
|
||||
}
|
||||
fitLineTestBody(in_vec, distType, cmpF, getCompileArgs());
|
||||
}
|
||||
|
||||
TEST_P(FitLine3DVector32FTest, AccuracyTest)
|
||||
{
|
||||
cv::Vec6f out_vec_gapi, out_vec_ocv;
|
||||
double paramDefault = 0., repsDefault = 0., aepsDefault = 0.;
|
||||
|
||||
std::vector<cv::Point3f> in_vec;
|
||||
initPointsVectorRandU(sz.width, in_vec);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GArray<cv::Point3f> in;
|
||||
auto out = cv::gapi::fitLine3D(in, distType, paramDefault, repsDefault, aepsDefault);
|
||||
|
||||
cv::GComputation c(cv::GIn(in), cv::GOut(out));
|
||||
c.apply(cv::gin(in_vec), cv::gout(out_vec_gapi), getCompileArgs());
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::fitLine(in_vec, out_vec_ocv, distType, paramDefault, repsDefault, aepsDefault);
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_vec_gapi, out_vec_ocv));
|
||||
}
|
||||
fitLineTestBody(in_vec, distType, cmpF, getCompileArgs());
|
||||
}
|
||||
|
||||
TEST_P(FitLine3DVector64FTest, AccuracyTest)
|
||||
{
|
||||
cv::Vec6f out_vec_gapi, out_vec_ocv;
|
||||
double paramDefault = 0., repsDefault = 0., aepsDefault = 0.;
|
||||
|
||||
std::vector<cv::Point3d> in_vec;
|
||||
initPointsVectorRandU(sz.width, in_vec);
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GArray<cv::Point3d> in;
|
||||
auto out = cv::gapi::fitLine3D(in, distType, paramDefault, repsDefault, aepsDefault);
|
||||
|
||||
cv::GComputation c(cv::GIn(in), cv::GOut(out));
|
||||
c.apply(cv::gin(in_vec), cv::gout(out_vec_gapi), getCompileArgs());
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::fitLine(in_vec, out_vec_ocv, distType, paramDefault, repsDefault, aepsDefault);
|
||||
}
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_vec_gapi, out_vec_ocv));
|
||||
}
|
||||
fitLineTestBody(in_vec, distType, cmpF, getCompileArgs());
|
||||
}
|
||||
|
||||
TEST_P(BGR2RGBTest, AccuracyTest)
|
||||
|
@ -270,7 +270,8 @@ INSTANTIATE_TEST_CASE_P(FindContoursNoOffsetTestCPU, FindContoursNoOffsetTest,
|
||||
Values(cv::Size(1280, 720)),
|
||||
Values(CV_8UC1),
|
||||
Values(RETR_EXTERNAL),
|
||||
Values(CHAIN_APPROX_NONE)));
|
||||
Values(CHAIN_APPROX_NONE),
|
||||
Values(AbsExact().to_compare_obj())));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(FindContoursOffsetTestCPU, FindContoursOffsetTest,
|
||||
Values(IMGPROC_CPU));
|
||||
@ -282,7 +283,8 @@ INSTANTIATE_TEST_CASE_P(FindContoursHNoOffsetTestCPU, FindContoursHNoOffsetTest,
|
||||
Values(CV_8UC1),
|
||||
Values(RETR_EXTERNAL, RETR_LIST, RETR_CCOMP, RETR_TREE),
|
||||
Values(CHAIN_APPROX_NONE, CHAIN_APPROX_SIMPLE,
|
||||
CHAIN_APPROX_TC89_L1, CHAIN_APPROX_TC89_KCOS)));
|
||||
CHAIN_APPROX_TC89_L1, CHAIN_APPROX_TC89_KCOS),
|
||||
Values(AbsExact().to_compare_obj())));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(FindContoursHNoOffset32STestCPU, FindContoursHNoOffsetTest,
|
||||
Combine(Values(IMGPROC_CPU),
|
||||
@ -291,7 +293,8 @@ INSTANTIATE_TEST_CASE_P(FindContoursHNoOffset32STestCPU, FindContoursHNoOffsetTe
|
||||
Values(CV_32SC1),
|
||||
Values(RETR_CCOMP, RETR_FLOODFILL),
|
||||
Values(CHAIN_APPROX_NONE, CHAIN_APPROX_SIMPLE,
|
||||
CHAIN_APPROX_TC89_L1, CHAIN_APPROX_TC89_KCOS)));
|
||||
CHAIN_APPROX_TC89_L1, CHAIN_APPROX_TC89_KCOS),
|
||||
Values(AbsExact().to_compare_obj())));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(FindContoursHOffsetTestCPU, FindContoursHOffsetTest,
|
||||
Values(IMGPROC_CPU));
|
||||
|
Loading…
Reference in New Issue
Block a user