From 23699acca083589be9dc3b6e8e5c5d09f654648d Mon Sep 17 00:00:00 2001 From: "marina.kolpakova" Date: Mon, 8 Oct 2012 02:37:22 +0400 Subject: [PATCH] fix for bug 2264 fix compilation OpenCV with cxx11 under Ubuntu with clang and gcc 4.7 --- modules/contrib/src/spinimages.cpp | 3 +++ modules/gpu/perf/perf_calib3d.cpp | 35 ++++++++++++-------------------- modules/ts/include/opencv2/ts/ts_gtest.h | 14 +++++++++++++ 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/modules/contrib/src/spinimages.cpp b/modules/contrib/src/spinimages.cpp index f544fe4..46b22c8 100644 --- a/modules/contrib/src/spinimages.cpp +++ b/modules/contrib/src/spinimages.cpp @@ -85,7 +85,10 @@ namespace }; size_t colors_mum = sizeof(colors)/sizeof(colors[0]); +#if defined __cplusplus && __cplusplus > 199711L +#else template void iota(FwIt first, FwIt last, T value) { while(first != last) *first++ = value++; } +#endif void computeNormals( const Octree& Octree, const vector& centers, vector& normals, vector& mask, float normalRadius, int minNeighbors = 20) diff --git a/modules/gpu/perf/perf_calib3d.cpp b/modules/gpu/perf/perf_calib3d.cpp index 771c828..9293ec0 100644 --- a/modules/gpu/perf/perf_calib3d.cpp +++ b/modules/gpu/perf/perf_calib3d.cpp @@ -8,26 +8,17 @@ namespace { ////////////////////////////////////////////////////////////////////// // StereoBM -typedef pair pair_string; +typedef std::tr1::tuple pair_string; DEF_PARAM_TEST_1(ImagePair, pair_string); -static pair_string make_string_pair(const string& a, const string& b) -{ -#ifdef _MSC_VER - return pair(a, b); -#else - return make_pair(a, b); -#endif -} - -PERF_TEST_P(ImagePair, Calib3D_StereoBM, Values(make_string_pair("gpu/perf/aloe.png", "gpu/perf/aloeR.png"))) +PERF_TEST_P(ImagePair, Calib3D_StereoBM, Values(pair_string("gpu/perf/aloe.png", "gpu/perf/aloeR.png"))) { declare.time(5.0); - const cv::Mat imgLeft = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); + const cv::Mat imgLeft = readImage(GET_PARAM(0), cv::IMREAD_GRAYSCALE); ASSERT_FALSE(imgLeft.empty()); - const cv::Mat imgRight = readImage(GetParam().second, cv::IMREAD_GRAYSCALE); + const cv::Mat imgRight = readImage(GET_PARAM(1), cv::IMREAD_GRAYSCALE); ASSERT_FALSE(imgRight.empty()); const int preset = 0; @@ -66,14 +57,14 @@ PERF_TEST_P(ImagePair, Calib3D_StereoBM, Values(make_string_pair("gpu/perf/aloe. ////////////////////////////////////////////////////////////////////// // StereoBeliefPropagation -PERF_TEST_P(ImagePair, Calib3D_StereoBeliefPropagation, Values(make_string_pair("gpu/stereobp/aloe-L.png", "gpu/stereobp/aloe-R.png"))) +PERF_TEST_P(ImagePair, Calib3D_StereoBeliefPropagation, Values(pair_string("gpu/stereobp/aloe-L.png", "gpu/stereobp/aloe-R.png"))) { declare.time(10.0); - const cv::Mat imgLeft = readImage(GetParam().first); + const cv::Mat imgLeft = readImage(GET_PARAM(0)); ASSERT_FALSE(imgLeft.empty()); - const cv::Mat imgRight = readImage(GetParam().second); + const cv::Mat imgRight = readImage(GET_PARAM(1)); ASSERT_FALSE(imgRight.empty()); const int ndisp = 64; @@ -102,14 +93,14 @@ PERF_TEST_P(ImagePair, Calib3D_StereoBeliefPropagation, Values(make_string_pair( ////////////////////////////////////////////////////////////////////// // StereoConstantSpaceBP -PERF_TEST_P(ImagePair, Calib3D_StereoConstantSpaceBP, Values(make_string_pair("gpu/stereobm/aloe-L.png", "gpu/stereobm/aloe-R.png"))) +PERF_TEST_P(ImagePair, Calib3D_StereoConstantSpaceBP, Values(pair_string("gpu/stereobm/aloe-L.png", "gpu/stereobm/aloe-R.png"))) { declare.time(10.0); - const cv::Mat imgLeft = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); + const cv::Mat imgLeft = readImage(GET_PARAM(0), cv::IMREAD_GRAYSCALE); ASSERT_FALSE(imgLeft.empty()); - const cv::Mat imgRight = readImage(GetParam().second, cv::IMREAD_GRAYSCALE); + const cv::Mat imgRight = readImage(GET_PARAM(1), cv::IMREAD_GRAYSCALE); ASSERT_FALSE(imgRight.empty()); const int ndisp = 128; @@ -138,12 +129,12 @@ PERF_TEST_P(ImagePair, Calib3D_StereoConstantSpaceBP, Values(make_string_pair("g ////////////////////////////////////////////////////////////////////// // DisparityBilateralFilter -PERF_TEST_P(ImagePair, Calib3D_DisparityBilateralFilter, Values(make_string_pair("gpu/stereobm/aloe-L.png", "gpu/stereobm/aloe-disp.png"))) +PERF_TEST_P(ImagePair, Calib3D_DisparityBilateralFilter, Values(pair_string("gpu/stereobm/aloe-L.png", "gpu/stereobm/aloe-disp.png"))) { - const cv::Mat img = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); + const cv::Mat img = readImage(GET_PARAM(0), cv::IMREAD_GRAYSCALE); ASSERT_FALSE(img.empty()); - const cv::Mat disp = readImage(GetParam().second, cv::IMREAD_GRAYSCALE); + const cv::Mat disp = readImage(GET_PARAM(1), cv::IMREAD_GRAYSCALE); ASSERT_FALSE(disp.empty()); const int ndisp = 128; diff --git a/modules/ts/include/opencv2/ts/ts_gtest.h b/modules/ts/include/opencv2/ts/ts_gtest.h index f98f71b..42eb608 100644 --- a/modules/ts/include/opencv2/ts/ts_gtest.h +++ b/modules/ts/include/opencv2/ts/ts_gtest.h @@ -1654,7 +1654,21 @@ inline bool operator!=(const GTEST_10_TUPLE_(T)& t, # undef _TR1_FUNCTIONAL // Allows the user to #include // if he chooses to. # else +# if defined (__cplusplus) && __cplusplus > 199711L +# include +namespace std { + namespace tr1 { + using std::tuple; + using std::tuple_element; + using std::get; + using std::tuple_size; + using std::make_tuple; + } +} +# else # include // NOLINT +# endif + # endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 # else -- 2.7.4