Commit 44d7435a authored by Alexander Alekhin's avatar Alexander Alekhin

build: eliminate calls of removed functionality from C++17

Most part is deprecated since C++11
parent f77f2876
...@@ -138,8 +138,13 @@ bool CV_Affine3D_EstTest::testNPoints() ...@@ -138,8 +138,13 @@ bool CV_Affine3D_EstTest::testNPoints()
std::transform(fpts.ptr<Point3f>(), fpts.ptr<Point3f>() + n, tpts.ptr<Point3f>(), WrapAff(aff)); std::transform(fpts.ptr<Point3f>(), fpts.ptr<Point3f>() + n, tpts.ptr<Point3f>(), WrapAff(aff));
/* adding noise*/ /* adding noise*/
#ifdef CV_CXX11
std::transform(tpts.ptr<Point3f>() + m, tpts.ptr<Point3f>() + n, tpts.ptr<Point3f>() + m,
[=] (const Point3f& pt) -> Point3f { return Noise(noise_level)(pt + shift_outl); });
#else
std::transform(tpts.ptr<Point3f>() + m, tpts.ptr<Point3f>() + n, tpts.ptr<Point3f>() + m, std::bind2nd(std::plus<Point3f>(), shift_outl)); std::transform(tpts.ptr<Point3f>() + m, tpts.ptr<Point3f>() + n, tpts.ptr<Point3f>() + m, std::bind2nd(std::plus<Point3f>(), shift_outl));
std::transform(tpts.ptr<Point3f>() + m, tpts.ptr<Point3f>() + n, tpts.ptr<Point3f>() + m, Noise(noise_level)); std::transform(tpts.ptr<Point3f>() + m, tpts.ptr<Point3f>() + n, tpts.ptr<Point3f>() + m, Noise(noise_level));
#endif
Mat aff_est; Mat aff_est;
vector<uchar> outl; vector<uchar> outl;
......
...@@ -58,8 +58,22 @@ ...@@ -58,8 +58,22 @@
namespace cv { namespace cuda { namespace device namespace cv { namespace cuda { namespace device
{ {
// Function Objects // Function Objects
#ifdef CV_CXX11
template<typename Argument, typename Result> struct unary_function
{
typedef Argument argument_type;
typedef Result result_type;
};
template<typename Argument1, typename Argument2, typename Result> struct binary_function
{
typedef Argument1 first_argument_type;
typedef Argument2 second_argument_type;
typedef Result result_type;
};
#else
template<typename Argument, typename Result> struct unary_function : public std::unary_function<Argument, Result> {}; template<typename Argument, typename Result> struct unary_function : public std::unary_function<Argument, Result> {};
template<typename Argument1, typename Argument2, typename Result> struct binary_function : public std::binary_function<Argument1, Argument2, Result> {}; template<typename Argument1, typename Argument2, typename Result> struct binary_function : public std::binary_function<Argument1, Argument2, Result> {};
#endif
// Arithmetic Operations // Arithmetic Operations
template <typename T> struct plus : binary_function<T, T, T> template <typename T> struct plus : binary_function<T, T, T>
......
...@@ -564,7 +564,12 @@ namespace ...@@ -564,7 +564,12 @@ namespace
if (compactResult) if (compactResult)
{ {
#ifdef CV_CXX11
std::vector< std::vector<DMatch> >::iterator new_end = std::remove_if(matches.begin(), matches.end(),
[](const std::vector<DMatch>& e)->bool { return e.empty(); });
#else
std::vector< std::vector<DMatch> >::iterator new_end = std::remove_if(matches.begin(), matches.end(), std::mem_fun_ref(&std::vector<DMatch>::empty)); std::vector< std::vector<DMatch> >::iterator new_end = std::remove_if(matches.begin(), matches.end(), std::mem_fun_ref(&std::vector<DMatch>::empty));
#endif
matches.erase(new_end, matches.end()); matches.erase(new_end, matches.end());
} }
} }
......
...@@ -52,8 +52,11 @@ ...@@ -52,8 +52,11 @@
namespace cv namespace cv
{ {
struct greaterThanPtr : #ifdef CV_CXX11
public std::binary_function<const float *, const float *, bool> struct greaterThanPtr
#else
struct greaterThanPtr : public std::binary_function<const float *, const float *, bool>
#endif
{ {
bool operator () (const float * a, const float * b) const bool operator () (const float * a, const float * b) const
// Ensure a fully deterministic result of the sort // Ensure a fully deterministic result of the sort
......
...@@ -385,7 +385,11 @@ namespace ...@@ -385,7 +385,11 @@ namespace
const double thetaScale = levels_ / 360.0; const double thetaScale = levels_ / 360.0;
r_table_.resize(levels_ + 1); r_table_.resize(levels_ + 1);
#ifdef CV_CXX11
std::for_each(r_table_.begin(), r_table_.end(), [](std::vector<Point>& e)->void { e.clear(); });
#else
std::for_each(r_table_.begin(), r_table_.end(), std::mem_fun_ref(&std::vector<Point>::clear)); std::for_each(r_table_.begin(), r_table_.end(), std::mem_fun_ref(&std::vector<Point>::clear));
#endif
for (int y = 0; y < templSize_.height; ++y) for (int y = 0; y < templSize_.height; ++y)
{ {
...@@ -692,8 +696,12 @@ namespace ...@@ -692,8 +696,12 @@ namespace
getContourPoints(edges, dx, dy, points); getContourPoints(edges, dx, dy, points);
features.resize(levels_ + 1); features.resize(levels_ + 1);
#ifdef CV_CXX11
std::for_each(features.begin(), features.end(), [=](std::vector<Feature>& e) { e.clear(); e.reserve(maxBufferSize_); });
#else
std::for_each(features.begin(), features.end(), std::mem_fun_ref(&std::vector<Feature>::clear)); std::for_each(features.begin(), features.end(), std::mem_fun_ref(&std::vector<Feature>::clear));
std::for_each(features.begin(), features.end(), std::bind2nd(std::mem_fun_ref(&std::vector<Feature>::reserve), maxBufferSize_)); std::for_each(features.begin(), features.end(), std::bind2nd(std::mem_fun_ref(&std::vector<Feature>::reserve), maxBufferSize_));
#endif
for (size_t i = 0; i < points.size(); ++i) for (size_t i = 0; i < points.size(); ++i)
{ {
......
...@@ -56,8 +56,11 @@ enum { MINEIGENVAL=0, HARRIS=1, EIGENVALSVECS=2 }; ...@@ -56,8 +56,11 @@ enum { MINEIGENVAL=0, HARRIS=1, EIGENVALSVECS=2 };
/////////////////////ref////////////////////// /////////////////////ref//////////////////////
struct greaterThanPtr : #ifdef CV_CXX11
public std::binary_function<const float *, const float *, bool> struct greaterThanPtr
#else
struct greaterThanPtr : public std::binary_function<const float *, const float *, bool>
#endif
{ {
bool operator () (const float * a, const float * b) const bool operator () (const float * a, const float * b) const
{ return *a > *b; } { return *a > *b; }
......
...@@ -53,8 +53,11 @@ namespace opencv_test { ...@@ -53,8 +53,11 @@ namespace opencv_test {
namespace ocl { namespace ocl {
///////////// HOG//////////////////////// ///////////// HOG////////////////////////
struct RectLess : #ifdef CV_CXX11
public std::binary_function<cv::Rect, cv::Rect, bool> struct RectLess
#else
struct RectLess : public std::binary_function<cv::Rect, cv::Rect, bool>
#endif
{ {
bool operator()(const cv::Rect& a, bool operator()(const cv::Rect& a,
const cv::Rect& b) const const cv::Rect& b) const
......
...@@ -105,7 +105,7 @@ protected: ...@@ -105,7 +105,7 @@ protected:
} }
// Uniformly sampling // Uniformly sampling
random_shuffle(contoursQuery.begin(), contoursQuery.end()); cv::randShuffle(contoursQuery);
int nStart=NP; int nStart=NP;
vector<PointType> cont; vector<PointType> cont;
for (int i=0; i<nStart; i++) for (int i=0; i<nStart; i++)
......
...@@ -707,8 +707,11 @@ namespace comparators ...@@ -707,8 +707,11 @@ namespace comparators
{ {
template<typename T> template<typename T>
struct RectLess_ : #ifdef CV_CXX11
public std::binary_function<cv::Rect_<T>, cv::Rect_<T>, bool> struct RectLess_
#else
struct RectLess_ : public std::binary_function<cv::Rect_<T>, cv::Rect_<T>, bool>
#endif
{ {
bool operator()(const cv::Rect_<T>& r1, const cv::Rect_<T>& r2) const bool operator()(const cv::Rect_<T>& r1, const cv::Rect_<T>& r2) const
{ {
...@@ -721,8 +724,11 @@ struct RectLess_ : ...@@ -721,8 +724,11 @@ struct RectLess_ :
typedef RectLess_<int> RectLess; typedef RectLess_<int> RectLess;
struct KeypointGreater : #ifdef CV_CXX11
public std::binary_function<cv::KeyPoint, cv::KeyPoint, bool> struct KeypointGreater
#else
struct KeypointGreater : public std::binary_function<cv::KeyPoint, cv::KeyPoint, bool>
#endif
{ {
bool operator()(const cv::KeyPoint& kp1, const cv::KeyPoint& kp2) const bool operator()(const cv::KeyPoint& kp1, const cv::KeyPoint& kp2) const
{ {
......
...@@ -462,7 +462,11 @@ namespace cvtest ...@@ -462,7 +462,11 @@ namespace cvtest
return false; return false;
} }
#ifdef CV_CXX11
struct KeyPointLess
#else
struct KeyPointLess : std::binary_function<cv::KeyPoint, cv::KeyPoint, bool> struct KeyPointLess : std::binary_function<cv::KeyPoint, cv::KeyPoint, bool>
#endif
{ {
bool operator()(const cv::KeyPoint& kp1, const cv::KeyPoint& kp2) const bool operator()(const cv::KeyPoint& kp1, const cv::KeyPoint& kp2) const
{ {
......
...@@ -43,7 +43,7 @@ static vector<Point> simpleContour( const Mat& currentQuery, int n=300 ) ...@@ -43,7 +43,7 @@ static vector<Point> simpleContour( const Mat& currentQuery, int n=300 )
} }
// Uniformly sampling // Uniformly sampling
random_shuffle(contoursQuery.begin(), contoursQuery.end()); cv::randShuffle(contoursQuery);
vector<Point> cont; vector<Point> cont;
for (int i=0; i<n; i++) for (int i=0; i<n; i++)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment