diff --git a/modules/calib3d/perf/perf_stereosgbm.cpp b/modules/calib3d/perf/perf_stereosgbm.cpp index 2947938d40..8ae477748a 100644 --- a/modules/calib3d/perf/perf_stereosgbm.cpp +++ b/modules/calib3d/perf/perf_stereosgbm.cpp @@ -41,20 +41,18 @@ namespace opencv_test using namespace perf; using namespace testing; -static void MakeArtificialExample(RNG rng, Mat& dst_left_view, Mat& dst_view); +static void MakeArtificialExample(Mat& dst_left_view, Mat& dst_view); CV_ENUM(SGBMModes, StereoSGBM::MODE_SGBM, StereoSGBM::MODE_SGBM_3WAY, StereoSGBM::MODE_HH4); typedef tuple SGBMParams; -typedef TestBaseWithParam TestStereoCorresp; +typedef TestBaseWithParam TestStereoCorrespSGBM; #ifndef _DEBUG -PERF_TEST_P( TestStereoCorresp, SGBM, Combine(Values(Size(1280,720),Size(640,480)), Values(256,128), SGBMModes::all()) ) +PERF_TEST_P( TestStereoCorrespSGBM, SGBM, Combine(Values(Size(1280,720),Size(640,480)), Values(256,128), SGBMModes::all()) ) #else -PERF_TEST_P( TestStereoCorresp, DISABLED_TooLongInDebug_SGBM, Combine(Values(Size(1280,720),Size(640,480)), Values(256,128), SGBMModes::all()) ) +PERF_TEST_P( TestStereoCorrespSGBM, DISABLED_TooLongInDebug_SGBM, Combine(Values(Size(1280,720),Size(640,480)), Values(256,128), SGBMModes::all()) ) #endif { - RNG rng(0); - SGBMParams params = GetParam(); Size sz = get<0>(params); @@ -65,7 +63,7 @@ PERF_TEST_P( TestStereoCorresp, DISABLED_TooLongInDebug_SGBM, Combine(Values(Siz Mat src_right(sz, CV_8UC3); Mat dst(sz, CV_16S); - MakeArtificialExample(rng,src_left,src_right); + MakeArtificialExample(src_left,src_right); int wsize = 3; int P1 = 8*src_left.channels()*wsize*wsize; @@ -78,8 +76,34 @@ PERF_TEST_P( TestStereoCorresp, DISABLED_TooLongInDebug_SGBM, Combine(Values(Siz SANITY_CHECK(dst, .01, ERROR_RELATIVE); } -void MakeArtificialExample(RNG rng, Mat& dst_left_view, Mat& dst_right_view) +typedef tuple BMParams; +typedef TestBaseWithParam TestStereoCorrespBM; + +PERF_TEST_P(TestStereoCorrespBM, BM, Combine(Values(Size(1280, 720), Size(640, 480)), Values(256, 128))) +{ + BMParams params = GetParam(); + Size sz = get<0>(params); + int num_disparities = get<1>(params); + + Mat src_left(sz, CV_8UC1); + Mat src_right(sz, CV_8UC1); + Mat dst(sz, CV_16S); + + MakeArtificialExample(src_left, src_right); + + int wsize = 21; + TEST_CYCLE() + { + Ptr bm = StereoBM::create(num_disparities, wsize); + bm->compute(src_left, src_right, dst); + } + + SANITY_CHECK(dst, .01, ERROR_RELATIVE); +} + +void MakeArtificialExample(Mat& dst_left_view, Mat& dst_right_view) { + RNG rng(0); int w = dst_left_view.cols; int h = dst_left_view.rows;