From 96b008cd292a1969be7e7e661492661f3cadcfe0 Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Mon, 15 Apr 2013 19:39:49 +0400 Subject: [PATCH] Eliminate the need of ::testsing::ValuesIn() for CV_ENUM Also cv::, cv::gpu:: and cv::ocl:: namespace prefixes can be safely omitted inside CV_ENUM and CV_FLAGS --- modules/core/perf/perf_compare.cpp | 4 +- modules/core/perf/perf_reduce.cpp | 4 +- modules/features2d/perf/perf_fast.cpp | 2 +- modules/gpu/perf/perf_core.cpp | 21 ++-- modules/gpu/perf/perf_filters.cpp | 5 +- modules/gpu/perf/perf_imgproc.cpp | 32 +++--- modules/gpu/test/test_core.cpp | 9 +- modules/gpu/test/test_features2d.cpp | 2 +- modules/gpu/test/test_filters.cpp | 5 +- modules/gpu/test/test_imgproc.cpp | 7 +- modules/gpu/test/test_optflow.cpp | 2 +- modules/gpu/test/test_threshold.cpp | 5 +- modules/imgproc/perf/perf_bilateral.cpp | 2 +- modules/imgproc/perf/perf_blur.cpp | 14 +-- .../imgproc/perf/perf_cornerEigenValsAndVecs.cpp | 2 +- modules/imgproc/perf/perf_cornerHarris.cpp | 2 +- modules/imgproc/perf/perf_cvt_color.cpp | 8 +- modules/imgproc/perf/perf_filter2d.cpp | 2 +- modules/imgproc/perf/perf_matchTemplate.cpp | 4 +- modules/imgproc/perf/perf_remap.cpp | 2 +- modules/imgproc/perf/perf_sepfilters.cpp | 16 +-- modules/imgproc/perf/perf_threshold.cpp | 6 +- modules/imgproc/perf/perf_warp.cpp | 18 +-- modules/ocl/test/test_brute_force_matcher.cpp | 6 +- modules/ocl/test/utility.hpp | 31 ++---- modules/photo/perf/perf_inpaint.cpp | 2 +- modules/ts/include/opencv2/ts/gpu_perf.hpp | 12 +- modules/ts/include/opencv2/ts/gpu_test.hpp | 8 +- modules/ts/include/opencv2/ts/ts_perf.hpp | 122 +++++++++++---------- modules/video/perf/perf_optflowpyrlk.cpp | 2 +- 30 files changed, 168 insertions(+), 189 deletions(-) diff --git a/modules/core/perf/perf_compare.cpp b/modules/core/perf/perf_compare.cpp index 5fb755d..86d07d9 100644 --- a/modules/core/perf/perf_compare.cpp +++ b/modules/core/perf/perf_compare.cpp @@ -15,7 +15,7 @@ PERF_TEST_P( Size_MatType_CmpType, compare, testing::Combine( testing::Values(::perf::szVGA, ::perf::sz1080p), testing::Values(CV_8UC1, CV_8UC4, CV_8SC1, CV_16UC1, CV_16SC1, CV_32SC1, CV_32FC1), - testing::ValuesIn(CmpType::all()) + CmpType::all() ) ) { @@ -38,7 +38,7 @@ PERF_TEST_P( Size_MatType_CmpType, compareScalar, testing::Combine( testing::Values(TYPICAL_MAT_SIZES), testing::Values(TYPICAL_MAT_TYPES), - testing::ValuesIn(CmpType::all()) + CmpType::all() ) ) { diff --git a/modules/core/perf/perf_reduce.cpp b/modules/core/perf/perf_reduce.cpp index 81cdb5d..93d3a14 100644 --- a/modules/core/perf/perf_reduce.cpp +++ b/modules/core/perf/perf_reduce.cpp @@ -16,7 +16,7 @@ PERF_TEST_P(Size_MatType_ROp, reduceR, testing::Combine( testing::Values(TYPICAL_MAT_SIZES), testing::Values(TYPICAL_MAT_TYPES), - testing::ValuesIn(ROp::all()) + ROp::all() ) ) { @@ -43,7 +43,7 @@ PERF_TEST_P(Size_MatType_ROp, reduceC, testing::Combine( testing::Values(TYPICAL_MAT_SIZES), testing::Values(TYPICAL_MAT_TYPES), - testing::ValuesIn(ROp::all()) + ROp::all() ) ) { diff --git a/modules/features2d/perf/perf_fast.cpp b/modules/features2d/perf/perf_fast.cpp index 6ea0433..f6a47fe 100644 --- a/modules/features2d/perf/perf_fast.cpp +++ b/modules/features2d/perf/perf_fast.cpp @@ -18,7 +18,7 @@ typedef perf::TestBaseWithParam fast; PERF_TEST_P(fast, detect, testing::Combine( testing::Values(FAST_IMAGES), - testing::ValuesIn(FastType::all()) + FastType::all() )) { String filename = getDataPath(get<0>(GetParam())); diff --git a/modules/gpu/perf/perf_core.cpp b/modules/gpu/perf/perf_core.cpp index 3461880..3042bea 100644 --- a/modules/gpu/perf/perf_core.cpp +++ b/modules/gpu/perf/perf_core.cpp @@ -712,15 +712,14 @@ PERF_TEST_P(Sz_Depth_Power, Core_Pow, ////////////////////////////////////////////////////////////////////// // CompareMat -CV_ENUM(CmpCode, cv::CMP_EQ, cv::CMP_GT, cv::CMP_GE, cv::CMP_LT, cv::CMP_LE, cv::CMP_NE) -#define ALL_CMP_CODES ValuesIn(CmpCode::all()) +CV_ENUM(CmpCode, CMP_EQ, CMP_GT, CMP_GE, CMP_LT, CMP_LE, CMP_NE) DEF_PARAM_TEST(Sz_Depth_Code, cv::Size, MatDepth, CmpCode); PERF_TEST_P(Sz_Depth_Code, Core_CompareMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH, - ALL_CMP_CODES)) + CmpCode::all())) { const cv::Size size = GET_PARAM(0); const int depth = GET_PARAM(1); @@ -758,7 +757,7 @@ PERF_TEST_P(Sz_Depth_Code, Core_CompareMat, PERF_TEST_P(Sz_Depth_Code, Core_CompareScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH, - ALL_CMP_CODES)) + CmpCode::all())) { const cv::Size size = GET_PARAM(0); const int depth = GET_PARAM(1); @@ -1304,7 +1303,7 @@ PERF_TEST_P(Sz_3Depth, Core_AddWeighted, ////////////////////////////////////////////////////////////////////// // GEMM -CV_FLAGS(GemmFlags, 0, cv::GEMM_1_T, cv::GEMM_2_T, cv::GEMM_3_T) +CV_FLAGS(GemmFlags, 0, GEMM_1_T, GEMM_2_T, GEMM_3_T) #define ALL_GEMM_FLAGS Values(0, CV_GEMM_A_T, CV_GEMM_B_T, CV_GEMM_C_T, CV_GEMM_A_T | CV_GEMM_B_T, CV_GEMM_A_T | CV_GEMM_C_T, CV_GEMM_A_T | CV_GEMM_B_T | CV_GEMM_C_T) DEF_PARAM_TEST(Sz_Type_Flags, cv::Size, MatType, GemmFlags); @@ -1389,7 +1388,6 @@ PERF_TEST_P(Sz_Type, Core_Transpose, enum {FLIP_BOTH = 0, FLIP_X = 1, FLIP_Y = -1}; CV_ENUM(FlipCode, FLIP_BOTH, FLIP_X, FLIP_Y) -#define ALL_FLIP_CODES ValuesIn(FlipCode::all()) DEF_PARAM_TEST(Sz_Depth_Cn_Code, cv::Size, MatDepth, MatCn, FlipCode); @@ -1397,7 +1395,7 @@ PERF_TEST_P(Sz_Depth_Cn_Code, Core_Flip, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F), GPU_CHANNELS_1_3_4, - ALL_FLIP_CODES)) + FlipCode::all())) { const cv::Size size = GET_PARAM(0); const int depth = GET_PARAM(1); @@ -2071,12 +2069,9 @@ PERF_TEST_P(Sz_Depth, Core_CountNonZero, ////////////////////////////////////////////////////////////////////// // Reduce -CV_ENUM(ReduceCode, CV_REDUCE_SUM, CV_REDUCE_AVG, CV_REDUCE_MAX, CV_REDUCE_MIN) -#define ALL_REDUCE_CODES ValuesIn(ReduceCode::all()) - enum {Rows = 0, Cols = 1}; +CV_ENUM(ReduceCode, CV_REDUCE_SUM, CV_REDUCE_AVG, CV_REDUCE_MAX, CV_REDUCE_MIN) CV_ENUM(ReduceDim, Rows, Cols) -#define ALL_REDUCE_DIMS ValuesIn(ReduceDim::all()) DEF_PARAM_TEST(Sz_Depth_Cn_Code_Dim, cv::Size, MatDepth, MatCn, ReduceCode, ReduceDim); @@ -2084,8 +2079,8 @@ PERF_TEST_P(Sz_Depth_Cn_Code_Dim, Core_Reduce, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_16S, CV_32F), Values(1, 2, 3, 4), - ALL_REDUCE_CODES, - ALL_REDUCE_DIMS)) + ReduceCode::all(), + ReduceDim::all())) { const cv::Size size = GET_PARAM(0); const int depth = GET_PARAM(1); diff --git a/modules/gpu/perf/perf_filters.cpp b/modules/gpu/perf/perf_filters.cpp index 84d9cc4..40d88aa 100644 --- a/modules/gpu/perf/perf_filters.cpp +++ b/modules/gpu/perf/perf_filters.cpp @@ -291,12 +291,11 @@ PERF_TEST_P(Sz_Type, Filters_Dilate, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U ////////////////////////////////////////////////////////////////////// // MorphologyEx -CV_ENUM(MorphOp, cv::MORPH_OPEN, cv::MORPH_CLOSE, cv::MORPH_GRADIENT, cv::MORPH_TOPHAT, cv::MORPH_BLACKHAT) -#define ALL_MORPH_OPS ValuesIn(MorphOp::all()) +CV_ENUM(MorphOp, MORPH_OPEN, MORPH_CLOSE, MORPH_GRADIENT, MORPH_TOPHAT, MORPH_BLACKHAT) DEF_PARAM_TEST(Sz_Type_Op, cv::Size, MatType, MorphOp); -PERF_TEST_P(Sz_Type_Op, Filters_MorphologyEx, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4), ALL_MORPH_OPS)) +PERF_TEST_P(Sz_Type_Op, Filters_MorphologyEx, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4), MorphOp::all())) { declare.time(20.0); diff --git a/modules/gpu/perf/perf_imgproc.cpp b/modules/gpu/perf/perf_imgproc.cpp index eff2bfc..ee46012 100644 --- a/modules/gpu/perf/perf_imgproc.cpp +++ b/modules/gpu/perf/perf_imgproc.cpp @@ -51,7 +51,6 @@ using namespace perf; enum { HALF_SIZE=0, UPSIDE_DOWN, REFLECTION_X, REFLECTION_BOTH }; CV_ENUM(RemapMode, HALF_SIZE, UPSIDE_DOWN, REFLECTION_X, REFLECTION_BOTH); -#define ALL_REMAP_MODES ValuesIn(RemapMode::all()) void generateMap(cv::Mat& map_x, cv::Mat& map_y, int remapMode) { @@ -98,7 +97,7 @@ PERF_TEST_P(Sz_Depth_Cn_Inter_Border_Mode, ImgProc_Remap, GPU_CHANNELS_1_3_4, Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)), ALL_BORDER_MODES, - ALL_REMAP_MODES)) + RemapMode::all())) { declare.time(20.0); @@ -369,15 +368,14 @@ PERF_TEST_P(Sz_Depth_Cn_Border, ImgProc_CopyMakeBorder, ////////////////////////////////////////////////////////////////////// // Threshold -CV_ENUM(ThreshOp, cv::THRESH_BINARY, cv::THRESH_BINARY_INV, cv::THRESH_TRUNC, cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV) -#define ALL_THRESH_OPS ValuesIn(ThreshOp::all()) +CV_ENUM(ThreshOp, THRESH_BINARY, THRESH_BINARY_INV, THRESH_TRUNC, THRESH_TOZERO, THRESH_TOZERO_INV) DEF_PARAM_TEST(Sz_Depth_Op, cv::Size, MatDepth, ThreshOp); PERF_TEST_P(Sz_Depth_Op, ImgProc_Threshold, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F, CV_64F), - ALL_THRESH_OPS)) + ThreshOp::all())) { const cv::Size size = GET_PARAM(0); const int depth = GET_PARAM(1); @@ -894,8 +892,7 @@ PERF_TEST_P(Sz_KernelSz_Ccorr, ImgProc_Convolve, //////////////////////////////////////////////////////////////////////////////// // MatchTemplate8U -CV_ENUM(TemplateMethod, cv::TM_SQDIFF, cv::TM_SQDIFF_NORMED, cv::TM_CCORR, cv::TM_CCORR_NORMED, cv::TM_CCOEFF, cv::TM_CCOEFF_NORMED) -#define ALL_TEMPLATE_METHODS ValuesIn(TemplateMethod::all()) +CV_ENUM(TemplateMethod, TM_SQDIFF, TM_SQDIFF_NORMED, TM_CCORR, TM_CCORR_NORMED, TM_CCOEFF, TM_CCOEFF_NORMED) DEF_PARAM_TEST(Sz_TemplateSz_Cn_Method, cv::Size, cv::Size, MatCn, TemplateMethod); @@ -903,7 +900,7 @@ PERF_TEST_P(Sz_TemplateSz_Cn_Method, ImgProc_MatchTemplate8U, Combine(GPU_TYPICAL_MAT_SIZES, Values(cv::Size(5, 5), cv::Size(16, 16), cv::Size(30, 30)), GPU_CHANNELS_1_3_4, - ALL_TEMPLATE_METHODS)) + TemplateMethod::all())) { declare.time(300.0); @@ -979,7 +976,7 @@ PERF_TEST_P(Sz_TemplateSz_Cn_Method, ImgProc_MatchTemplate32F, ////////////////////////////////////////////////////////////////////// // MulSpectrums -CV_FLAGS(DftFlags, 0, cv::DFT_INVERSE, cv::DFT_SCALE, cv::DFT_ROWS, cv::DFT_COMPLEX_OUTPUT, cv::DFT_REAL_OUTPUT) +CV_FLAGS(DftFlags, 0, DFT_INVERSE, DFT_SCALE, DFT_ROWS, DFT_COMPLEX_OUTPUT, DFT_REAL_OUTPUT) DEF_PARAM_TEST(Sz_Flags, cv::Size, DftFlags); @@ -1454,16 +1451,16 @@ PERF_TEST_P(Sz_Depth_Code, ImgProc_CvtColorBayer, } CV_ENUM(DemosaicingCode, - cv::COLOR_BayerBG2BGR, cv::COLOR_BayerGB2BGR, cv::COLOR_BayerRG2BGR, cv::COLOR_BayerGR2BGR, - cv::COLOR_BayerBG2GRAY, cv::COLOR_BayerGB2GRAY, cv::COLOR_BayerRG2GRAY, cv::COLOR_BayerGR2GRAY, - cv::gpu::COLOR_BayerBG2BGR_MHT, cv::gpu::COLOR_BayerGB2BGR_MHT, cv::gpu::COLOR_BayerRG2BGR_MHT, cv::gpu::COLOR_BayerGR2BGR_MHT, - cv::gpu::COLOR_BayerBG2GRAY_MHT, cv::gpu::COLOR_BayerGB2GRAY_MHT, cv::gpu::COLOR_BayerRG2GRAY_MHT, cv::gpu::COLOR_BayerGR2GRAY_MHT) + COLOR_BayerBG2BGR, COLOR_BayerGB2BGR, COLOR_BayerRG2BGR, COLOR_BayerGR2BGR, + COLOR_BayerBG2GRAY, COLOR_BayerGB2GRAY, COLOR_BayerRG2GRAY, COLOR_BayerGR2GRAY, + COLOR_BayerBG2BGR_MHT, COLOR_BayerGB2BGR_MHT, COLOR_BayerRG2BGR_MHT, COLOR_BayerGR2BGR_MHT, + COLOR_BayerBG2GRAY_MHT, COLOR_BayerGB2GRAY_MHT, COLOR_BayerRG2GRAY_MHT, COLOR_BayerGR2GRAY_MHT) DEF_PARAM_TEST(Sz_Code, cv::Size, DemosaicingCode); PERF_TEST_P(Sz_Code, ImgProc_Demosaicing, Combine(GPU_TYPICAL_MAT_SIZES, - ValuesIn(DemosaicingCode::all()))) + DemosaicingCode::all())) { const cv::Size size = GET_PARAM(0); const int code = GET_PARAM(1); @@ -1527,15 +1524,14 @@ PERF_TEST_P(Sz, ImgProc_SwapChannels, ////////////////////////////////////////////////////////////////////// // AlphaComp -CV_ENUM(AlphaOp, cv::gpu::ALPHA_OVER, cv::gpu::ALPHA_IN, cv::gpu::ALPHA_OUT, cv::gpu::ALPHA_ATOP, cv::gpu::ALPHA_XOR, cv::gpu::ALPHA_PLUS, cv::gpu::ALPHA_OVER_PREMUL, cv::gpu::ALPHA_IN_PREMUL, cv::gpu::ALPHA_OUT_PREMUL, cv::gpu::ALPHA_ATOP_PREMUL, cv::gpu::ALPHA_XOR_PREMUL, cv::gpu::ALPHA_PLUS_PREMUL, cv::gpu::ALPHA_PREMUL) -#define ALL_ALPHA_OPS ValuesIn(AlphaOp::all()) +CV_ENUM(AlphaOp, ALPHA_OVER, ALPHA_IN, ALPHA_OUT, ALPHA_ATOP, ALPHA_XOR, ALPHA_PLUS, ALPHA_OVER_PREMUL, ALPHA_IN_PREMUL, ALPHA_OUT_PREMUL, ALPHA_ATOP_PREMUL, ALPHA_XOR_PREMUL, ALPHA_PLUS_PREMUL, ALPHA_PREMUL) DEF_PARAM_TEST(Sz_Type_Op, cv::Size, MatType, AlphaOp); PERF_TEST_P(Sz_Type_Op, ImgProc_AlphaComp, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC4, CV_16UC4, CV_32SC4, CV_32FC4), - ALL_ALPHA_OPS)) + AlphaOp::all())) { const cv::Size size = GET_PARAM(0); const int type = GET_PARAM(1); @@ -1815,7 +1811,7 @@ PERF_TEST_P(Sz_Dp_MinDist, ImgProc_HoughCircles, ////////////////////////////////////////////////////////////////////// // GeneralizedHough -CV_FLAGS(GHMethod, cv::GHT_POSITION, cv::GHT_SCALE, cv::GHT_ROTATION); +CV_FLAGS(GHMethod, GHT_POSITION, GHT_SCALE, GHT_ROTATION); DEF_PARAM_TEST(Method_Sz, GHMethod, cv::Size); diff --git a/modules/gpu/test/test_core.cpp b/modules/gpu/test/test_core.cpp index d02c3c2..1bc952c 100644 --- a/modules/gpu/test/test_core.cpp +++ b/modules/gpu/test/test_core.cpp @@ -1613,8 +1613,7 @@ INSTANTIATE_TEST_CASE_P(GPU_Core, Exp, testing::Combine( //////////////////////////////////////////////////////////////////////////////// // Compare_Array -CV_ENUM(CmpCode, cv::CMP_EQ, cv::CMP_GT, cv::CMP_GE, cv::CMP_LT, cv::CMP_LE, cv::CMP_NE) -#define ALL_CMP_CODES testing::Values(CmpCode(cv::CMP_EQ), CmpCode(cv::CMP_NE), CmpCode(cv::CMP_GT), CmpCode(cv::CMP_GE), CmpCode(cv::CMP_LT), CmpCode(cv::CMP_LE)) +CV_ENUM(CmpCode, CMP_EQ, CMP_NE, CMP_GT, CMP_GE, CMP_LT, CMP_LE) PARAM_TEST_CASE(Compare_Array, cv::gpu::DeviceInfo, cv::Size, MatDepth, CmpCode, UseRoi) { @@ -1669,7 +1668,7 @@ INSTANTIATE_TEST_CASE_P(GPU_Core, Compare_Array, testing::Combine( ALL_DEVICES, DIFFERENT_SIZES, ALL_DEPTH, - ALL_CMP_CODES, + CmpCode::all(), WHOLE_SUBMAT)); //////////////////////////////////////////////////////////////////////////////// @@ -1780,7 +1779,7 @@ INSTANTIATE_TEST_CASE_P(GPU_Core, Compare_Scalar, testing::Combine( ALL_DEVICES, DIFFERENT_SIZES, TYPES(CV_8U, CV_64F, 1, 4), - ALL_CMP_CODES, + CmpCode::all(), WHOLE_SUBMAT)); ////////////////////////////////////////////////////////////////////////////// @@ -2371,7 +2370,7 @@ INSTANTIATE_TEST_CASE_P(GPU_Core, AddWeighted, testing::Combine( #ifdef HAVE_CUBLAS -CV_FLAGS(GemmFlags, 0, cv::GEMM_1_T, cv::GEMM_2_T, cv::GEMM_3_T); +CV_FLAGS(GemmFlags, 0, GEMM_1_T, GEMM_2_T, GEMM_3_T); #define ALL_GEMM_FLAGS testing::Values(GemmFlags(0), GemmFlags(cv::GEMM_1_T), GemmFlags(cv::GEMM_2_T), GemmFlags(cv::GEMM_3_T), GemmFlags(cv::GEMM_1_T | cv::GEMM_2_T), GemmFlags(cv::GEMM_1_T | cv::GEMM_3_T), GemmFlags(cv::GEMM_1_T | cv::GEMM_2_T | cv::GEMM_3_T)) PARAM_TEST_CASE(GEMM, cv::gpu::DeviceInfo, cv::Size, MatType, GemmFlags, UseRoi) diff --git a/modules/gpu/test/test_features2d.cpp b/modules/gpu/test/test_features2d.cpp index a7d80f9..dfa3afa 100644 --- a/modules/gpu/test/test_features2d.cpp +++ b/modules/gpu/test/test_features2d.cpp @@ -123,7 +123,7 @@ namespace IMPLEMENT_PARAM_CLASS(ORB_BlurForDescriptor, bool) } -CV_ENUM(ORB_ScoreType, cv::ORB::HARRIS_SCORE, cv::ORB::FAST_SCORE) +CV_ENUM(ORB_ScoreType, ORB::HARRIS_SCORE, ORB::FAST_SCORE) PARAM_TEST_CASE(ORB, cv::gpu::DeviceInfo, ORB_FeaturesCount, ORB_ScaleFactor, ORB_LevelsCount, ORB_EdgeThreshold, ORB_firstLevel, ORB_WTA_K, ORB_ScoreType, ORB_PatchSize, ORB_BlurForDescriptor) { diff --git a/modules/gpu/test/test_filters.cpp b/modules/gpu/test/test_filters.cpp index f1fd381..cbb6db8 100644 --- a/modules/gpu/test/test_filters.cpp +++ b/modules/gpu/test/test_filters.cpp @@ -471,8 +471,7 @@ INSTANTIATE_TEST_CASE_P(GPU_Filter, Dilate, testing::Combine( ///////////////////////////////////////////////////////////////////////////////////////////////// // MorphEx -CV_ENUM(MorphOp, cv::MORPH_OPEN, cv::MORPH_CLOSE, cv::MORPH_GRADIENT, cv::MORPH_TOPHAT, cv::MORPH_BLACKHAT) -#define ALL_MORPH_OPS testing::Values(MorphOp(cv::MORPH_OPEN), MorphOp(cv::MORPH_CLOSE), MorphOp(cv::MORPH_GRADIENT), MorphOp(cv::MORPH_TOPHAT), MorphOp(cv::MORPH_BLACKHAT)) +CV_ENUM(MorphOp, MORPH_OPEN, MORPH_CLOSE, MORPH_GRADIENT, MORPH_TOPHAT, MORPH_BLACKHAT) PARAM_TEST_CASE(MorphEx, cv::gpu::DeviceInfo, cv::Size, MatType, MorphOp, Anchor, Iterations, UseRoi) { @@ -518,7 +517,7 @@ INSTANTIATE_TEST_CASE_P(GPU_Filter, MorphEx, testing::Combine( ALL_DEVICES, DIFFERENT_SIZES, testing::Values(MatType(CV_8UC1), MatType(CV_8UC4)), - ALL_MORPH_OPS, + MorphOp::all(), testing::Values(Anchor(cv::Point(-1, -1)), Anchor(cv::Point(0, 0)), Anchor(cv::Point(2, 2))), testing::Values(Iterations(1), Iterations(2), Iterations(3)), WHOLE_SUBMAT)); diff --git a/modules/gpu/test/test_imgproc.cpp b/modules/gpu/test/test_imgproc.cpp index 925ca9d..e424763 100644 --- a/modules/gpu/test/test_imgproc.cpp +++ b/modules/gpu/test/test_imgproc.cpp @@ -663,8 +663,7 @@ INSTANTIATE_TEST_CASE_P(GPU_ImgProc, Convolve, testing::Combine( //////////////////////////////////////////////////////////////////////////////// // MatchTemplate8U -CV_ENUM(TemplateMethod, cv::TM_SQDIFF, cv::TM_SQDIFF_NORMED, cv::TM_CCORR, cv::TM_CCORR_NORMED, cv::TM_CCOEFF, cv::TM_CCOEFF_NORMED) -#define ALL_TEMPLATE_METHODS testing::Values(TemplateMethod(cv::TM_SQDIFF), TemplateMethod(cv::TM_SQDIFF_NORMED), TemplateMethod(cv::TM_CCORR), TemplateMethod(cv::TM_CCORR_NORMED), TemplateMethod(cv::TM_CCOEFF), TemplateMethod(cv::TM_CCOEFF_NORMED)) +CV_ENUM(TemplateMethod, TM_SQDIFF, TM_SQDIFF_NORMED, TM_CCORR, TM_CCORR_NORMED, TM_CCOEFF, TM_CCOEFF_NORMED) namespace { @@ -710,7 +709,7 @@ INSTANTIATE_TEST_CASE_P(GPU_ImgProc, MatchTemplate8U, testing::Combine( DIFFERENT_SIZES, testing::Values(TemplateSize(cv::Size(5, 5)), TemplateSize(cv::Size(16, 16)), TemplateSize(cv::Size(30, 30))), testing::Values(Channels(1), Channels(3), Channels(4)), - ALL_TEMPLATE_METHODS)); + TemplateMethod::all())); //////////////////////////////////////////////////////////////////////////////// // MatchTemplate32F @@ -919,7 +918,7 @@ INSTANTIATE_TEST_CASE_P(GPU_ImgProc, MatchTemplate_CanFindBigTemplate, ALL_DEVIC //////////////////////////////////////////////////////////////////////////// // MulSpectrums -CV_FLAGS(DftFlags, 0, cv::DFT_INVERSE, cv::DFT_SCALE, cv::DFT_ROWS, cv::DFT_COMPLEX_OUTPUT, cv::DFT_REAL_OUTPUT) +CV_FLAGS(DftFlags, 0, DFT_INVERSE, DFT_SCALE, DFT_ROWS, DFT_COMPLEX_OUTPUT, DFT_REAL_OUTPUT) PARAM_TEST_CASE(MulSpectrums, cv::gpu::DeviceInfo, cv::Size, DftFlags) { diff --git a/modules/gpu/test/test_optflow.cpp b/modules/gpu/test/test_optflow.cpp index 595e46c..9e30b92 100644 --- a/modules/gpu/test/test_optflow.cpp +++ b/modules/gpu/test/test_optflow.cpp @@ -333,7 +333,7 @@ namespace { IMPLEMENT_PARAM_CLASS(PyrScale, double) IMPLEMENT_PARAM_CLASS(PolyN, int) - CV_FLAGS(FarnebackOptFlowFlags, 0, cv::OPTFLOW_FARNEBACK_GAUSSIAN) + CV_FLAGS(FarnebackOptFlowFlags, 0, OPTFLOW_FARNEBACK_GAUSSIAN) IMPLEMENT_PARAM_CLASS(UseInitFlow, bool) } diff --git a/modules/gpu/test/test_threshold.cpp b/modules/gpu/test/test_threshold.cpp index 25a7a47..52ebd7f 100644 --- a/modules/gpu/test/test_threshold.cpp +++ b/modules/gpu/test/test_threshold.cpp @@ -46,8 +46,7 @@ using namespace cvtest; -CV_ENUM(ThreshOp, cv::THRESH_BINARY, cv::THRESH_BINARY_INV, cv::THRESH_TRUNC, cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV) -#define ALL_THRESH_OPS testing::Values(ThreshOp(cv::THRESH_BINARY), ThreshOp(cv::THRESH_BINARY_INV), ThreshOp(cv::THRESH_TRUNC), ThreshOp(cv::THRESH_TOZERO), ThreshOp(cv::THRESH_TOZERO_INV)) +CV_ENUM(ThreshOp, THRESH_BINARY, THRESH_BINARY_INV, THRESH_TRUNC, THRESH_TOZERO, THRESH_TOZERO_INV) PARAM_TEST_CASE(Threshold, cv::gpu::DeviceInfo, cv::Size, MatType, ThreshOp, UseRoi) { @@ -88,7 +87,7 @@ INSTANTIATE_TEST_CASE_P(GPU_ImgProc, Threshold, testing::Combine( ALL_DEVICES, DIFFERENT_SIZES, testing::Values(MatType(CV_8UC1), MatType(CV_16SC1), MatType(CV_32FC1)), - ALL_THRESH_OPS, + ThreshOp::all(), WHOLE_SUBMAT)); #endif // HAVE_CUDA diff --git a/modules/imgproc/perf/perf_bilateral.cpp b/modules/imgproc/perf/perf_bilateral.cpp index d6d9a63..af565f8 100644 --- a/modules/imgproc/perf/perf_bilateral.cpp +++ b/modules/imgproc/perf/perf_bilateral.cpp @@ -15,7 +15,7 @@ PERF_TEST_P( TestBilateralFilter, BilateralFilter, Combine( Values( szVGA, sz1080p ), // image size Values( 3, 5 ), // d - ValuesIn( Mat_Type::all() ) // image type + Mat_Type::all() // image type ) ) { diff --git a/modules/imgproc/perf/perf_blur.cpp b/modules/imgproc/perf/perf_blur.cpp index 6604608..d04479b 100644 --- a/modules/imgproc/perf/perf_blur.cpp +++ b/modules/imgproc/perf/perf_blur.cpp @@ -48,7 +48,7 @@ PERF_TEST_P(Size_MatType_BorderType3x3, gaussianBlur3x3, testing::Combine( testing::Values(szODD, szQVGA, szVGA, sz720p), testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_16SC1, CV_32FC1), - testing::ValuesIn(BorderType3x3::all()) + BorderType3x3::all() ) ) { @@ -70,7 +70,7 @@ PERF_TEST_P(Size_MatType_BorderType3x3, blur3x3, testing::Combine( testing::Values(szODD, szQVGA, szVGA, sz720p), testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_16SC1, CV_32FC1), - testing::ValuesIn(BorderType3x3::all()) + BorderType3x3::all() ) ) { @@ -92,7 +92,7 @@ PERF_TEST_P(Size_MatType_BorderType, blur16x16, testing::Combine( testing::Values(szVGA, sz720p), testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_16SC1, CV_32FC1), - testing::ValuesIn(BorderType::all()) + BorderType::all() ) ) { @@ -114,7 +114,7 @@ PERF_TEST_P(Size_MatType_BorderType3x3, box3x3, testing::Combine( testing::Values(szODD, szQVGA, szVGA, sz720p), testing::Values(CV_8UC1, CV_16SC1, CV_32SC1, CV_32FC1, CV_32FC3), - testing::ValuesIn(BorderType3x3::all()) + BorderType3x3::all() ) ) { @@ -136,7 +136,7 @@ PERF_TEST_P(Size_MatType_BorderType3x3, box3x3_inplace, testing::Combine( testing::Values(szODD, szQVGA, szVGA, sz720p), testing::Values(CV_8UC1, CV_16SC1, CV_32SC1, CV_32FC1, CV_32FC3), - testing::ValuesIn(BorderType3x3::all()) + BorderType3x3::all() ) ) { @@ -164,7 +164,7 @@ PERF_TEST_P(Size_MatType_BorderType, gaussianBlur5x5, testing::Combine( testing::Values(szODD, szQVGA, szVGA, sz720p), testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_16SC1, CV_32FC1), - testing::ValuesIn(BorderType::all()) + BorderType::all() ) ) { @@ -186,7 +186,7 @@ PERF_TEST_P(Size_MatType_BorderType, blur5x5, testing::Combine( testing::Values(szVGA, sz720p), testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_16SC1, CV_32FC1, CV_32FC3), - testing::ValuesIn(BorderType::all()) + BorderType::all() ) ) { diff --git a/modules/imgproc/perf/perf_cornerEigenValsAndVecs.cpp b/modules/imgproc/perf/perf_cornerEigenValsAndVecs.cpp index 29fd3eb..1b176ed 100644 --- a/modules/imgproc/perf/perf_cornerEigenValsAndVecs.cpp +++ b/modules/imgproc/perf/perf_cornerEigenValsAndVecs.cpp @@ -16,7 +16,7 @@ PERF_TEST_P(Img_BlockSize_ApertureSize_BorderType, cornerEigenValsAndVecs, testing::Values( "stitching/a1.png", "cv/shared/pic5.png"), testing::Values( 3, 5 ), testing::Values( 3, 5 ), - testing::ValuesIn(BorderType::all()) + BorderType::all() ) ) { diff --git a/modules/imgproc/perf/perf_cornerHarris.cpp b/modules/imgproc/perf/perf_cornerHarris.cpp index 8d6beb8..10ed8de 100644 --- a/modules/imgproc/perf/perf_cornerHarris.cpp +++ b/modules/imgproc/perf/perf_cornerHarris.cpp @@ -17,7 +17,7 @@ PERF_TEST_P(Img_BlockSize_ApertureSize_k_BorderType, cornerHarris, testing::Values( 3, 5 ), testing::Values( 3, 5 ), testing::Values( 0.04, 0.1 ), - testing::ValuesIn(BorderType::all()) + BorderType::all() ) ) { diff --git a/modules/imgproc/perf/perf_cvt_color.cpp b/modules/imgproc/perf/perf_cvt_color.cpp index 446212e..9b87afe 100644 --- a/modules/imgproc/perf/perf_cvt_color.cpp +++ b/modules/imgproc/perf/perf_cvt_color.cpp @@ -243,7 +243,7 @@ typedef perf::TestBaseWithParam Size_CvtMode; PERF_TEST_P(Size_CvtMode, cvtColor8u, testing::Combine( testing::Values(::perf::szODD, ::perf::szVGA, ::perf::sz1080p), - testing::ValuesIn(CvtMode::all()) + CvtMode::all() ) ) { @@ -269,7 +269,7 @@ typedef perf::TestBaseWithParam Size_CvtMode_Bayer; PERF_TEST_P(Size_CvtMode_Bayer, cvtColorBayer8u, testing::Combine( testing::Values(::perf::szODD, ::perf::szVGA), - testing::ValuesIn(CvtModeBayer::all()) + CvtModeBayer::all() ) ) { @@ -295,7 +295,7 @@ typedef perf::TestBaseWithParam Size_CvtMode2; PERF_TEST_P(Size_CvtMode2, cvtColorYUV420, testing::Combine( testing::Values(szVGA, sz1080p, Size(130, 60)), - testing::ValuesIn(CvtMode2::all()) + CvtMode2::all() ) ) { @@ -320,7 +320,7 @@ typedef perf::TestBaseWithParam Size_CvtMode3; PERF_TEST_P(Size_CvtMode3, cvtColorRGB2YUV420p, testing::Combine( testing::Values(szVGA, sz720p, sz1080p, Size(130, 60)), - testing::ValuesIn(CvtMode3::all()) + CvtMode3::all() ) ) { diff --git a/modules/imgproc/perf/perf_filter2d.cpp b/modules/imgproc/perf/perf_filter2d.cpp index 297b524..1498ffd 100644 --- a/modules/imgproc/perf/perf_filter2d.cpp +++ b/modules/imgproc/perf/perf_filter2d.cpp @@ -17,7 +17,7 @@ PERF_TEST_P( TestFilter2d, Filter2d, Combine( Values( Size(320, 240), sz1080p ), Values( 3, 5 ), - ValuesIn( BorderMode::all() ) + BorderMode::all() ) ) { diff --git a/modules/imgproc/perf/perf_matchTemplate.cpp b/modules/imgproc/perf/perf_matchTemplate.cpp index a89435b..29a3d8d 100644 --- a/modules/imgproc/perf/perf_matchTemplate.cpp +++ b/modules/imgproc/perf/perf_matchTemplate.cpp @@ -18,7 +18,7 @@ PERF_TEST_P(ImgSize_TmplSize_Method, matchTemplateSmall, cv::Size(1024, 768), cv::Size(1280, 1024)), testing::Values(cv::Size(12, 12), cv::Size(28, 9), cv::Size(8, 30), cv::Size(16, 16)), - testing::ValuesIn(MethodType::all()) + MethodType::all() ) ) { @@ -52,7 +52,7 @@ PERF_TEST_P(ImgSize_TmplSize_Method, matchTemplateBig, testing::Combine( testing::Values(cv::Size(1280, 1024)), testing::Values(cv::Size(1260, 1000), cv::Size(1261, 1013)), - testing::ValuesIn(MethodType::all()) + MethodType::all() ) ) { diff --git a/modules/imgproc/perf/perf_remap.cpp b/modules/imgproc/perf/perf_remap.cpp index f1c8956..334c5ff 100644 --- a/modules/imgproc/perf/perf_remap.cpp +++ b/modules/imgproc/perf/perf_remap.cpp @@ -16,7 +16,7 @@ PERF_TEST_P( TestRemap, Remap, Values( szVGA, sz1080p ), Values( CV_16UC1, CV_16SC1, CV_32FC1 ), Values( CV_16SC2, CV_32FC1, CV_32FC2 ), - ValuesIn( InterType::all() ) + InterType::all() ) ) { diff --git a/modules/imgproc/perf/perf_sepfilters.cpp b/modules/imgproc/perf/perf_sepfilters.cpp index 9a5bd4e..6147b30 100644 --- a/modules/imgproc/perf/perf_sepfilters.cpp +++ b/modules/imgproc/perf/perf_sepfilters.cpp @@ -34,7 +34,7 @@ PERF_TEST_P(Size_MatType_dx_dy_Border3x3, sobelFilter, testing::Values(FILTER_SRC_SIZES), testing::Values(CV_16S, CV_32F), testing::Values(make_tuple(0, 1), make_tuple(1, 0), make_tuple(1, 1), make_tuple(0, 2), make_tuple(2, 0), make_tuple(2, 2)), - testing::ValuesIn(BorderType3x3::all()) + BorderType3x3::all() ) ) { @@ -59,7 +59,7 @@ PERF_TEST_P(Size_MatType_dx_dy_Border3x3ROI, sobelFilter, testing::Values(FILTER_SRC_SIZES), testing::Values(CV_16S, CV_32F), testing::Values(make_tuple(0, 1), make_tuple(1, 0), make_tuple(1, 1), make_tuple(0, 2), make_tuple(2, 0), make_tuple(2, 2)), - testing::ValuesIn(BorderType3x3ROI::all()) + BorderType3x3ROI::all() ) ) { @@ -87,7 +87,7 @@ PERF_TEST_P(Size_MatType_dx_dy_Border5x5, sobelFilter, testing::Values(FILTER_SRC_SIZES), testing::Values(CV_16S, CV_32F), testing::Values(make_tuple(0, 1), make_tuple(1, 0), make_tuple(1, 1), make_tuple(0, 2), make_tuple(2, 0)), - testing::ValuesIn(BorderType::all()) + BorderType::all() ) ) { @@ -112,7 +112,7 @@ PERF_TEST_P(Size_MatType_dx_dy_Border5x5ROI, sobelFilter, testing::Values(FILTER_SRC_SIZES), testing::Values(CV_16S, CV_32F), testing::Values(make_tuple(0, 1), make_tuple(1, 0), make_tuple(1, 1), make_tuple(0, 2), make_tuple(2, 0)), - testing::ValuesIn(BorderTypeROI::all()) + BorderTypeROI::all() ) ) { @@ -142,7 +142,7 @@ PERF_TEST_P(Size_MatType_dx_dy_Border3x3, scharrFilter, testing::Values(FILTER_SRC_SIZES), testing::Values(CV_16S, CV_32F), testing::Values(make_tuple(0, 1), make_tuple(1, 0)), - testing::ValuesIn(BorderType3x3::all()) + BorderType3x3::all() ) ) { @@ -167,7 +167,7 @@ PERF_TEST_P(Size_MatType_dx_dy_Border3x3ROI, scharrFilter, testing::Values(FILTER_SRC_SIZES), testing::Values(CV_16S, CV_32F), testing::Values(make_tuple(0, 1), make_tuple(1, 0)), - testing::ValuesIn(BorderType3x3ROI::all()) + BorderType3x3ROI::all() ) ) { @@ -195,7 +195,7 @@ PERF_TEST_P(Size_MatType_dx_dy_Border3x3, scharrViaSobelFilter, testing::Values(FILTER_SRC_SIZES), testing::Values(CV_16S, CV_32F), testing::Values(make_tuple(0, 1), make_tuple(1, 0)), - testing::ValuesIn(BorderType3x3::all()) + BorderType3x3::all() ) ) { @@ -220,7 +220,7 @@ PERF_TEST_P(Size_MatType_dx_dy_Border3x3ROI, scharrViaSobelFilter, testing::Values(FILTER_SRC_SIZES), testing::Values(CV_16S, CV_32F), testing::Values(make_tuple(0, 1), make_tuple(1, 0)), - testing::ValuesIn(BorderType3x3ROI::all()) + BorderType3x3ROI::all() ) ) { diff --git a/modules/imgproc/perf/perf_threshold.cpp b/modules/imgproc/perf/perf_threshold.cpp index 8727b63..61255e2 100644 --- a/modules/imgproc/perf/perf_threshold.cpp +++ b/modules/imgproc/perf/perf_threshold.cpp @@ -15,7 +15,7 @@ PERF_TEST_P(Size_MatType_ThreshType, threshold, testing::Combine( testing::Values(TYPICAL_MAT_SIZES), testing::Values(CV_8UC1, CV_16SC1), - testing::ValuesIn(ThreshType::all()) + ThreshType::all() ) ) { @@ -65,8 +65,8 @@ typedef perf::TestBaseWithParam InpaintArea_Inpa PERF_TEST_P(InpaintArea_InpaintingMethod, inpaint, testing::Combine( testing::Values(::perf::szSmall24, ::perf::szSmall32, ::perf::szSmall64), - testing::ValuesIn(InpaintingMethod::all()) + InpaintingMethod::all() ) ) { diff --git a/modules/ts/include/opencv2/ts/gpu_perf.hpp b/modules/ts/include/opencv2/ts/gpu_perf.hpp index 93caf02..b7b73b7 100644 --- a/modules/ts/include/opencv2/ts/gpu_perf.hpp +++ b/modules/ts/include/opencv2/ts/gpu_perf.hpp @@ -50,16 +50,16 @@ namespace perf { - CV_ENUM(BorderMode, cv::BORDER_REFLECT101, cv::BORDER_REPLICATE, cv::BORDER_CONSTANT, cv::BORDER_REFLECT, cv::BORDER_WRAP) - #define ALL_BORDER_MODES testing::ValuesIn(BorderMode::all()) + #define ALL_BORDER_MODES BorderMode::all() + #define ALL_INTERPOLATIONS Interpolation::all() - CV_ENUM(Interpolation, cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_CUBIC, cv::INTER_AREA) - #define ALL_INTERPOLATIONS testing::ValuesIn(Interpolation::all()) - - CV_ENUM(NormType, cv::NORM_INF, cv::NORM_L1, cv::NORM_L2, cv::NORM_HAMMING, cv::NORM_MINMAX) + CV_ENUM(BorderMode, BORDER_REFLECT101, BORDER_REPLICATE, BORDER_CONSTANT, BORDER_REFLECT, BORDER_WRAP) + CV_ENUM(Interpolation, INTER_NEAREST, INTER_LINEAR, INTER_CUBIC, INTER_AREA) + CV_ENUM(NormType, NORM_INF, NORM_L1, NORM_L2, NORM_HAMMING, NORM_MINMAX) enum { Gray = 1, TwoChannel = 2, BGR = 3, BGRA = 4 }; CV_ENUM(MatCn, Gray, TwoChannel, BGR, BGRA) + #define GPU_CHANNELS_1_3_4 testing::Values(MatCn(Gray), MatCn(BGR), MatCn(BGRA)) #define GPU_CHANNELS_1_3 testing::Values(MatCn(Gray), MatCn(BGR)) diff --git a/modules/ts/include/opencv2/ts/gpu_test.hpp b/modules/ts/include/opencv2/ts/gpu_test.hpp index 7f90825..943a353 100644 --- a/modules/ts/include/opencv2/ts/gpu_test.hpp +++ b/modules/ts/include/opencv2/ts/gpu_test.hpp @@ -313,14 +313,14 @@ namespace cvtest // Flags and enums - CV_ENUM(NormCode, cv::NORM_INF, cv::NORM_L1, cv::NORM_L2, cv::NORM_TYPE_MASK, cv::NORM_RELATIVE, cv::NORM_MINMAX) + CV_ENUM(NormCode, NORM_INF, NORM_L1, NORM_L2, NORM_TYPE_MASK, NORM_RELATIVE, NORM_MINMAX) - CV_ENUM(Interpolation, cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_CUBIC, cv::INTER_AREA) + CV_ENUM(Interpolation, INTER_NEAREST, INTER_LINEAR, INTER_CUBIC, INTER_AREA) - CV_ENUM(BorderType, cv::BORDER_REFLECT101, cv::BORDER_REPLICATE, cv::BORDER_CONSTANT, cv::BORDER_REFLECT, cv::BORDER_WRAP) + CV_ENUM(BorderType, BORDER_REFLECT101, BORDER_REPLICATE, BORDER_CONSTANT, BORDER_REFLECT, BORDER_WRAP) #define ALL_BORDER_TYPES testing::Values(BorderType(cv::BORDER_REFLECT101), BorderType(cv::BORDER_REPLICATE), BorderType(cv::BORDER_CONSTANT), BorderType(cv::BORDER_REFLECT), BorderType(cv::BORDER_WRAP)) - CV_FLAGS(WarpFlags, cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_CUBIC, cv::WARP_INVERSE_MAP) + CV_FLAGS(WarpFlags, INTER_NEAREST, INTER_LINEAR, INTER_CUBIC, WARP_INVERSE_MAP) ////////////////////////////////////////////////////////////////////// // Features2D diff --git a/modules/ts/include/opencv2/ts/ts_perf.hpp b/modules/ts/include/opencv2/ts/ts_perf.hpp index 0af6718..c62d483 100644 --- a/modules/ts/include/opencv2/ts/ts_perf.hpp +++ b/modules/ts/include/opencv2/ts/ts_perf.hpp @@ -2,6 +2,7 @@ #define __OPENCV_TS_PERF_HPP__ #include "opencv2/core/core.hpp" +#include "opencv2/imgproc/imgproc.hpp" #include "opencv2/features2d/features2d.hpp" #include "ts_gtest.h" @@ -26,6 +27,9 @@ # endif #endif +// declare major namespaces to avoid errors on unknown namespace +namespace cv { namespace gpu {} namespace ocl {} } + namespace perf { class TestBase; @@ -92,66 +96,64 @@ private: * CV_ENUM and CV_FLAGS - macro to create printable wrappers for defines and enums * \*****************************************************************************************/ -#define CV_ENUM(class_name, ...) \ -namespace { class CV_EXPORTS class_name {\ -public:\ - class_name(int val = 0) : _val(val) {}\ - operator int() const {return _val;}\ - void PrintTo(std::ostream* os) const {\ - const int vals[] = {__VA_ARGS__};\ - const char* svals = #__VA_ARGS__;\ - for(int i = 0, pos = 0; i < (int)(sizeof(vals)/sizeof(int)); ++i){\ - while(isspace(svals[pos]) || svals[pos] == ',') ++pos;\ - int start = pos;\ - while(!(isspace(svals[pos]) || svals[pos] == ',' || svals[pos] == 0)) ++pos;\ - if (_val == vals[i]) {\ - *os << std::string(svals + start, svals + pos);\ - return;\ - }\ - }\ - *os << "UNKNOWN";\ - }\ - struct Container{\ - typedef class_name value_type;\ - Container(class_name* first, size_t len): _begin(first), _end(first+len){}\ - const class_name* begin() const {return _begin;}\ - const class_name* end() const {return _end;}\ - private: class_name *_begin, *_end;\ - };\ - static Container all(){\ - static int vals[] = {__VA_ARGS__};\ - return Container((class_name*)vals, sizeof(vals)/sizeof(vals[0]));\ - }\ -private: int _val;\ -};\ -inline void PrintTo(const class_name& t, std::ostream* os) { t.PrintTo(os); } } - -#define CV_FLAGS(class_name, ...) \ -class CV_EXPORTS class_name {\ -public:\ - class_name(int val = 0) : _val(val) {}\ - operator int() const {return _val;}\ - void PrintTo(std::ostream* os) const {\ - const int vals[] = {__VA_ARGS__};\ - const char* svals = #__VA_ARGS__;\ - int value = _val;\ - bool first = true;\ - for(int i = 0, pos = 0; i < (int)(sizeof(vals)/sizeof(int)); ++i){\ - while(isspace(svals[pos]) || svals[pos] == ',') ++pos;\ - int start = pos;\ - while(!(isspace(svals[pos]) || svals[pos] == ',' || svals[pos] == 0)) ++pos;\ - if ((value & vals[i]) == vals[i]) {\ - value &= ~vals[i]; \ - if (first) first = false; else *os << "|"; \ - *os << std::string(svals + start, svals + pos);\ - if (!value) return;\ - }\ - }\ - if (first) *os << "UNKNOWN";\ - }\ -private: int _val;\ -};\ -inline void PrintTo(const class_name& t, std::ostream* os) { t.PrintTo(os); } +#define CV_ENUM(class_name, ...) \ + namespace { \ + struct class_name { \ + class_name(int val = 0) : val_(val) {} \ + operator int() const { return val_; } \ + void PrintTo(std::ostream* os) const { \ + using namespace cv;using namespace cv::gpu; using namespace cv::ocl; \ + const int vals[] = { __VA_ARGS__ }; \ + const char* svals = #__VA_ARGS__; \ + for(int i = 0, pos = 0; i < (int)(sizeof(vals)/sizeof(int)); ++i) { \ + while(isspace(svals[pos]) || svals[pos] == ',') ++pos; \ + int start = pos; \ + while(!(isspace(svals[pos]) || svals[pos] == ',' || svals[pos] == 0)) \ + ++pos; \ + if (val_ == vals[i]) { \ + *os << std::string(svals + start, svals + pos); \ + return; \ + } \ + } \ + *os << "UNKNOWN"; \ + } \ + static ::testing::internal::ParamGenerator all() { \ + using namespace cv;using namespace cv::gpu; using namespace cv::ocl; \ + static class_name vals[] = { __VA_ARGS__ }; \ + return ::testing::ValuesIn(vals); \ + } \ + private: int val_; \ + }; \ + inline void PrintTo(const class_name& t, std::ostream* os) { t.PrintTo(os); } } + +#define CV_FLAGS(class_name, ...) \ + namespace { \ + struct class_name { \ + class_name(int val = 0) : val_(val) {} \ + operator int() const { return val_; } \ + void PrintTo(std::ostream* os) const { \ + using namespace cv;using namespace cv::gpu; using namespace cv::ocl; \ + const int vals[] = { __VA_ARGS__ }; \ + const char* svals = #__VA_ARGS__; \ + int value = val_; \ + bool first = true; \ + for(int i = 0, pos = 0; i < (int)(sizeof(vals)/sizeof(int)); ++i) { \ + while(isspace(svals[pos]) || svals[pos] == ',') ++pos; \ + int start = pos; \ + while(!(isspace(svals[pos]) || svals[pos] == ',' || svals[pos] == 0)) \ + ++pos; \ + if ((value & vals[i]) == vals[i]) { \ + value &= ~vals[i]; \ + if (first) first = false; else *os << "|"; \ + *os << std::string(svals + start, svals + pos); \ + if (!value) return; \ + } \ + } \ + if (first) *os << "UNKNOWN"; \ + } \ + private: int val_; \ + }; \ + inline void PrintTo(const class_name& t, std::ostream* os) { t.PrintTo(os); } } CV_ENUM(MatDepth, CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F, CV_USRTYPE1) diff --git a/modules/video/perf/perf_optflowpyrlk.cpp b/modules/video/perf/perf_optflowpyrlk.cpp index d34bd72..12005f8 100644 --- a/modules/video/perf/perf_optflowpyrlk.cpp +++ b/modules/video/perf/perf_optflowpyrlk.cpp @@ -185,7 +185,7 @@ PERF_TEST_P(Path_Win_Deriv_Border_Reuse, OpticalFlowPyrLK_pyr, testing::Combine( testing::Values("cv/optflow/frames/720p_01.png"), testing::Values(7, 11), testing::Bool(), - testing::ValuesIn(PyrBorderMode::all()), + PyrBorderMode::all(), testing::Bool() ) ) -- 2.7.4