From 135c0b6cb558c5e7520554d2d44d3c6d231fb49a Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Thu, 28 Mar 2013 18:22:40 +0400 Subject: [PATCH] Move cv::TermCriteria out of core.hpp --- modules/core/include/opencv2/core.hpp | 31 +-------------- .../core/include/opencv2/core/operations.hpp | 8 ---- modules/core/include/opencv2/core/types.hpp | 38 +++++++++++++++++++ modules/core/include/opencv2/core/types_c.h | 7 ++++ 4 files changed, 47 insertions(+), 37 deletions(-) diff --git a/modules/core/include/opencv2/core.hpp b/modules/core/include/opencv2/core.hpp index 75d857e8d7..1d4e7414aa 100644 --- a/modules/core/include/opencv2/core.hpp +++ b/modules/core/include/opencv2/core.hpp @@ -896,34 +896,6 @@ private: int mti; }; -/*! - Termination criteria in iterative algorithms - */ -class CV_EXPORTS TermCriteria -{ -public: - enum - { - COUNT=1, //!< the maximum number of iterations or elements to compute - MAX_ITER=COUNT, //!< ditto - EPS=2 //!< the desired accuracy or change in parameters at which the iterative algorithm stops - }; - - //! default constructor - TermCriteria(); - //! full constructor - TermCriteria(int type, int maxCount, double epsilon); - //! conversion from CvTermCriteria - TermCriteria(const CvTermCriteria& criteria); - //! conversion to CvTermCriteria - operator CvTermCriteria() const; - - int type; //!< the type of termination criteria: COUNT, EPS or COUNT + EPS - int maxCount; // the maximum number of iterations/elements - double epsilon; // the desired accuracy -}; - - typedef void (*BinaryFunc)(const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, Size sz, @@ -3262,9 +3234,10 @@ template<> struct ParamType } //namespace cv #include "opencv2/core/operations.hpp" -#include "opencv2/core/mat.hpp" +#include "opencv2/core/mat.inl.hpp" #include "opencv2/core/cvstd.inl.hpp" + #endif // __cplusplus diff --git a/modules/core/include/opencv2/core/operations.hpp b/modules/core/include/opencv2/core/operations.hpp index f7a07a9bda..82d1f49c33 100644 --- a/modules/core/include/opencv2/core/operations.hpp +++ b/modules/core/include/opencv2/core/operations.hpp @@ -476,14 +476,6 @@ inline int RNG::uniform(int a, int b) { return a == b ? a : (int)(next()%(b - a) inline float RNG::uniform(float a, float b) { return ((float)*this)*(b - a) + a; } inline double RNG::uniform(double a, double b) { return ((double)*this)*(b - a) + a; } -inline TermCriteria::TermCriteria() : type(0), maxCount(0), epsilon(0) {} -inline TermCriteria::TermCriteria(int _type, int _maxCount, double _epsilon) - : type(_type), maxCount(_maxCount), epsilon(_epsilon) {} -inline TermCriteria::TermCriteria(const CvTermCriteria& criteria) - : type(criteria.type), maxCount(criteria.max_iter), epsilon(criteria.epsilon) {} -inline TermCriteria::operator CvTermCriteria() const -{ return cvTermCriteria(type, maxCount, epsilon); } - inline uchar* LineIterator::operator *() { return ptr; } inline LineIterator& LineIterator::operator ++() { diff --git a/modules/core/include/opencv2/core/types.hpp b/modules/core/include/opencv2/core/types.hpp index 9d9badda8e..1d7f1a2bee 100644 --- a/modules/core/include/opencv2/core/types.hpp +++ b/modules/core/include/opencv2/core/types.hpp @@ -640,6 +640,32 @@ public: +///////////////////////////// TermCriteria ////////////////////////////// + +/*! + Termination criteria in iterative algorithms + */ +class CV_EXPORTS TermCriteria +{ +public: + enum + { + COUNT=1, //!< the maximum number of iterations or elements to compute + MAX_ITER=COUNT, //!< ditto + EPS=2 //!< the desired accuracy or change in parameters at which the iterative algorithm stops + }; + + //! default constructor + TermCriteria(); + //! full constructor + TermCriteria(int type, int maxCount, double epsilon); + + int type; //!< the type of termination criteria: COUNT, EPS or COUNT + EPS + int maxCount; // the maximum number of iterations/elements + double epsilon; // the desired accuracy +}; + + ///////////////////////////////////////////////////////////////////////// ///////////////////////////// Implementation //////////////////////////// @@ -1837,6 +1863,18 @@ bool DMatch::operator < (const DMatch &m) const return distance < m.distance; } + + +////////////////////////////// TermCriteria ///////////////////////////// + +inline +TermCriteria::TermCriteria() + : type(0), maxCount(0), epsilon(0) {} + +inline +TermCriteria::TermCriteria(int _type, int _maxCount, double _epsilon) + : type(_type), maxCount(_maxCount), epsilon(_epsilon) {} + } // cv #endif //__OPENCV_CORE_TYPES_HPP__ \ No newline at end of file diff --git a/modules/core/include/opencv2/core/types_c.h b/modules/core/include/opencv2/core/types_c.h index 85b71ab821..cd0df84e87 100644 --- a/modules/core/include/opencv2/core/types_c.h +++ b/modules/core/include/opencv2/core/types_c.h @@ -740,6 +740,13 @@ typedef struct CvTermCriteria CV_TERMCRIT_EPS */ int max_iter; double epsilon; + +#ifdef __cplusplus + CvTermCriteria(int _type = 0, int _iter = 0, double _eps = 0) : type(_type), max_iter(_iter), epsilon(_eps) {} + CvTermCriteria(const cv::TermCriteria& t) : type(t.type), max_iter(t.maxCount), epsilon(t.epsilon) {} + operator cv::TermCriteria() const { return cv::TermCriteria(type, max_iter, epsilon); } +#endif + } CvTermCriteria;