mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 22:44:02 +08:00
Merge pull request #19191 from OrestChura:oc/morphEx_perftest
This commit is contained in:
commit
701744c621
@ -30,6 +30,8 @@ class ErodePerfTest : public TestPerfParams<tuple<compare_f, MatType,i
|
||||
class Erode3x3PerfTest : public TestPerfParams<tuple<compare_f, MatType,cv::Size,int, cv::GCompileArgs>> {};
|
||||
class DilatePerfTest : public TestPerfParams<tuple<compare_f, MatType,int,cv::Size,int, cv::GCompileArgs>> {};
|
||||
class Dilate3x3PerfTest : public TestPerfParams<tuple<compare_f, MatType,cv::Size,int, cv::GCompileArgs>> {};
|
||||
class MorphologyExPerfTest : public TestPerfParams<tuple<compare_f,MatType,cv::Size,
|
||||
cv::MorphTypes,cv::GCompileArgs>> {};
|
||||
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 LaplacianPerfTest : public TestPerfParams<tuple<compare_f, MatType,int,cv::Size,int,
|
||||
|
@ -491,6 +491,49 @@ PERF_TEST_P_(Dilate3x3PerfTest, TestPerformance)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(MorphologyExPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF;
|
||||
MatType type = 0;
|
||||
cv::MorphTypes op = cv::MORPH_ERODE;
|
||||
cv::Size sz;
|
||||
cv::GCompileArgs compile_args;
|
||||
std::tie(cmpF, type, sz, op, compile_args) = GetParam();
|
||||
|
||||
initMatrixRandN(type, sz, type, false);
|
||||
|
||||
cv::MorphShapes defShape = cv::MORPH_RECT;
|
||||
int defKernSize = 3;
|
||||
cv::Mat kernel = cv::getStructuringElement(defShape, cv::Size(defKernSize, defKernSize));
|
||||
|
||||
// OpenCV code /////////////////////////////////////////////////////////////
|
||||
{
|
||||
cv::morphologyEx(in_mat1, out_mat_ocv, op, kernel);
|
||||
}
|
||||
|
||||
// G-API code //////////////////////////////////////////////////////////////
|
||||
cv::GMat in;
|
||||
auto out = cv::gapi::morphologyEx(in, op, kernel);
|
||||
cv::GComputation c(in, out);
|
||||
|
||||
// Warm-up graph engine:
|
||||
c.apply(in_mat1, out_mat_gapi, std::move(compile_args));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
c.apply(in_mat1, out_mat_gapi);
|
||||
}
|
||||
|
||||
// Comparison //////////////////////////////////////////////////////////////
|
||||
{
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
EXPECT_EQ(out_mat_gapi.size(), sz);
|
||||
}
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PERF_TEST_P_(SobelPerfTest, TestPerformance)
|
||||
{
|
||||
compare_f cmpF;
|
||||
|
@ -104,6 +104,26 @@ INSTANTIATE_TEST_CASE_P(Dilate3x3PerfTestCPU, Dilate3x3PerfTest,
|
||||
Values(1, 2, 4),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MorphologyExPerfTestCPU, MorphologyExPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::MorphTypes::MORPH_ERODE,
|
||||
cv::MorphTypes::MORPH_DILATE,
|
||||
cv::MorphTypes::MORPH_OPEN,
|
||||
cv::MorphTypes::MORPH_CLOSE,
|
||||
cv::MorphTypes::MORPH_GRADIENT,
|
||||
cv::MorphTypes::MORPH_TOPHAT,
|
||||
cv::MorphTypes::MORPH_BLACKHAT),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MorphologyExHitMissPerfTestCPU, MorphologyExPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1),
|
||||
Values(szVGA, sz720p, sz1080p),
|
||||
Values(cv::MorphTypes::MORPH_HITMISS),
|
||||
Values(cv::compile_args(IMGPROC_CPU))));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SobelPerfTestCPU, SobelPerfTest,
|
||||
Combine(Values(AbsExact().to_compare_f()),
|
||||
Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1),
|
||||
|
@ -46,7 +46,7 @@ GAPI_TEST_FIXTURE(Erode3x3Test, initMatrixRandN, FIXTURE_API(CompareMats,int), 2
|
||||
GAPI_TEST_FIXTURE(DilateTest, initMatrixRandN, FIXTURE_API(CompareMats,int,int), 3,
|
||||
cmpF, kernSize, kernType)
|
||||
GAPI_TEST_FIXTURE(Dilate3x3Test, initMatrixRandN, FIXTURE_API(CompareMats,int), 2, cmpF, numIters)
|
||||
GAPI_TEST_FIXTURE(MorphologyExTest, initMatrixRandN, FIXTURE_API(CompareMats,MorphTypes),
|
||||
GAPI_TEST_FIXTURE(MorphologyExTest, initMatrixRandN, FIXTURE_API(CompareMats,cv::MorphTypes),
|
||||
2, cmpF, op)
|
||||
GAPI_TEST_FIXTURE(SobelTest, initMatrixRandN, FIXTURE_API(CompareMats,int,int,int), 4,
|
||||
cmpF, kernSize, dx, dy)
|
||||
|
@ -313,7 +313,7 @@ TEST_P(Dilate3x3Test, AccuracyTest)
|
||||
|
||||
TEST_P(MorphologyExTest, AccuracyTest)
|
||||
{
|
||||
MorphShapes defShape = cv::MORPH_RECT;
|
||||
cv::MorphShapes defShape = cv::MORPH_RECT;
|
||||
int defKernSize = 3;
|
||||
cv::Mat kernel = cv::getStructuringElement(defShape, cv::Size(defKernSize, defKernSize));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user