diff --git a/modules/calib3d/test/test_affine3d_estimator.cpp b/modules/calib3d/test/test_affine3d_estimator.cpp index 403a74d105..9c3821bbc4 100644 --- a/modules/calib3d/test/test_affine3d_estimator.cpp +++ b/modules/calib3d/test/test_affine3d_estimator.cpp @@ -138,8 +138,13 @@ bool CV_Affine3D_EstTest::testNPoints() std::transform(fpts.ptr(), fpts.ptr() + n, tpts.ptr(), WrapAff(aff)); /* adding noise*/ +#ifdef CV_CXX11 + std::transform(tpts.ptr() + m, tpts.ptr() + n, tpts.ptr() + m, + [=] (const Point3f& pt) -> Point3f { return Noise(noise_level)(pt + shift_outl); }); +#else std::transform(tpts.ptr() + m, tpts.ptr() + n, tpts.ptr() + m, std::bind2nd(std::plus(), shift_outl)); std::transform(tpts.ptr() + m, tpts.ptr() + n, tpts.ptr() + m, Noise(noise_level)); +#endif Mat aff_est; vector outl; diff --git a/modules/core/include/opencv2/core/cuda/functional.hpp b/modules/core/include/opencv2/core/cuda/functional.hpp index 5b8a7eb0ab..b28f7a5e0e 100644 --- a/modules/core/include/opencv2/core/cuda/functional.hpp +++ b/modules/core/include/opencv2/core/cuda/functional.hpp @@ -58,8 +58,22 @@ namespace cv { namespace cuda { namespace device { // Function Objects +#ifdef CV_CXX11 + template struct unary_function + { + typedef Argument argument_type; + typedef Result result_type; + }; + template struct binary_function + { + typedef Argument1 first_argument_type; + typedef Argument2 second_argument_type; + typedef Result result_type; + }; +#else template struct unary_function : public std::unary_function {}; template struct binary_function : public std::binary_function {}; +#endif // Arithmetic Operations template struct plus : binary_function diff --git a/modules/cudafeatures2d/src/brute_force_matcher.cpp b/modules/cudafeatures2d/src/brute_force_matcher.cpp index a00537c8eb..5287546bbe 100644 --- a/modules/cudafeatures2d/src/brute_force_matcher.cpp +++ b/modules/cudafeatures2d/src/brute_force_matcher.cpp @@ -564,7 +564,12 @@ namespace if (compactResult) { +#ifdef CV_CXX11 + std::vector< std::vector >::iterator new_end = std::remove_if(matches.begin(), matches.end(), + [](const std::vector& e)->bool { return e.empty(); }); +#else std::vector< std::vector >::iterator new_end = std::remove_if(matches.begin(), matches.end(), std::mem_fun_ref(&std::vector::empty)); +#endif matches.erase(new_end, matches.end()); } } diff --git a/modules/imgproc/src/featureselect.cpp b/modules/imgproc/src/featureselect.cpp index de9b93c3fb..95b44b3742 100644 --- a/modules/imgproc/src/featureselect.cpp +++ b/modules/imgproc/src/featureselect.cpp @@ -52,8 +52,11 @@ namespace cv { -struct greaterThanPtr : - public std::binary_function +#ifdef CV_CXX11 +struct greaterThanPtr +#else +struct greaterThanPtr : public std::binary_function +#endif { bool operator () (const float * a, const float * b) const // Ensure a fully deterministic result of the sort diff --git a/modules/imgproc/src/generalized_hough.cpp b/modules/imgproc/src/generalized_hough.cpp index 2d0b5bf530..4bdcaed719 100644 --- a/modules/imgproc/src/generalized_hough.cpp +++ b/modules/imgproc/src/generalized_hough.cpp @@ -385,7 +385,11 @@ namespace const double thetaScale = levels_ / 360.0; r_table_.resize(levels_ + 1); +#ifdef CV_CXX11 + std::for_each(r_table_.begin(), r_table_.end(), [](std::vector& e)->void { e.clear(); }); +#else std::for_each(r_table_.begin(), r_table_.end(), std::mem_fun_ref(&std::vector::clear)); +#endif for (int y = 0; y < templSize_.height; ++y) { @@ -692,8 +696,12 @@ namespace getContourPoints(edges, dx, dy, points); features.resize(levels_ + 1); +#ifdef CV_CXX11 + std::for_each(features.begin(), features.end(), [=](std::vector& e) { e.clear(); e.reserve(maxBufferSize_); }); +#else std::for_each(features.begin(), features.end(), std::mem_fun_ref(&std::vector::clear)); std::for_each(features.begin(), features.end(), std::bind2nd(std::mem_fun_ref(&std::vector::reserve), maxBufferSize_)); +#endif for (size_t i = 0; i < points.size(); ++i) { diff --git a/modules/imgproc/test/test_goodfeaturetotrack.cpp b/modules/imgproc/test/test_goodfeaturetotrack.cpp index 7f29636ad6..362cc014cf 100644 --- a/modules/imgproc/test/test_goodfeaturetotrack.cpp +++ b/modules/imgproc/test/test_goodfeaturetotrack.cpp @@ -56,8 +56,11 @@ enum { MINEIGENVAL=0, HARRIS=1, EIGENVALSVECS=2 }; /////////////////////ref////////////////////// -struct greaterThanPtr : - public std::binary_function +#ifdef CV_CXX11 +struct greaterThanPtr +#else +struct greaterThanPtr : public std::binary_function +#endif { bool operator () (const float * a, const float * b) const { return *a > *b; } diff --git a/modules/objdetect/perf/opencl/perf_hogdetect.cpp b/modules/objdetect/perf/opencl/perf_hogdetect.cpp index 7624a09850..43c63d8cca 100644 --- a/modules/objdetect/perf/opencl/perf_hogdetect.cpp +++ b/modules/objdetect/perf/opencl/perf_hogdetect.cpp @@ -53,8 +53,11 @@ namespace opencv_test { namespace ocl { ///////////// HOG//////////////////////// -struct RectLess : - public std::binary_function +#ifdef CV_CXX11 +struct RectLess +#else +struct RectLess : public std::binary_function +#endif { bool operator()(const cv::Rect& a, const cv::Rect& b) const diff --git a/modules/shape/test/test_shape.cpp b/modules/shape/test/test_shape.cpp index 8ad358d85e..cf3d3f8f7b 100644 --- a/modules/shape/test/test_shape.cpp +++ b/modules/shape/test/test_shape.cpp @@ -105,7 +105,7 @@ protected: } // Uniformly sampling - random_shuffle(contoursQuery.begin(), contoursQuery.end()); + cv::randShuffle(contoursQuery); int nStart=NP; vector cont; for (int i=0; i -struct RectLess_ : - public std::binary_function, cv::Rect_, bool> +#ifdef CV_CXX11 +struct RectLess_ +#else +struct RectLess_ : public std::binary_function, cv::Rect_, bool> +#endif { bool operator()(const cv::Rect_& r1, const cv::Rect_& r2) const { @@ -721,8 +724,11 @@ struct RectLess_ : typedef RectLess_ RectLess; -struct KeypointGreater : - public std::binary_function +#ifdef CV_CXX11 +struct KeypointGreater +#else +struct KeypointGreater : public std::binary_function +#endif { bool operator()(const cv::KeyPoint& kp1, const cv::KeyPoint& kp2) const { diff --git a/modules/ts/src/cuda_test.cpp b/modules/ts/src/cuda_test.cpp index 25e2ebf48d..307e1296a2 100644 --- a/modules/ts/src/cuda_test.cpp +++ b/modules/ts/src/cuda_test.cpp @@ -462,7 +462,11 @@ namespace cvtest return false; } +#ifdef CV_CXX11 + struct KeyPointLess +#else struct KeyPointLess : std::binary_function +#endif { bool operator()(const cv::KeyPoint& kp1, const cv::KeyPoint& kp2) const { diff --git a/samples/cpp/shape_example.cpp b/samples/cpp/shape_example.cpp index a9708f8ed9..0d5b7bbb6f 100644 --- a/samples/cpp/shape_example.cpp +++ b/samples/cpp/shape_example.cpp @@ -43,7 +43,7 @@ static vector simpleContour( const Mat& currentQuery, int n=300 ) } // Uniformly sampling - random_shuffle(contoursQuery.begin(), contoursQuery.end()); + cv::randShuffle(contoursQuery); vector cont; for (int i=0; i