Remove all using directives for STL namespace and members
Made all STL usages explicit to be able automatically find all usages of particular class or function.
This commit is contained in:
@@ -548,11 +548,11 @@ Returns the node content as double.
|
||||
:returns: The node content as double.
|
||||
|
||||
|
||||
FileNode::operator string
|
||||
-------------------------
|
||||
FileNode::operator std::string
|
||||
------------------------------
|
||||
Returns the node content as text string.
|
||||
|
||||
.. ocv:function:: FileNode::operator string() const
|
||||
.. ocv:function:: FileNode::operator std::string() const
|
||||
|
||||
:returns: The node content as a text string.
|
||||
|
||||
|
@@ -74,18 +74,12 @@ namespace cv {
|
||||
#undef max
|
||||
#undef Complex
|
||||
|
||||
using std::vector;
|
||||
using std::string;
|
||||
using std::ptrdiff_t;
|
||||
|
||||
template<typename _Tp> class CV_EXPORTS Size_;
|
||||
template<typename _Tp> class CV_EXPORTS Point_;
|
||||
template<typename _Tp> class CV_EXPORTS Rect_;
|
||||
template<typename _Tp, int cn> class CV_EXPORTS Vec;
|
||||
template<typename _Tp, int m, int n> class CV_EXPORTS Matx;
|
||||
|
||||
typedef std::string String;
|
||||
|
||||
class Mat;
|
||||
class SparseMat;
|
||||
typedef Mat MatND;
|
||||
@@ -111,8 +105,8 @@ template<typename _Tp> class CV_EXPORTS MatCommaInitializer_;
|
||||
|
||||
template<typename _Tp, size_t fixed_size = 1024/sizeof(_Tp)+8> class CV_EXPORTS AutoBuffer;
|
||||
|
||||
CV_EXPORTS string format( const char* fmt, ... );
|
||||
CV_EXPORTS string tempfile( const char* suffix CV_DEFAULT(0));
|
||||
CV_EXPORTS std::string format( const char* fmt, ... );
|
||||
CV_EXPORTS std::string tempfile( const char* suffix CV_DEFAULT(0));
|
||||
|
||||
// matrix decomposition types
|
||||
enum { DECOMP_LU=0, DECOMP_SVD=1, DECOMP_EIG=2, DECOMP_CHOLESKY=3, DECOMP_QR=4, DECOMP_NORMAL=16 };
|
||||
@@ -138,7 +132,7 @@ public:
|
||||
Full constructor. Normally the constuctor is not called explicitly.
|
||||
Instead, the macros CV_Error(), CV_Error_() and CV_Assert() are used.
|
||||
*/
|
||||
Exception(int _code, const string& _err, const string& _func, const string& _file, int _line);
|
||||
Exception(int _code, const std::string& _err, const std::string& _func, const std::string& _file, int _line);
|
||||
virtual ~Exception() throw();
|
||||
|
||||
/*!
|
||||
@@ -147,12 +141,12 @@ public:
|
||||
virtual const char *what() const throw();
|
||||
void formatMessage();
|
||||
|
||||
string msg; ///< the formatted error message
|
||||
std::string msg; ///< the formatted error message
|
||||
|
||||
int code; ///< error code @see CVStatus
|
||||
string err; ///< error description
|
||||
string func; ///< function name. Available only when the compiler supports __func__ macro
|
||||
string file; ///< source file name where the error has occured
|
||||
std::string err; ///< error description
|
||||
std::string func; ///< function name. Available only when the compiler supports __func__ macro
|
||||
std::string file; ///< source file name where the error has occured
|
||||
int line; ///< line number in the source file where the error has occured
|
||||
};
|
||||
|
||||
@@ -216,7 +210,7 @@ CV_EXPORTS void setNumThreads(int nthreads);
|
||||
CV_EXPORTS int getNumThreads();
|
||||
CV_EXPORTS int getThreadNum();
|
||||
|
||||
CV_EXPORTS_W const string& getBuildInformation();
|
||||
CV_EXPORTS_W const std::string& getBuildInformation();
|
||||
|
||||
//! Returns the number of ticks.
|
||||
|
||||
@@ -1317,10 +1311,10 @@ public:
|
||||
_InputArray(const Mat& m);
|
||||
_InputArray(const MatExpr& expr);
|
||||
template<typename _Tp> _InputArray(const _Tp* vec, int n);
|
||||
template<typename _Tp> _InputArray(const vector<_Tp>& vec);
|
||||
template<typename _Tp> _InputArray(const vector<vector<_Tp> >& vec);
|
||||
_InputArray(const vector<Mat>& vec);
|
||||
template<typename _Tp> _InputArray(const vector<Mat_<_Tp> >& vec);
|
||||
template<typename _Tp> _InputArray(const std::vector<_Tp>& vec);
|
||||
template<typename _Tp> _InputArray(const std::vector<std::vector<_Tp> >& vec);
|
||||
_InputArray(const std::vector<Mat>& vec);
|
||||
template<typename _Tp> _InputArray(const std::vector<Mat_<_Tp> >& vec);
|
||||
template<typename _Tp> _InputArray(const Mat_<_Tp>& m);
|
||||
template<typename _Tp, int m, int n> _InputArray(const Matx<_Tp, m, n>& matx);
|
||||
_InputArray(const Scalar& s);
|
||||
@@ -1330,7 +1324,7 @@ public:
|
||||
_InputArray(const gpu::GpuMat& d_mat);
|
||||
|
||||
virtual Mat getMat(int i=-1) const;
|
||||
virtual void getMatVector(vector<Mat>& mv) const;
|
||||
virtual void getMatVector(std::vector<Mat>& mv) const;
|
||||
virtual GlBuffer getGlBuffer() const;
|
||||
virtual GlTexture2D getGlTexture2D() const;
|
||||
virtual gpu::GpuMat getGpuMat() const;
|
||||
@@ -1375,10 +1369,10 @@ public:
|
||||
_OutputArray();
|
||||
|
||||
_OutputArray(Mat& m);
|
||||
template<typename _Tp> _OutputArray(vector<_Tp>& vec);
|
||||
template<typename _Tp> _OutputArray(vector<vector<_Tp> >& vec);
|
||||
_OutputArray(vector<Mat>& vec);
|
||||
template<typename _Tp> _OutputArray(vector<Mat_<_Tp> >& vec);
|
||||
template<typename _Tp> _OutputArray(std::vector<_Tp>& vec);
|
||||
template<typename _Tp> _OutputArray(std::vector<std::vector<_Tp> >& vec);
|
||||
_OutputArray(std::vector<Mat>& vec);
|
||||
template<typename _Tp> _OutputArray(std::vector<Mat_<_Tp> >& vec);
|
||||
template<typename _Tp> _OutputArray(Mat_<_Tp>& m);
|
||||
template<typename _Tp, int m, int n> _OutputArray(Matx<_Tp, m, n>& matx);
|
||||
template<typename _Tp> _OutputArray(_Tp* vec, int n);
|
||||
@@ -1387,10 +1381,10 @@ public:
|
||||
_OutputArray(GlTexture2D& tex);
|
||||
|
||||
_OutputArray(const Mat& m);
|
||||
template<typename _Tp> _OutputArray(const vector<_Tp>& vec);
|
||||
template<typename _Tp> _OutputArray(const vector<vector<_Tp> >& vec);
|
||||
_OutputArray(const vector<Mat>& vec);
|
||||
template<typename _Tp> _OutputArray(const vector<Mat_<_Tp> >& vec);
|
||||
template<typename _Tp> _OutputArray(const std::vector<_Tp>& vec);
|
||||
template<typename _Tp> _OutputArray(const std::vector<std::vector<_Tp> >& vec);
|
||||
_OutputArray(const std::vector<Mat>& vec);
|
||||
template<typename _Tp> _OutputArray(const std::vector<Mat_<_Tp> >& vec);
|
||||
template<typename _Tp> _OutputArray(const Mat_<_Tp>& m);
|
||||
template<typename _Tp, int m, int n> _OutputArray(const Matx<_Tp, m, n>& matx);
|
||||
template<typename _Tp> _OutputArray(const _Tp* vec, int n);
|
||||
@@ -1690,7 +1684,7 @@ public:
|
||||
//! converts old-style IplImage to the new matrix; the data is not copied by default
|
||||
Mat(const IplImage* img, bool copyData=false);
|
||||
//! builds matrix from std::vector with or without copying the data
|
||||
template<typename _Tp> explicit Mat(const vector<_Tp>& vec, bool copyData=false);
|
||||
template<typename _Tp> explicit Mat(const std::vector<_Tp>& vec, bool copyData=false);
|
||||
//! builds matrix from cv::Vec; the data is copied by default
|
||||
template<typename _Tp, int n> explicit Mat(const Vec<_Tp, n>& vec, bool copyData=true);
|
||||
//! builds matrix from cv::Matx; the data is copied by default
|
||||
@@ -1821,7 +1815,7 @@ public:
|
||||
//! converts header to IplImage; no data is copied
|
||||
operator IplImage() const;
|
||||
|
||||
template<typename _Tp> operator vector<_Tp>() const;
|
||||
template<typename _Tp> operator std::vector<_Tp>() const;
|
||||
template<typename _Tp, int n> operator Vec<_Tp, n>() const;
|
||||
template<typename _Tp, int m, int n> operator Matx<_Tp, m, n>() const;
|
||||
|
||||
@@ -2155,10 +2149,10 @@ CV_EXPORTS_W void split(InputArray m, OutputArrayOfArrays mv);
|
||||
//! copies selected channels from the input arrays to the selected channels of the output arrays
|
||||
CV_EXPORTS void mixChannels(const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts,
|
||||
const int* fromTo, size_t npairs);
|
||||
CV_EXPORTS void mixChannels(const vector<Mat>& src, vector<Mat>& dst,
|
||||
CV_EXPORTS void mixChannels(const std::vector<Mat>& src, std::vector<Mat>& dst,
|
||||
const int* fromTo, size_t npairs);
|
||||
CV_EXPORTS_W void mixChannels(InputArrayOfArrays src, InputArrayOfArrays dst,
|
||||
const vector<int>& fromTo);
|
||||
const std::vector<int>& fromTo);
|
||||
|
||||
//! extracts a single channel from src (coi is 0-based index)
|
||||
CV_EXPORTS_W void extractChannel(InputArray src, OutputArray dst, int coi);
|
||||
@@ -2620,7 +2614,7 @@ public:
|
||||
//! converts elliptic arc to a polygonal curve
|
||||
CV_EXPORTS_W void ellipse2Poly( Point center, Size axes, int angle,
|
||||
int arcStart, int arcEnd, int delta,
|
||||
CV_OUT vector<Point>& pts );
|
||||
CV_OUT std::vector<Point>& pts );
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -2636,13 +2630,13 @@ enum
|
||||
};
|
||||
|
||||
//! renders text string in the image
|
||||
CV_EXPORTS_W void putText( Mat& img, const string& text, Point org,
|
||||
CV_EXPORTS_W void putText( Mat& img, const std::string& text, Point org,
|
||||
int fontFace, double fontScale, Scalar color,
|
||||
int thickness=1, int lineType=8,
|
||||
bool bottomLeftOrigin=false );
|
||||
|
||||
//! returns bounding box of the text string
|
||||
CV_EXPORTS_W Size getTextSize(const string& text, int fontFace,
|
||||
CV_EXPORTS_W Size getTextSize(const std::string& text, int fontFace,
|
||||
double fontScale, int thickness,
|
||||
CV_OUT int* baseLine);
|
||||
|
||||
@@ -2732,7 +2726,7 @@ public:
|
||||
//! from a matrix expression
|
||||
explicit Mat_(const MatExpr& e);
|
||||
//! makes a matrix out of Vec, std::vector, Point_ or Point3_. The matrix will have a single column
|
||||
explicit Mat_(const vector<_Tp>& vec, bool copyData=false);
|
||||
explicit Mat_(const std::vector<_Tp>& vec, bool copyData=false);
|
||||
template<int n> explicit Mat_(const Vec<typename DataType<_Tp>::channel_type, n>& vec, bool copyData=true);
|
||||
template<int m, int n> explicit Mat_(const Matx<typename DataType<_Tp>::channel_type, m, n>& mtx, bool copyData=true);
|
||||
explicit Mat_(const Point_<typename DataType<_Tp>::channel_type>& pt, bool copyData=true);
|
||||
@@ -2825,7 +2819,7 @@ public:
|
||||
const _Tp& operator ()(Point pt) const;
|
||||
|
||||
//! conversion to vector.
|
||||
operator vector<_Tp>() const;
|
||||
operator std::vector<_Tp>() const;
|
||||
//! conversion to Vec
|
||||
template<int n> operator Vec<typename DataType<_Tp>::channel_type, n>() const;
|
||||
//! conversion to Matx
|
||||
@@ -3339,8 +3333,8 @@ public:
|
||||
size_t nodeSize;
|
||||
size_t nodeCount;
|
||||
size_t freeList;
|
||||
vector<uchar> pool;
|
||||
vector<size_t> hashtab;
|
||||
std::vector<uchar> pool;
|
||||
std::vector<size_t> hashtab;
|
||||
int size[CV_MAX_DIM];
|
||||
};
|
||||
|
||||
@@ -3878,9 +3872,9 @@ public:
|
||||
//! returns the search space dimensionality
|
||||
CV_WRAP int dims() const;
|
||||
|
||||
vector<Node> nodes; //!< all the tree nodes
|
||||
std::vector<Node> nodes; //!< all the tree nodes
|
||||
CV_PROP Mat points; //!< all the points. It can be a reordered copy of the input vector set or the original vector set.
|
||||
CV_PROP vector<int> labels; //!< the parallel array of labels.
|
||||
CV_PROP std::vector<int> labels; //!< the parallel array of labels.
|
||||
CV_PROP int maxDepth; //!< maximum depth of the search tree. Do not modify it
|
||||
CV_PROP_RW int normType; //!< type of the distance (cv::NORM_L1 or cv::NORM_L2) used for search. Initially set to cv::NORM_L2, but you can modify it
|
||||
};
|
||||
@@ -3954,7 +3948,7 @@ class CV_EXPORTS FileNode;
|
||||
FileStorage fs("test.yml", FileStorage::READ);
|
||||
int test_int = (int)fs["test_int"];
|
||||
double test_real = (double)fs["test_real"];
|
||||
string test_string = (string)fs["test_string"];
|
||||
std::string test_string = (std::string)fs["test_string"];
|
||||
|
||||
Mat M;
|
||||
fs["test_mat"] >> M;
|
||||
@@ -3965,7 +3959,7 @@ class CV_EXPORTS FileNode;
|
||||
int tl1 = (int)tl[1];
|
||||
double tl2 = (double)tl[2];
|
||||
int tl3 = (int)tl[3];
|
||||
string tl4 = (string)tl[4];
|
||||
std::string tl4 = (std::string)tl[4];
|
||||
CV_Assert(tl[5].type() == FileNode::MAP && tl[5].size() == 3);
|
||||
|
||||
int month = (int)tl[5]["month"];
|
||||
@@ -4011,27 +4005,27 @@ public:
|
||||
//! the default constructor
|
||||
CV_WRAP FileStorage();
|
||||
//! the full constructor that opens file storage for reading or writing
|
||||
CV_WRAP FileStorage(const string& source, int flags, const string& encoding=string());
|
||||
CV_WRAP FileStorage(const std::string& source, int flags, const std::string& encoding=std::string());
|
||||
//! the constructor that takes pointer to the C FileStorage structure
|
||||
FileStorage(CvFileStorage* fs);
|
||||
//! the destructor. calls release()
|
||||
virtual ~FileStorage();
|
||||
|
||||
//! opens file storage for reading or writing. The previous storage is closed with release()
|
||||
CV_WRAP virtual bool open(const string& filename, int flags, const string& encoding=string());
|
||||
CV_WRAP virtual bool open(const std::string& filename, int flags, const std::string& encoding=std::string());
|
||||
//! returns true if the object is associated with currently opened file.
|
||||
CV_WRAP virtual bool isOpened() const;
|
||||
//! closes the file and releases all the memory buffers
|
||||
CV_WRAP virtual void release();
|
||||
//! closes the file, releases all the memory buffers and returns the text string
|
||||
CV_WRAP virtual string releaseAndGetString();
|
||||
CV_WRAP virtual std::string releaseAndGetString();
|
||||
|
||||
//! returns the first element of the top-level mapping
|
||||
CV_WRAP FileNode getFirstTopLevelNode() const;
|
||||
//! returns the top-level mapping. YAML supports multiple streams
|
||||
CV_WRAP FileNode root(int streamidx=0) const;
|
||||
//! returns the specified element of the top-level mapping
|
||||
FileNode operator[](const string& nodename) const;
|
||||
FileNode operator[](const std::string& nodename) const;
|
||||
//! returns the specified element of the top-level mapping
|
||||
CV_WRAP FileNode operator[](const char* nodename) const;
|
||||
|
||||
@@ -4040,16 +4034,16 @@ public:
|
||||
//! returns pointer to the underlying C FileStorage structure
|
||||
const CvFileStorage* operator *() const { return fs; }
|
||||
//! writes one or more numbers of the specified format to the currently written structure
|
||||
void writeRaw( const string& fmt, const uchar* vec, size_t len );
|
||||
void writeRaw( const std::string& fmt, const uchar* vec, size_t len );
|
||||
//! writes the registered C structure (CvMat, CvMatND, CvSeq). See cvWrite()
|
||||
void writeObj( const string& name, const void* obj );
|
||||
void writeObj( const std::string& name, const void* obj );
|
||||
|
||||
//! returns the normalized object name for the specified file name
|
||||
static string getDefaultObjectName(const string& filename);
|
||||
static std::string getDefaultObjectName(const std::string& filename);
|
||||
|
||||
Ptr<CvFileStorage> fs; //!< the underlying C FileStorage structure
|
||||
string elname; //!< the currently written element
|
||||
vector<char> structs; //!< the stack of written structures
|
||||
std::string elname; //!< the currently written element
|
||||
std::vector<char> structs; //!< the stack of written structures
|
||||
int state; //!< the writer state
|
||||
};
|
||||
|
||||
@@ -4093,7 +4087,7 @@ public:
|
||||
//! the copy constructor
|
||||
FileNode(const FileNode& node);
|
||||
//! returns element of a mapping node
|
||||
FileNode operator[](const string& nodename) const;
|
||||
FileNode operator[](const std::string& nodename) const;
|
||||
//! returns element of a mapping node
|
||||
CV_WRAP FileNode operator[](const char* nodename) const;
|
||||
//! returns element of a sequence node
|
||||
@@ -4118,7 +4112,7 @@ public:
|
||||
//! returns true if the node has a name
|
||||
CV_WRAP bool isNamed() const;
|
||||
//! returns the node name or an empty string if the node is nameless
|
||||
CV_WRAP string name() const;
|
||||
CV_WRAP std::string name() const;
|
||||
//! returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise.
|
||||
CV_WRAP size_t size() const;
|
||||
//! returns the node content as an integer. If the node stores floating-point number, it is rounded.
|
||||
@@ -4128,7 +4122,7 @@ public:
|
||||
//! returns the node content as double
|
||||
operator double() const;
|
||||
//! returns the node content as text string
|
||||
operator string() const;
|
||||
operator std::string() const;
|
||||
|
||||
//! returns pointer to the underlying file node
|
||||
CvFileNode* operator *();
|
||||
@@ -4141,7 +4135,7 @@ public:
|
||||
FileNodeIterator end() const;
|
||||
|
||||
//! reads node elements to the buffer with the specified format
|
||||
void readRaw( const string& fmt, uchar* vec, size_t len ) const;
|
||||
void readRaw( const std::string& fmt, uchar* vec, size_t len ) const;
|
||||
//! reads the registered object and returns pointer to it
|
||||
void* readObj() const;
|
||||
|
||||
@@ -4184,7 +4178,7 @@ public:
|
||||
FileNodeIterator& operator -= (int ofs);
|
||||
|
||||
//! reads the next maxCount elements (or less, if the sequence/mapping last element occurs earlier) to the buffer with the specified format
|
||||
FileNodeIterator& readRaw( const string& fmt, uchar* vec,
|
||||
FileNodeIterator& readRaw( const std::string& fmt, uchar* vec,
|
||||
size_t maxCount=(size_t)INT_MAX );
|
||||
|
||||
const CvFileStorage* fs;
|
||||
@@ -4281,9 +4275,9 @@ public:
|
||||
void pop_back(_Tp* elems, size_t count);
|
||||
|
||||
//! copies the whole sequence or the sequence slice to the specified vector
|
||||
void copyTo(vector<_Tp>& vec, const Range& range=Range::all()) const;
|
||||
void copyTo(std::vector<_Tp>& vec, const Range& range=Range::all()) const;
|
||||
//! returns the vector containing all the sequence elements
|
||||
operator vector<_Tp>() const;
|
||||
operator std::vector<_Tp>() const;
|
||||
|
||||
CvSeq* seq;
|
||||
};
|
||||
@@ -4340,59 +4334,59 @@ class CV_EXPORTS_W Algorithm
|
||||
public:
|
||||
Algorithm();
|
||||
virtual ~Algorithm();
|
||||
string name() const;
|
||||
std::string name() const;
|
||||
|
||||
template<typename _Tp> typename ParamType<_Tp>::member_type get(const string& name) const;
|
||||
template<typename _Tp> typename ParamType<_Tp>::member_type get(const std::string& name) const;
|
||||
template<typename _Tp> typename ParamType<_Tp>::member_type get(const char* name) const;
|
||||
|
||||
CV_WRAP int getInt(const string& name) const;
|
||||
CV_WRAP double getDouble(const string& name) const;
|
||||
CV_WRAP bool getBool(const string& name) const;
|
||||
CV_WRAP string getString(const string& name) const;
|
||||
CV_WRAP Mat getMat(const string& name) const;
|
||||
CV_WRAP vector<Mat> getMatVector(const string& name) const;
|
||||
CV_WRAP Ptr<Algorithm> getAlgorithm(const string& name) const;
|
||||
CV_WRAP int getInt(const std::string& name) const;
|
||||
CV_WRAP double getDouble(const std::string& name) const;
|
||||
CV_WRAP bool getBool(const std::string& name) const;
|
||||
CV_WRAP std::string getString(const std::string& name) const;
|
||||
CV_WRAP Mat getMat(const std::string& name) const;
|
||||
CV_WRAP std::vector<Mat> getMatVector(const std::string& name) const;
|
||||
CV_WRAP Ptr<Algorithm> getAlgorithm(const std::string& name) const;
|
||||
|
||||
void set(const string& name, int value);
|
||||
void set(const string& name, double value);
|
||||
void set(const string& name, bool value);
|
||||
void set(const string& name, const string& value);
|
||||
void set(const string& name, const Mat& value);
|
||||
void set(const string& name, const vector<Mat>& value);
|
||||
void set(const string& name, const Ptr<Algorithm>& value);
|
||||
template<typename _Tp> void set(const string& name, const Ptr<_Tp>& value);
|
||||
void set(const std::string& name, int value);
|
||||
void set(const std::string& name, double value);
|
||||
void set(const std::string& name, bool value);
|
||||
void set(const std::string& name, const std::string& value);
|
||||
void set(const std::string& name, const Mat& value);
|
||||
void set(const std::string& name, const std::vector<Mat>& value);
|
||||
void set(const std::string& name, const Ptr<Algorithm>& value);
|
||||
template<typename _Tp> void set(const std::string& name, const Ptr<_Tp>& value);
|
||||
|
||||
CV_WRAP void setInt(const string& name, int value);
|
||||
CV_WRAP void setDouble(const string& name, double value);
|
||||
CV_WRAP void setBool(const string& name, bool value);
|
||||
CV_WRAP void setString(const string& name, const string& value);
|
||||
CV_WRAP void setMat(const string& name, const Mat& value);
|
||||
CV_WRAP void setMatVector(const string& name, const vector<Mat>& value);
|
||||
CV_WRAP void setAlgorithm(const string& name, const Ptr<Algorithm>& value);
|
||||
template<typename _Tp> void setAlgorithm(const string& name, const Ptr<_Tp>& value);
|
||||
CV_WRAP void setInt(const std::string& name, int value);
|
||||
CV_WRAP void setDouble(const std::string& name, double value);
|
||||
CV_WRAP void setBool(const std::string& name, bool value);
|
||||
CV_WRAP void setString(const std::string& name, const std::string& value);
|
||||
CV_WRAP void setMat(const std::string& name, const Mat& value);
|
||||
CV_WRAP void setMatVector(const std::string& name, const std::vector<Mat>& value);
|
||||
CV_WRAP void setAlgorithm(const std::string& name, const Ptr<Algorithm>& value);
|
||||
template<typename _Tp> void setAlgorithm(const std::string& name, const Ptr<_Tp>& value);
|
||||
|
||||
void set(const char* name, int value);
|
||||
void set(const char* name, double value);
|
||||
void set(const char* name, bool value);
|
||||
void set(const char* name, const string& value);
|
||||
void set(const char* name, const std::string& value);
|
||||
void set(const char* name, const Mat& value);
|
||||
void set(const char* name, const vector<Mat>& value);
|
||||
void set(const char* name, const std::vector<Mat>& value);
|
||||
void set(const char* name, const Ptr<Algorithm>& value);
|
||||
template<typename _Tp> void set(const char* name, const Ptr<_Tp>& value);
|
||||
|
||||
void setInt(const char* name, int value);
|
||||
void setDouble(const char* name, double value);
|
||||
void setBool(const char* name, bool value);
|
||||
void setString(const char* name, const string& value);
|
||||
void setString(const char* name, const std::string& value);
|
||||
void setMat(const char* name, const Mat& value);
|
||||
void setMatVector(const char* name, const vector<Mat>& value);
|
||||
void setMatVector(const char* name, const std::vector<Mat>& value);
|
||||
void setAlgorithm(const char* name, const Ptr<Algorithm>& value);
|
||||
template<typename _Tp> void setAlgorithm(const char* name, const Ptr<_Tp>& value);
|
||||
|
||||
CV_WRAP string paramHelp(const string& name) const;
|
||||
CV_WRAP std::string paramHelp(const std::string& name) const;
|
||||
int paramType(const char* name) const;
|
||||
CV_WRAP int paramType(const string& name) const;
|
||||
CV_WRAP void getParams(CV_OUT vector<string>& names) const;
|
||||
CV_WRAP int paramType(const std::string& name) const;
|
||||
CV_WRAP void getParams(CV_OUT std::vector<std::string>& names) const;
|
||||
|
||||
|
||||
virtual void write(FileStorage& fs) const;
|
||||
@@ -4402,9 +4396,9 @@ public:
|
||||
typedef int (Algorithm::*Getter)() const;
|
||||
typedef void (Algorithm::*Setter)(int);
|
||||
|
||||
CV_WRAP static void getList(CV_OUT vector<string>& algorithms);
|
||||
CV_WRAP static Ptr<Algorithm> _create(const string& name);
|
||||
template<typename _Tp> static Ptr<_Tp> create(const string& name);
|
||||
CV_WRAP static void getList(CV_OUT std::vector<std::string>& algorithms);
|
||||
CV_WRAP static Ptr<Algorithm> _create(const std::string& name);
|
||||
template<typename _Tp> static Ptr<_Tp> create(const std::string& name);
|
||||
|
||||
virtual AlgorithmInfo* info() const /* TODO: make it = 0;*/ { return 0; }
|
||||
};
|
||||
@@ -4414,66 +4408,66 @@ class CV_EXPORTS AlgorithmInfo
|
||||
{
|
||||
public:
|
||||
friend class Algorithm;
|
||||
AlgorithmInfo(const string& name, Algorithm::Constructor create);
|
||||
AlgorithmInfo(const std::string& name, Algorithm::Constructor create);
|
||||
~AlgorithmInfo();
|
||||
void get(const Algorithm* algo, const char* name, int argType, void* value) const;
|
||||
void addParam_(Algorithm& algo, const char* name, int argType,
|
||||
void* value, bool readOnly,
|
||||
Algorithm::Getter getter, Algorithm::Setter setter,
|
||||
const string& help=string());
|
||||
string paramHelp(const char* name) const;
|
||||
const std::string& help=std::string());
|
||||
std::string paramHelp(const char* name) const;
|
||||
int paramType(const char* name) const;
|
||||
void getParams(vector<string>& names) const;
|
||||
void getParams(std::vector<std::string>& names) const;
|
||||
|
||||
void write(const Algorithm* algo, FileStorage& fs) const;
|
||||
void read(Algorithm* algo, const FileNode& fn) const;
|
||||
string name() const;
|
||||
std::string name() const;
|
||||
|
||||
void addParam(Algorithm& algo, const char* name,
|
||||
int& value, bool readOnly=false,
|
||||
int (Algorithm::*getter)()=0,
|
||||
void (Algorithm::*setter)(int)=0,
|
||||
const string& help=string());
|
||||
const std::string& help=std::string());
|
||||
void addParam(Algorithm& algo, const char* name,
|
||||
bool& value, bool readOnly=false,
|
||||
int (Algorithm::*getter)()=0,
|
||||
void (Algorithm::*setter)(int)=0,
|
||||
const string& help=string());
|
||||
const std::string& help=std::string());
|
||||
void addParam(Algorithm& algo, const char* name,
|
||||
double& value, bool readOnly=false,
|
||||
double (Algorithm::*getter)()=0,
|
||||
void (Algorithm::*setter)(double)=0,
|
||||
const string& help=string());
|
||||
const std::string& help=std::string());
|
||||
void addParam(Algorithm& algo, const char* name,
|
||||
string& value, bool readOnly=false,
|
||||
string (Algorithm::*getter)()=0,
|
||||
void (Algorithm::*setter)(const string&)=0,
|
||||
const string& help=string());
|
||||
std::string& value, bool readOnly=false,
|
||||
std::string (Algorithm::*getter)()=0,
|
||||
void (Algorithm::*setter)(const std::string&)=0,
|
||||
const std::string& help=std::string());
|
||||
void addParam(Algorithm& algo, const char* name,
|
||||
Mat& value, bool readOnly=false,
|
||||
Mat (Algorithm::*getter)()=0,
|
||||
void (Algorithm::*setter)(const Mat&)=0,
|
||||
const string& help=string());
|
||||
const std::string& help=std::string());
|
||||
void addParam(Algorithm& algo, const char* name,
|
||||
vector<Mat>& value, bool readOnly=false,
|
||||
vector<Mat> (Algorithm::*getter)()=0,
|
||||
void (Algorithm::*setter)(const vector<Mat>&)=0,
|
||||
const string& help=string());
|
||||
std::vector<Mat>& value, bool readOnly=false,
|
||||
std::vector<Mat> (Algorithm::*getter)()=0,
|
||||
void (Algorithm::*setter)(const std::vector<Mat>&)=0,
|
||||
const std::string& help=std::string());
|
||||
void addParam(Algorithm& algo, const char* name,
|
||||
Ptr<Algorithm>& value, bool readOnly=false,
|
||||
Ptr<Algorithm> (Algorithm::*getter)()=0,
|
||||
void (Algorithm::*setter)(const Ptr<Algorithm>&)=0,
|
||||
const string& help=string());
|
||||
const std::string& help=std::string());
|
||||
template<typename _Tp, typename _Base> void addParam(Algorithm& algo, const char* name,
|
||||
Ptr<_Tp>& value, bool readOnly=false,
|
||||
Ptr<_Tp> (Algorithm::*getter)()=0,
|
||||
void (Algorithm::*setter)(const Ptr<_Tp>&)=0,
|
||||
const string& help=string());
|
||||
const std::string& help=std::string());
|
||||
template<typename _Tp> void addParam(Algorithm& algo, const char* name,
|
||||
Ptr<_Tp>& value, bool readOnly=false,
|
||||
Ptr<_Tp> (Algorithm::*getter)()=0,
|
||||
void (Algorithm::*setter)(const Ptr<_Tp>&)=0,
|
||||
const string& help=string());
|
||||
const std::string& help=std::string());
|
||||
protected:
|
||||
AlgorithmInfoData* data;
|
||||
void set(Algorithm* algo, const char* name, int argType,
|
||||
@@ -4489,13 +4483,13 @@ struct CV_EXPORTS Param
|
||||
Param(int _type, bool _readonly, int _offset,
|
||||
Algorithm::Getter _getter=0,
|
||||
Algorithm::Setter _setter=0,
|
||||
const string& _help=string());
|
||||
const std::string& _help=std::string());
|
||||
int type;
|
||||
int offset;
|
||||
bool readonly;
|
||||
Algorithm::Getter getter;
|
||||
Algorithm::Setter setter;
|
||||
string help;
|
||||
std::string help;
|
||||
};
|
||||
|
||||
template<> struct ParamType<bool>
|
||||
@@ -4522,10 +4516,10 @@ template<> struct ParamType<double>
|
||||
enum { type = Param::REAL };
|
||||
};
|
||||
|
||||
template<> struct ParamType<string>
|
||||
template<> struct ParamType<std::string>
|
||||
{
|
||||
typedef const string& const_param_type;
|
||||
typedef string member_type;
|
||||
typedef const std::string& const_param_type;
|
||||
typedef std::string member_type;
|
||||
|
||||
enum { type = Param::STRING };
|
||||
};
|
||||
@@ -4538,10 +4532,10 @@ template<> struct ParamType<Mat>
|
||||
enum { type = Param::MAT };
|
||||
};
|
||||
|
||||
template<> struct ParamType<vector<Mat> >
|
||||
template<> struct ParamType<std::vector<Mat> >
|
||||
{
|
||||
typedef const vector<Mat>& const_param_type;
|
||||
typedef vector<Mat> member_type;
|
||||
typedef const std::vector<Mat>& const_param_type;
|
||||
typedef std::vector<Mat> member_type;
|
||||
|
||||
enum { type = Param::MAT_VECTOR };
|
||||
};
|
||||
@@ -4584,14 +4578,14 @@ template<> struct ParamType<uint64>
|
||||
class CV_EXPORTS CommandLineParser
|
||||
{
|
||||
public:
|
||||
CommandLineParser(int argc, const char* const argv[], const string& keys);
|
||||
CommandLineParser(int argc, const char* const argv[], const std::string& keys);
|
||||
CommandLineParser(const CommandLineParser& parser);
|
||||
CommandLineParser& operator = (const CommandLineParser& parser);
|
||||
|
||||
string getPathToApplication() const;
|
||||
std::string getPathToApplication() const;
|
||||
|
||||
template <typename T>
|
||||
T get(const string& name, bool space_delete = true) const
|
||||
T get(const std::string& name, bool space_delete = true) const
|
||||
{
|
||||
T val = T();
|
||||
getByName(name, space_delete, ParamType<T>::type, (void*)&val);
|
||||
@@ -4606,17 +4600,17 @@ public:
|
||||
return val;
|
||||
}
|
||||
|
||||
bool has(const string& name) const;
|
||||
bool has(const std::string& name) const;
|
||||
|
||||
bool check() const;
|
||||
|
||||
void about(const string& message);
|
||||
void about(const std::string& message);
|
||||
|
||||
void printMessage() const;
|
||||
void printErrors() const;
|
||||
|
||||
protected:
|
||||
void getByName(const string& name, bool space_delete, int type, void* dst) const;
|
||||
void getByName(const std::string& name, bool space_delete, int type, void* dst) const;
|
||||
void getByIndex(int index, bool space_delete, int type, void* dst) const;
|
||||
|
||||
struct Impl;
|
||||
|
@@ -171,7 +171,7 @@ inline Mat::Mat(Size _sz, int _type, void* _data, size_t _step)
|
||||
}
|
||||
|
||||
|
||||
template<typename _Tp> inline Mat::Mat(const vector<_Tp>& vec, bool copyData)
|
||||
template<typename _Tp> inline Mat::Mat(const std::vector<_Tp>& vec, bool copyData)
|
||||
: flags(MAGIC_VAL | DataType<_Tp>::type | CV_MAT_CONT_FLAG),
|
||||
dims(2), rows((int)vec.size()), cols(1), data(0), refcount(0),
|
||||
datastart(0), dataend(0), allocator(0), size(&rows)
|
||||
@@ -648,9 +648,9 @@ template<typename _Tp> inline MatIterator_<_Tp> Mat::end()
|
||||
return it;
|
||||
}
|
||||
|
||||
template<typename _Tp> inline Mat::operator vector<_Tp>() const
|
||||
template<typename _Tp> inline Mat::operator std::vector<_Tp>() const
|
||||
{
|
||||
vector<_Tp> v;
|
||||
std::vector<_Tp> v;
|
||||
copyTo(v);
|
||||
return v;
|
||||
}
|
||||
@@ -873,7 +873,7 @@ template<typename _Tp> inline Mat_<_Tp>::Mat_(const Point3_<typename DataType<_T
|
||||
template<typename _Tp> inline Mat_<_Tp>::Mat_(const MatCommaInitializer_<_Tp>& commaInitializer)
|
||||
: Mat(commaInitializer) {}
|
||||
|
||||
template<typename _Tp> inline Mat_<_Tp>::Mat_(const vector<_Tp>& vec, bool copyData)
|
||||
template<typename _Tp> inline Mat_<_Tp>::Mat_(const std::vector<_Tp>& vec, bool copyData)
|
||||
: Mat(vec, copyData) {}
|
||||
|
||||
template<typename _Tp> inline Mat_<_Tp>& Mat_<_Tp>::operator = (const Mat& m)
|
||||
@@ -1059,9 +1059,9 @@ template<typename _Tp> inline const _Tp& Mat_<_Tp>::operator ()(int i0, int i1,
|
||||
}
|
||||
|
||||
|
||||
template<typename _Tp> inline Mat_<_Tp>::operator vector<_Tp>() const
|
||||
template<typename _Tp> inline Mat_<_Tp>::operator std::vector<_Tp>() const
|
||||
{
|
||||
vector<_Tp> v;
|
||||
std::vector<_Tp> v;
|
||||
copyTo(v);
|
||||
return v;
|
||||
}
|
||||
@@ -1116,13 +1116,13 @@ process( const Mat_<T1>& m1, const Mat_<T2>& m2, Mat_<T3>& m3, Op op )
|
||||
|
||||
/////////////////////////////// Input/Output Arrays /////////////////////////////////
|
||||
|
||||
template<typename _Tp> inline _InputArray::_InputArray(const vector<_Tp>& vec)
|
||||
template<typename _Tp> inline _InputArray::_InputArray(const std::vector<_Tp>& vec)
|
||||
: flags(FIXED_TYPE + STD_VECTOR + DataType<_Tp>::type), obj((void*)&vec) {}
|
||||
|
||||
template<typename _Tp> inline _InputArray::_InputArray(const vector<vector<_Tp> >& vec)
|
||||
template<typename _Tp> inline _InputArray::_InputArray(const std::vector<std::vector<_Tp> >& vec)
|
||||
: flags(FIXED_TYPE + STD_VECTOR_VECTOR + DataType<_Tp>::type), obj((void*)&vec) {}
|
||||
|
||||
template<typename _Tp> inline _InputArray::_InputArray(const vector<Mat_<_Tp> >& vec)
|
||||
template<typename _Tp> inline _InputArray::_InputArray(const std::vector<Mat_<_Tp> >& vec)
|
||||
: flags(FIXED_TYPE + STD_VECTOR_MAT + DataType<_Tp>::type), obj((void*)&vec) {}
|
||||
|
||||
template<typename _Tp, int m, int n> inline _InputArray::_InputArray(const Matx<_Tp, m, n>& mtx)
|
||||
@@ -1137,11 +1137,11 @@ inline _InputArray::_InputArray(const Scalar& s)
|
||||
template<typename _Tp> inline _InputArray::_InputArray(const Mat_<_Tp>& m)
|
||||
: flags(FIXED_TYPE + MAT + DataType<_Tp>::type), obj((void*)&m) {}
|
||||
|
||||
template<typename _Tp> inline _OutputArray::_OutputArray(vector<_Tp>& vec)
|
||||
template<typename _Tp> inline _OutputArray::_OutputArray(std::vector<_Tp>& vec)
|
||||
: _InputArray(vec) {}
|
||||
template<typename _Tp> inline _OutputArray::_OutputArray(vector<vector<_Tp> >& vec)
|
||||
template<typename _Tp> inline _OutputArray::_OutputArray(std::vector<std::vector<_Tp> >& vec)
|
||||
: _InputArray(vec) {}
|
||||
template<typename _Tp> inline _OutputArray::_OutputArray(vector<Mat_<_Tp> >& vec)
|
||||
template<typename _Tp> inline _OutputArray::_OutputArray(std::vector<Mat_<_Tp> >& vec)
|
||||
: _InputArray(vec) {}
|
||||
template<typename _Tp> inline _OutputArray::_OutputArray(Mat_<_Tp>& m)
|
||||
: _InputArray(m) {}
|
||||
@@ -1150,11 +1150,11 @@ template<typename _Tp, int m, int n> inline _OutputArray::_OutputArray(Matx<_Tp,
|
||||
template<typename _Tp> inline _OutputArray::_OutputArray(_Tp* vec, int n)
|
||||
: _InputArray(vec, n) {}
|
||||
|
||||
template<typename _Tp> inline _OutputArray::_OutputArray(const vector<_Tp>& vec)
|
||||
template<typename _Tp> inline _OutputArray::_OutputArray(const std::vector<_Tp>& vec)
|
||||
: _InputArray(vec) {flags |= FIXED_SIZE;}
|
||||
template<typename _Tp> inline _OutputArray::_OutputArray(const vector<vector<_Tp> >& vec)
|
||||
template<typename _Tp> inline _OutputArray::_OutputArray(const std::vector<std::vector<_Tp> >& vec)
|
||||
: _InputArray(vec) {flags |= FIXED_SIZE;}
|
||||
template<typename _Tp> inline _OutputArray::_OutputArray(const vector<Mat_<_Tp> >& vec)
|
||||
template<typename _Tp> inline _OutputArray::_OutputArray(const std::vector<Mat_<_Tp> >& vec)
|
||||
: _InputArray(vec) {flags |= FIXED_SIZE;}
|
||||
|
||||
template<typename _Tp> inline _OutputArray::_OutputArray(const Mat_<_Tp>& m)
|
||||
@@ -1667,8 +1667,8 @@ operator ^= (const Mat_<_Tp>& a, const Scalar& s)
|
||||
|
||||
/////////////////////////////// Miscellaneous operations //////////////////////////////
|
||||
|
||||
template<typename _Tp> void split(const Mat& src, vector<Mat_<_Tp> >& mv)
|
||||
{ split(src, (vector<Mat>&)mv ); }
|
||||
template<typename _Tp> void split(const Mat& src, std::vector<Mat_<_Tp> >& mv)
|
||||
{ split(src, (std::vector<Mat>&)mv ); }
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
@@ -101,16 +101,6 @@
|
||||
namespace cv
|
||||
{
|
||||
|
||||
using std::cos;
|
||||
using std::sin;
|
||||
using std::max;
|
||||
using std::min;
|
||||
using std::exp;
|
||||
using std::log;
|
||||
using std::pow;
|
||||
using std::sqrt;
|
||||
|
||||
|
||||
/////////////// saturate_cast (used in image & signal processing) ///////////////////
|
||||
|
||||
template<typename _Tp> static inline _Tp saturate_cast(uchar v) { return _Tp(v); }
|
||||
@@ -2769,18 +2759,18 @@ template<> CV_EXPORTS void Ptr<CvFileStorage>::delete_obj();
|
||||
|
||||
//////////////////////////////////////// XML & YAML I/O ////////////////////////////////////
|
||||
|
||||
CV_EXPORTS_W void write( FileStorage& fs, const string& name, int value );
|
||||
CV_EXPORTS_W void write( FileStorage& fs, const string& name, float value );
|
||||
CV_EXPORTS_W void write( FileStorage& fs, const string& name, double value );
|
||||
CV_EXPORTS_W void write( FileStorage& fs, const string& name, const string& value );
|
||||
CV_EXPORTS_W void write( FileStorage& fs, const std::string& name, int value );
|
||||
CV_EXPORTS_W void write( FileStorage& fs, const std::string& name, float value );
|
||||
CV_EXPORTS_W void write( FileStorage& fs, const std::string& name, double value );
|
||||
CV_EXPORTS_W void write( FileStorage& fs, const std::string& name, const std::string& value );
|
||||
|
||||
template<typename _Tp> inline void write(FileStorage& fs, const _Tp& value)
|
||||
{ write(fs, string(), value); }
|
||||
{ write(fs, std::string(), value); }
|
||||
|
||||
CV_EXPORTS void writeScalar( FileStorage& fs, int value );
|
||||
CV_EXPORTS void writeScalar( FileStorage& fs, float value );
|
||||
CV_EXPORTS void writeScalar( FileStorage& fs, double value );
|
||||
CV_EXPORTS void writeScalar( FileStorage& fs, const string& value );
|
||||
CV_EXPORTS void writeScalar( FileStorage& fs, const std::string& value );
|
||||
|
||||
template<> inline void write( FileStorage& fs, const int& value )
|
||||
{
|
||||
@@ -2797,7 +2787,7 @@ template<> inline void write( FileStorage& fs, const double& value )
|
||||
writeScalar(fs, value);
|
||||
}
|
||||
|
||||
template<> inline void write( FileStorage& fs, const string& value )
|
||||
template<> inline void write( FileStorage& fs, const std::string& value )
|
||||
{
|
||||
writeScalar(fs, value);
|
||||
}
|
||||
@@ -2858,20 +2848,20 @@ inline void write(FileStorage& fs, const Range& r )
|
||||
class CV_EXPORTS WriteStructContext
|
||||
{
|
||||
public:
|
||||
WriteStructContext(FileStorage& _fs, const string& name,
|
||||
int flags, const string& typeName=string());
|
||||
WriteStructContext(FileStorage& _fs, const std::string& name,
|
||||
int flags, const std::string& typeName=std::string());
|
||||
~WriteStructContext();
|
||||
FileStorage* fs;
|
||||
};
|
||||
|
||||
template<typename _Tp> inline void write(FileStorage& fs, const string& name, const Point_<_Tp>& pt )
|
||||
template<typename _Tp> inline void write(FileStorage& fs, const std::string& name, const Point_<_Tp>& pt )
|
||||
{
|
||||
WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW);
|
||||
write(fs, pt.x);
|
||||
write(fs, pt.y);
|
||||
}
|
||||
|
||||
template<typename _Tp> inline void write(FileStorage& fs, const string& name, const Point3_<_Tp>& pt )
|
||||
template<typename _Tp> inline void write(FileStorage& fs, const std::string& name, const Point3_<_Tp>& pt )
|
||||
{
|
||||
WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW);
|
||||
write(fs, pt.x);
|
||||
@@ -2879,21 +2869,21 @@ template<typename _Tp> inline void write(FileStorage& fs, const string& name, co
|
||||
write(fs, pt.z);
|
||||
}
|
||||
|
||||
template<typename _Tp> inline void write(FileStorage& fs, const string& name, const Size_<_Tp>& sz )
|
||||
template<typename _Tp> inline void write(FileStorage& fs, const std::string& name, const Size_<_Tp>& sz )
|
||||
{
|
||||
WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW);
|
||||
write(fs, sz.width);
|
||||
write(fs, sz.height);
|
||||
}
|
||||
|
||||
template<typename _Tp> inline void write(FileStorage& fs, const string& name, const Complex<_Tp>& c )
|
||||
template<typename _Tp> inline void write(FileStorage& fs, const std::string& name, const Complex<_Tp>& c )
|
||||
{
|
||||
WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW);
|
||||
write(fs, c.re);
|
||||
write(fs, c.im);
|
||||
}
|
||||
|
||||
template<typename _Tp> inline void write(FileStorage& fs, const string& name, const Rect_<_Tp>& r )
|
||||
template<typename _Tp> inline void write(FileStorage& fs, const std::string& name, const Rect_<_Tp>& r )
|
||||
{
|
||||
WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW);
|
||||
write(fs, r.x);
|
||||
@@ -2902,14 +2892,14 @@ template<typename _Tp> inline void write(FileStorage& fs, const string& name, co
|
||||
write(fs, r.height);
|
||||
}
|
||||
|
||||
template<typename _Tp, int cn> inline void write(FileStorage& fs, const string& name, const Vec<_Tp, cn>& v )
|
||||
template<typename _Tp, int cn> inline void write(FileStorage& fs, const std::string& name, const Vec<_Tp, cn>& v )
|
||||
{
|
||||
WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW);
|
||||
for(int i = 0; i < cn; i++)
|
||||
write(fs, v.val[i]);
|
||||
}
|
||||
|
||||
template<typename _Tp> inline void write(FileStorage& fs, const string& name, const Scalar_<_Tp>& s )
|
||||
template<typename _Tp> inline void write(FileStorage& fs, const std::string& name, const Scalar_<_Tp>& s )
|
||||
{
|
||||
WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW);
|
||||
write(fs, s.val[0]);
|
||||
@@ -2918,7 +2908,7 @@ template<typename _Tp> inline void write(FileStorage& fs, const string& name, co
|
||||
write(fs, s.val[3]);
|
||||
}
|
||||
|
||||
inline void write(FileStorage& fs, const string& name, const Range& r )
|
||||
inline void write(FileStorage& fs, const std::string& name, const Range& r )
|
||||
{
|
||||
WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW);
|
||||
write(fs, r.start);
|
||||
@@ -2929,7 +2919,7 @@ template<typename _Tp, int numflag> class CV_EXPORTS VecWriterProxy
|
||||
{
|
||||
public:
|
||||
VecWriterProxy( FileStorage* _fs ) : fs(_fs) {}
|
||||
void operator()(const vector<_Tp>& vec) const
|
||||
void operator()(const std::vector<_Tp>& vec) const
|
||||
{
|
||||
size_t i, count = vec.size();
|
||||
for( i = 0; i < count; i++ )
|
||||
@@ -2942,30 +2932,30 @@ template<typename _Tp> class CV_EXPORTS VecWriterProxy<_Tp,1>
|
||||
{
|
||||
public:
|
||||
VecWriterProxy( FileStorage* _fs ) : fs(_fs) {}
|
||||
void operator()(const vector<_Tp>& vec) const
|
||||
void operator()(const std::vector<_Tp>& vec) const
|
||||
{
|
||||
int _fmt = DataType<_Tp>::fmt;
|
||||
char fmt[] = { (char)((_fmt>>8)+'1'), (char)_fmt, '\0' };
|
||||
fs->writeRaw( string(fmt), !vec.empty() ? (uchar*)&vec[0] : 0, vec.size()*sizeof(_Tp) );
|
||||
fs->writeRaw( std::string(fmt), !vec.empty() ? (uchar*)&vec[0] : 0, vec.size()*sizeof(_Tp) );
|
||||
}
|
||||
FileStorage* fs;
|
||||
};
|
||||
|
||||
template<typename _Tp> static inline void write( FileStorage& fs, const vector<_Tp>& vec )
|
||||
template<typename _Tp> static inline void write( FileStorage& fs, const std::vector<_Tp>& vec )
|
||||
{
|
||||
VecWriterProxy<_Tp, DataType<_Tp>::fmt != 0> w(&fs);
|
||||
w(vec);
|
||||
}
|
||||
|
||||
template<typename _Tp> static inline void write( FileStorage& fs, const string& name,
|
||||
const vector<_Tp>& vec )
|
||||
template<typename _Tp> static inline void write( FileStorage& fs, const std::string& name,
|
||||
const std::vector<_Tp>& vec )
|
||||
{
|
||||
WriteStructContext ws(fs, name, CV_NODE_SEQ+(DataType<_Tp>::fmt != 0 ? CV_NODE_FLOW : 0));
|
||||
write(fs, vec);
|
||||
}
|
||||
|
||||
CV_EXPORTS_W void write( FileStorage& fs, const string& name, const Mat& value );
|
||||
CV_EXPORTS void write( FileStorage& fs, const string& name, const SparseMat& value );
|
||||
CV_EXPORTS_W void write( FileStorage& fs, const std::string& name, const Mat& value );
|
||||
CV_EXPORTS void write( FileStorage& fs, const std::string& name, const SparseMat& value );
|
||||
|
||||
template<typename _Tp> static inline FileStorage& operator << (FileStorage& fs, const _Tp& value)
|
||||
{
|
||||
@@ -2979,10 +2969,10 @@ template<typename _Tp> static inline FileStorage& operator << (FileStorage& fs,
|
||||
return fs;
|
||||
}
|
||||
|
||||
CV_EXPORTS FileStorage& operator << (FileStorage& fs, const string& str);
|
||||
CV_EXPORTS FileStorage& operator << (FileStorage& fs, const std::string& str);
|
||||
|
||||
static inline FileStorage& operator << (FileStorage& fs, const char* str)
|
||||
{ return (fs << string(str)); }
|
||||
{ return (fs << std::string(str)); }
|
||||
|
||||
inline FileNode::FileNode() : fs(0), node(0) {}
|
||||
inline FileNode::FileNode(const CvFileStorage* _fs, const CvFileNode* _node)
|
||||
@@ -3060,9 +3050,9 @@ static inline void read(const FileNode& node, double& value, double default_valu
|
||||
CV_NODE_IS_REAL(node.node->tag) ? node.node->data.f : 1e300;
|
||||
}
|
||||
|
||||
static inline void read(const FileNode& node, string& value, const string& default_value)
|
||||
static inline void read(const FileNode& node, std::string& value, const std::string& default_value)
|
||||
{
|
||||
value = !node.node ? default_value : CV_NODE_IS_STRING(node.node->tag) ? string(node.node->data.str.ptr) : string("");
|
||||
value = !node.node ? default_value : CV_NODE_IS_STRING(node.node->tag) ? std::string(node.node->data.str.ptr) : std::string("");
|
||||
}
|
||||
|
||||
CV_EXPORTS_W void read(const FileNode& node, Mat& mat, const Mat& default_mat=Mat() );
|
||||
@@ -3086,14 +3076,14 @@ inline FileNode::operator double() const
|
||||
read(*this, value, 0.);
|
||||
return value;
|
||||
}
|
||||
inline FileNode::operator string() const
|
||||
inline FileNode::operator std::string() const
|
||||
{
|
||||
string value;
|
||||
std::string value;
|
||||
read(*this, value, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
inline void FileNode::readRaw( const string& fmt, uchar* vec, size_t len ) const
|
||||
inline void FileNode::readRaw( const std::string& fmt, uchar* vec, size_t len ) const
|
||||
{
|
||||
begin().readRaw( fmt, vec, len );
|
||||
}
|
||||
@@ -3102,7 +3092,7 @@ template<typename _Tp, int numflag> class CV_EXPORTS VecReaderProxy
|
||||
{
|
||||
public:
|
||||
VecReaderProxy( FileNodeIterator* _it ) : it(_it) {}
|
||||
void operator()(vector<_Tp>& vec, size_t count) const
|
||||
void operator()(std::vector<_Tp>& vec, size_t count) const
|
||||
{
|
||||
count = std::min(count, it->remaining);
|
||||
vec.resize(count);
|
||||
@@ -3116,7 +3106,7 @@ template<typename _Tp> class CV_EXPORTS VecReaderProxy<_Tp,1>
|
||||
{
|
||||
public:
|
||||
VecReaderProxy( FileNodeIterator* _it ) : it(_it) {}
|
||||
void operator()(vector<_Tp>& vec, size_t count) const
|
||||
void operator()(std::vector<_Tp>& vec, size_t count) const
|
||||
{
|
||||
size_t remaining = it->remaining, cn = DataType<_Tp>::channels;
|
||||
int _fmt = DataType<_Tp>::fmt;
|
||||
@@ -3124,20 +3114,20 @@ public:
|
||||
size_t remaining1 = remaining/cn;
|
||||
count = count < remaining1 ? count : remaining1;
|
||||
vec.resize(count);
|
||||
it->readRaw( string(fmt), !vec.empty() ? (uchar*)&vec[0] : 0, count*sizeof(_Tp) );
|
||||
it->readRaw( std::string(fmt), !vec.empty() ? (uchar*)&vec[0] : 0, count*sizeof(_Tp) );
|
||||
}
|
||||
FileNodeIterator* it;
|
||||
};
|
||||
|
||||
template<typename _Tp> static inline void
|
||||
read( FileNodeIterator& it, vector<_Tp>& vec, size_t maxCount=(size_t)INT_MAX )
|
||||
read( FileNodeIterator& it, std::vector<_Tp>& vec, size_t maxCount=(size_t)INT_MAX )
|
||||
{
|
||||
VecReaderProxy<_Tp, DataType<_Tp>::fmt != 0> r(&it);
|
||||
r(vec, maxCount);
|
||||
}
|
||||
|
||||
template<typename _Tp> static inline void
|
||||
read( const FileNode& node, vector<_Tp>& vec, const vector<_Tp>& default_value=vector<_Tp>() )
|
||||
read( const FileNode& node, std::vector<_Tp>& vec, const std::vector<_Tp>& default_value=std::vector<_Tp>() )
|
||||
{
|
||||
if(!node.node)
|
||||
vec = default_value;
|
||||
@@ -3168,7 +3158,7 @@ template<typename _Tp> static inline FileNodeIterator& operator >> (FileNodeIter
|
||||
{ read( *it, value, _Tp()); return ++it; }
|
||||
|
||||
template<typename _Tp> static inline
|
||||
FileNodeIterator& operator >> (FileNodeIterator& it, vector<_Tp>& vec)
|
||||
FileNodeIterator& operator >> (FileNodeIterator& it, std::vector<_Tp>& vec)
|
||||
{
|
||||
VecReaderProxy<_Tp, DataType<_Tp>::fmt != 0> r(&it);
|
||||
r(vec, (size_t)INT_MAX);
|
||||
@@ -3178,7 +3168,7 @@ FileNodeIterator& operator >> (FileNodeIterator& it, vector<_Tp>& vec)
|
||||
template<typename _Tp> static inline void operator >> (const FileNode& n, _Tp& value)
|
||||
{ read( n, value, _Tp()); }
|
||||
|
||||
template<typename _Tp> static inline void operator >> (const FileNode& n, vector<_Tp>& vec)
|
||||
template<typename _Tp> static inline void operator >> (const FileNode& n, std::vector<_Tp>& vec)
|
||||
{ FileNodeIterator it = n.begin(); it >> vec; }
|
||||
|
||||
static inline bool operator == (const FileNodeIterator& it1, const FileNodeIterator& it2)
|
||||
@@ -3264,7 +3254,7 @@ template<typename _Tp> static inline _Tp gcd(_Tp a, _Tp b)
|
||||
|
||||
\****************************************************************************************/
|
||||
|
||||
template<typename _Tp, class _LT> void sort( vector<_Tp>& vec, _LT LT=_LT() )
|
||||
template<typename _Tp, class _LT> void sort( std::vector<_Tp>& vec, _LT LT=_LT() )
|
||||
{
|
||||
int isort_thresh = 7;
|
||||
int sp = 0;
|
||||
@@ -3462,7 +3452,7 @@ public:
|
||||
// The algorithm is described in "Introduction to Algorithms"
|
||||
// by Cormen, Leiserson and Rivest, the chapter "Data structures for disjoint sets"
|
||||
template<typename _Tp, class _EqPredicate> int
|
||||
partition( const vector<_Tp>& _vec, vector<int>& labels,
|
||||
partition( const std::vector<_Tp>& _vec, std::vector<int>& labels,
|
||||
_EqPredicate predicate=_EqPredicate())
|
||||
{
|
||||
int i, j, N = (int)_vec.size();
|
||||
@@ -3471,7 +3461,7 @@ partition( const vector<_Tp>& _vec, vector<int>& labels,
|
||||
const int PARENT=0;
|
||||
const int RANK=1;
|
||||
|
||||
vector<int> _nodes(N*2);
|
||||
std::vector<int> _nodes(N*2);
|
||||
int (*nodes)[2] = (int(*)[2])&_nodes[0];
|
||||
|
||||
// The first O(N) pass: create N single-vertex trees
|
||||
@@ -3667,7 +3657,7 @@ template<typename _Tp> inline void Seq<_Tp>::remove(int idx)
|
||||
template<typename _Tp> inline void Seq<_Tp>::remove(const Range& r)
|
||||
{ seqRemoveSlice(seq, r); }
|
||||
|
||||
template<typename _Tp> inline void Seq<_Tp>::copyTo(vector<_Tp>& vec, const Range& range) const
|
||||
template<typename _Tp> inline void Seq<_Tp>::copyTo(std::vector<_Tp>& vec, const Range& range) const
|
||||
{
|
||||
size_t len = !seq ? 0 : range == Range::all() ? seq->total : range.end - range.start;
|
||||
vec.resize(len);
|
||||
@@ -3675,9 +3665,9 @@ template<typename _Tp> inline void Seq<_Tp>::copyTo(vector<_Tp>& vec, const Rang
|
||||
cvCvtSeqToArray(seq, &vec[0], range);
|
||||
}
|
||||
|
||||
template<typename _Tp> inline Seq<_Tp>::operator vector<_Tp>() const
|
||||
template<typename _Tp> inline Seq<_Tp>::operator std::vector<_Tp>() const
|
||||
{
|
||||
vector<_Tp> vec;
|
||||
std::vector<_Tp> vec;
|
||||
copyTo(vec);
|
||||
return vec;
|
||||
}
|
||||
@@ -3815,7 +3805,7 @@ public:
|
||||
{
|
||||
FileStorage fs(_fs);
|
||||
fs.fs.addref();
|
||||
((const _ClsName*)ptr)->write(fs, string(name));
|
||||
((const _ClsName*)ptr)->write(fs, std::string(name));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3843,28 +3833,28 @@ public:
|
||||
struct CV_EXPORTS Formatted
|
||||
{
|
||||
Formatted(const Mat& m, const Formatter* fmt,
|
||||
const vector<int>& params);
|
||||
const std::vector<int>& params);
|
||||
Formatted(const Mat& m, const Formatter* fmt,
|
||||
const int* params=0);
|
||||
Mat mtx;
|
||||
const Formatter* fmt;
|
||||
vector<int> params;
|
||||
std::vector<int> params;
|
||||
};
|
||||
|
||||
static inline Formatted format(const Mat& mtx, const char* fmt,
|
||||
const vector<int>& params=vector<int>())
|
||||
const std::vector<int>& params=std::vector<int>())
|
||||
{
|
||||
return Formatted(mtx, Formatter::get(fmt), params);
|
||||
}
|
||||
|
||||
template<typename _Tp> static inline Formatted format(const vector<Point_<_Tp> >& vec,
|
||||
const char* fmt, const vector<int>& params=vector<int>())
|
||||
template<typename _Tp> static inline Formatted format(const std::vector<Point_<_Tp> >& vec,
|
||||
const char* fmt, const std::vector<int>& params=std::vector<int>())
|
||||
{
|
||||
return Formatted(Mat(vec), Formatter::get(fmt), params);
|
||||
}
|
||||
|
||||
template<typename _Tp> static inline Formatted format(const vector<Point3_<_Tp> >& vec,
|
||||
const char* fmt, const vector<int>& params=vector<int>())
|
||||
template<typename _Tp> static inline Formatted format(const std::vector<Point3_<_Tp> >& vec,
|
||||
const char* fmt, const std::vector<int>& params=std::vector<int>())
|
||||
{
|
||||
return Formatted(Mat(vec), Formatter::get(fmt), params);
|
||||
}
|
||||
@@ -3897,7 +3887,7 @@ static inline std::ostream& operator << (std::ostream& out, const Formatted& fmt
|
||||
|
||||
|
||||
template<typename _Tp> static inline std::ostream& operator << (std::ostream& out,
|
||||
const vector<Point_<_Tp> >& vec)
|
||||
const std::vector<Point_<_Tp> >& vec)
|
||||
{
|
||||
Formatter::get()->write(out, Mat(vec));
|
||||
return out;
|
||||
@@ -3905,7 +3895,7 @@ template<typename _Tp> static inline std::ostream& operator << (std::ostream& ou
|
||||
|
||||
|
||||
template<typename _Tp> static inline std::ostream& operator << (std::ostream& out,
|
||||
const vector<Point3_<_Tp> >& vec)
|
||||
const std::vector<Point3_<_Tp> >& vec)
|
||||
{
|
||||
Formatter::get()->write(out, Mat(vec));
|
||||
return out;
|
||||
@@ -3977,7 +3967,7 @@ template<typename _Tp> inline std::ostream& operator<<(std::ostream& out, const
|
||||
}
|
||||
|
||||
|
||||
template<typename _Tp> inline Ptr<_Tp> Algorithm::create(const string& name)
|
||||
template<typename _Tp> inline Ptr<_Tp> Algorithm::create(const std::string& name)
|
||||
{
|
||||
return _create(name).ptr<_Tp>();
|
||||
}
|
||||
@@ -3993,7 +3983,7 @@ inline void Algorithm::set(const char* _name, const Ptr<_Tp>& value)
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline void Algorithm::set(const string& _name, const Ptr<_Tp>& value)
|
||||
inline void Algorithm::set(const std::string& _name, const Ptr<_Tp>& value)
|
||||
{
|
||||
this->set<_Tp>(_name.c_str(), value);
|
||||
}
|
||||
@@ -4009,12 +3999,12 @@ inline void Algorithm::setAlgorithm(const char* _name, const Ptr<_Tp>& value)
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline void Algorithm::setAlgorithm(const string& _name, const Ptr<_Tp>& value)
|
||||
inline void Algorithm::setAlgorithm(const std::string& _name, const Ptr<_Tp>& value)
|
||||
{
|
||||
this->set<_Tp>(_name.c_str(), value);
|
||||
}
|
||||
|
||||
template<typename _Tp> inline typename ParamType<_Tp>::member_type Algorithm::get(const string& _name) const
|
||||
template<typename _Tp> inline typename ParamType<_Tp>::member_type Algorithm::get(const std::string& _name) const
|
||||
{
|
||||
typename ParamType<_Tp>::member_type value;
|
||||
info()->get(this, _name.c_str(), ParamType<_Tp>::type, &value);
|
||||
@@ -4030,7 +4020,7 @@ template<typename _Tp> inline typename ParamType<_Tp>::member_type Algorithm::ge
|
||||
|
||||
template<typename _Tp, typename _Base> inline void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
Ptr<_Tp>& value, bool readOnly, Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&),
|
||||
const string& help)
|
||||
const std::string& help)
|
||||
{
|
||||
//TODO: static assert: _Tp inherits from _Base
|
||||
addParam_(algo, parameter, ParamType<_Base>::type, &value, readOnly,
|
||||
@@ -4039,7 +4029,7 @@ template<typename _Tp, typename _Base> inline void AlgorithmInfo::addParam(Algor
|
||||
|
||||
template<typename _Tp> inline void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
Ptr<_Tp>& value, bool readOnly, Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&),
|
||||
const string& help)
|
||||
const std::string& help)
|
||||
{
|
||||
//TODO: static assert: _Tp inherits from Algorithm
|
||||
addParam_(algo, parameter, ParamType<Algorithm>::type, &value, readOnly,
|
||||
|
@@ -45,8 +45,6 @@
|
||||
namespace cv
|
||||
{
|
||||
|
||||
using std::pair;
|
||||
|
||||
template<typename _KeyTp, typename _ValueTp> struct sorted_vector
|
||||
{
|
||||
sorted_vector() {}
|
||||
@@ -57,7 +55,7 @@ template<typename _KeyTp, typename _ValueTp> struct sorted_vector
|
||||
|
||||
void add(const _KeyTp& k, const _ValueTp& val)
|
||||
{
|
||||
pair<_KeyTp, _ValueTp> p(k, val);
|
||||
std::pair<_KeyTp, _ValueTp> p(k, val);
|
||||
vec.push_back(p);
|
||||
size_t i = vec.size()-1;
|
||||
for( ; i > 0 && vec[i].first < vec[i-1].first; i-- )
|
||||
@@ -85,7 +83,7 @@ template<typename _KeyTp, typename _ValueTp> struct sorted_vector
|
||||
return false;
|
||||
}
|
||||
|
||||
void get_keys(vector<_KeyTp>& keys) const
|
||||
void get_keys(std::vector<_KeyTp>& keys) const
|
||||
{
|
||||
size_t i = 0, n = vec.size();
|
||||
keys.resize(n);
|
||||
@@ -94,11 +92,11 @@ template<typename _KeyTp, typename _ValueTp> struct sorted_vector
|
||||
keys[i] = vec[i].first;
|
||||
}
|
||||
|
||||
vector<pair<_KeyTp, _ValueTp> > vec;
|
||||
std::vector<std::pair<_KeyTp, _ValueTp> > vec;
|
||||
};
|
||||
|
||||
|
||||
template<typename _ValueTp> inline const _ValueTp* findstr(const sorted_vector<string, _ValueTp>& vec,
|
||||
template<typename _ValueTp> inline const _ValueTp* findstr(const sorted_vector<std::string, _ValueTp>& vec,
|
||||
const char* key)
|
||||
{
|
||||
if( !key )
|
||||
@@ -132,7 +130,7 @@ Param::Param()
|
||||
|
||||
Param::Param(int _type, bool _readonly, int _offset,
|
||||
Algorithm::Getter _getter, Algorithm::Setter _setter,
|
||||
const string& _help)
|
||||
const std::string& _help)
|
||||
{
|
||||
type = _type;
|
||||
readonly = _readonly;
|
||||
@@ -144,23 +142,23 @@ Param::Param(int _type, bool _readonly, int _offset,
|
||||
|
||||
struct CV_EXPORTS AlgorithmInfoData
|
||||
{
|
||||
sorted_vector<string, Param> params;
|
||||
string _name;
|
||||
sorted_vector<std::string, Param> params;
|
||||
std::string _name;
|
||||
};
|
||||
|
||||
|
||||
static sorted_vector<string, Algorithm::Constructor>& alglist()
|
||||
static sorted_vector<std::string, Algorithm::Constructor>& alglist()
|
||||
{
|
||||
static sorted_vector<string, Algorithm::Constructor> alglist_var;
|
||||
static sorted_vector<std::string, Algorithm::Constructor> alglist_var;
|
||||
return alglist_var;
|
||||
}
|
||||
|
||||
void Algorithm::getList(vector<string>& algorithms)
|
||||
void Algorithm::getList(std::vector<std::string>& algorithms)
|
||||
{
|
||||
alglist().get_keys(algorithms);
|
||||
}
|
||||
|
||||
Ptr<Algorithm> Algorithm::_create(const string& name)
|
||||
Ptr<Algorithm> Algorithm::_create(const std::string& name)
|
||||
{
|
||||
Algorithm::Constructor c = 0;
|
||||
if( !alglist().find(name, c) )
|
||||
@@ -176,42 +174,42 @@ Algorithm::~Algorithm()
|
||||
{
|
||||
}
|
||||
|
||||
string Algorithm::name() const
|
||||
std::string Algorithm::name() const
|
||||
{
|
||||
return info()->name();
|
||||
}
|
||||
|
||||
void Algorithm::set(const string& parameter, int value)
|
||||
void Algorithm::set(const std::string& parameter, int value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<int>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::set(const string& parameter, double value)
|
||||
void Algorithm::set(const std::string& parameter, double value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<double>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::set(const string& parameter, bool value)
|
||||
void Algorithm::set(const std::string& parameter, bool value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<bool>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::set(const string& parameter, const string& value)
|
||||
void Algorithm::set(const std::string& parameter, const std::string& value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<string>::type, &value);
|
||||
info()->set(this, parameter.c_str(), ParamType<std::string>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::set(const string& parameter, const Mat& value)
|
||||
void Algorithm::set(const std::string& parameter, const Mat& value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<Mat>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::set(const string& parameter, const vector<Mat>& value)
|
||||
void Algorithm::set(const std::string& parameter, const std::vector<Mat>& value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<vector<Mat> >::type, &value);
|
||||
info()->set(this, parameter.c_str(), ParamType<std::vector<Mat> >::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::set(const string& parameter, const Ptr<Algorithm>& value)
|
||||
void Algorithm::set(const std::string& parameter, const Ptr<Algorithm>& value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<Algorithm>::type, &value);
|
||||
}
|
||||
@@ -231,9 +229,9 @@ void Algorithm::set(const char* parameter, bool value)
|
||||
info()->set(this, parameter, ParamType<bool>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::set(const char* parameter, const string& value)
|
||||
void Algorithm::set(const char* parameter, const std::string& value)
|
||||
{
|
||||
info()->set(this, parameter, ParamType<string>::type, &value);
|
||||
info()->set(this, parameter, ParamType<std::string>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::set(const char* parameter, const Mat& value)
|
||||
@@ -241,9 +239,9 @@ void Algorithm::set(const char* parameter, const Mat& value)
|
||||
info()->set(this, parameter, ParamType<Mat>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::set(const char* parameter, const vector<Mat>& value)
|
||||
void Algorithm::set(const char* parameter, const std::vector<Mat>& value)
|
||||
{
|
||||
info()->set(this, parameter, ParamType<vector<Mat> >::type, &value);
|
||||
info()->set(this, parameter, ParamType<std::vector<Mat> >::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::set(const char* parameter, const Ptr<Algorithm>& value)
|
||||
@@ -252,37 +250,37 @@ void Algorithm::set(const char* parameter, const Ptr<Algorithm>& value)
|
||||
}
|
||||
|
||||
|
||||
void Algorithm::setInt(const string& parameter, int value)
|
||||
void Algorithm::setInt(const std::string& parameter, int value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<int>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::setDouble(const string& parameter, double value)
|
||||
void Algorithm::setDouble(const std::string& parameter, double value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<double>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::setBool(const string& parameter, bool value)
|
||||
void Algorithm::setBool(const std::string& parameter, bool value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<bool>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::setString(const string& parameter, const string& value)
|
||||
void Algorithm::setString(const std::string& parameter, const std::string& value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<string>::type, &value);
|
||||
info()->set(this, parameter.c_str(), ParamType<std::string>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::setMat(const string& parameter, const Mat& value)
|
||||
void Algorithm::setMat(const std::string& parameter, const Mat& value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<Mat>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::setMatVector(const string& parameter, const vector<Mat>& value)
|
||||
void Algorithm::setMatVector(const std::string& parameter, const std::vector<Mat>& value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<vector<Mat> >::type, &value);
|
||||
info()->set(this, parameter.c_str(), ParamType<std::vector<Mat> >::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::setAlgorithm(const string& parameter, const Ptr<Algorithm>& value)
|
||||
void Algorithm::setAlgorithm(const std::string& parameter, const Ptr<Algorithm>& value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<Algorithm>::type, &value);
|
||||
}
|
||||
@@ -302,9 +300,9 @@ void Algorithm::setBool(const char* parameter, bool value)
|
||||
info()->set(this, parameter, ParamType<bool>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::setString(const char* parameter, const string& value)
|
||||
void Algorithm::setString(const char* parameter, const std::string& value)
|
||||
{
|
||||
info()->set(this, parameter, ParamType<string>::type, &value);
|
||||
info()->set(this, parameter, ParamType<std::string>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::setMat(const char* parameter, const Mat& value)
|
||||
@@ -312,9 +310,9 @@ void Algorithm::setMat(const char* parameter, const Mat& value)
|
||||
info()->set(this, parameter, ParamType<Mat>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::setMatVector(const char* parameter, const vector<Mat>& value)
|
||||
void Algorithm::setMatVector(const char* parameter, const std::vector<Mat>& value)
|
||||
{
|
||||
info()->set(this, parameter, ParamType<vector<Mat> >::type, &value);
|
||||
info()->set(this, parameter, ParamType<std::vector<Mat> >::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::setAlgorithm(const char* parameter, const Ptr<Algorithm>& value)
|
||||
@@ -324,47 +322,47 @@ void Algorithm::setAlgorithm(const char* parameter, const Ptr<Algorithm>& value)
|
||||
|
||||
|
||||
|
||||
int Algorithm::getInt(const string& parameter) const
|
||||
int Algorithm::getInt(const std::string& parameter) const
|
||||
{
|
||||
return get<int>(parameter);
|
||||
}
|
||||
|
||||
double Algorithm::getDouble(const string& parameter) const
|
||||
double Algorithm::getDouble(const std::string& parameter) const
|
||||
{
|
||||
return get<double>(parameter);
|
||||
}
|
||||
|
||||
bool Algorithm::getBool(const string& parameter) const
|
||||
bool Algorithm::getBool(const std::string& parameter) const
|
||||
{
|
||||
return get<bool>(parameter);
|
||||
}
|
||||
|
||||
string Algorithm::getString(const string& parameter) const
|
||||
std::string Algorithm::getString(const std::string& parameter) const
|
||||
{
|
||||
return get<string>(parameter);
|
||||
return get<std::string>(parameter);
|
||||
}
|
||||
|
||||
Mat Algorithm::getMat(const string& parameter) const
|
||||
Mat Algorithm::getMat(const std::string& parameter) const
|
||||
{
|
||||
return get<Mat>(parameter);
|
||||
}
|
||||
|
||||
vector<Mat> Algorithm::getMatVector(const string& parameter) const
|
||||
std::vector<Mat> Algorithm::getMatVector(const std::string& parameter) const
|
||||
{
|
||||
return get<vector<Mat> >(parameter);
|
||||
return get<std::vector<Mat> >(parameter);
|
||||
}
|
||||
|
||||
Ptr<Algorithm> Algorithm::getAlgorithm(const string& parameter) const
|
||||
Ptr<Algorithm> Algorithm::getAlgorithm(const std::string& parameter) const
|
||||
{
|
||||
return get<Algorithm>(parameter);
|
||||
}
|
||||
|
||||
string Algorithm::paramHelp(const string& parameter) const
|
||||
std::string Algorithm::paramHelp(const std::string& parameter) const
|
||||
{
|
||||
return info()->paramHelp(parameter.c_str());
|
||||
}
|
||||
|
||||
int Algorithm::paramType(const string& parameter) const
|
||||
int Algorithm::paramType(const std::string& parameter) const
|
||||
{
|
||||
return info()->paramType(parameter.c_str());
|
||||
}
|
||||
@@ -374,7 +372,7 @@ int Algorithm::paramType(const char* parameter) const
|
||||
return info()->paramType(parameter);
|
||||
}
|
||||
|
||||
void Algorithm::getParams(vector<string>& names) const
|
||||
void Algorithm::getParams(std::vector<std::string>& names) const
|
||||
{
|
||||
info()->getParams(names);
|
||||
}
|
||||
@@ -390,7 +388,7 @@ void Algorithm::read(const FileNode& fn)
|
||||
}
|
||||
|
||||
|
||||
AlgorithmInfo::AlgorithmInfo(const string& _name, Algorithm::Constructor create)
|
||||
AlgorithmInfo::AlgorithmInfo(const std::string& _name, Algorithm::Constructor create)
|
||||
{
|
||||
data = new AlgorithmInfoData;
|
||||
data->_name = _name;
|
||||
@@ -410,7 +408,7 @@ void AlgorithmInfo::write(const Algorithm* algo, FileStorage& fs) const
|
||||
for( i = 0; i < nparams; i++ )
|
||||
{
|
||||
const Param& p = data->params.vec[i].second;
|
||||
const string& pname = data->params.vec[i].first;
|
||||
const std::string& pname = data->params.vec[i].first;
|
||||
if( p.type == Param::INT )
|
||||
cv::write(fs, pname, algo->get<int>(pname));
|
||||
else if( p.type == Param::BOOLEAN )
|
||||
@@ -418,11 +416,11 @@ void AlgorithmInfo::write(const Algorithm* algo, FileStorage& fs) const
|
||||
else if( p.type == Param::REAL )
|
||||
cv::write(fs, pname, algo->get<double>(pname));
|
||||
else if( p.type == Param::STRING )
|
||||
cv::write(fs, pname, algo->get<string>(pname));
|
||||
cv::write(fs, pname, algo->get<std::string>(pname));
|
||||
else if( p.type == Param::MAT )
|
||||
cv::write(fs, pname, algo->get<Mat>(pname));
|
||||
else if( p.type == Param::MAT_VECTOR )
|
||||
cv::write(fs, pname, algo->get<vector<Mat> >(pname));
|
||||
cv::write(fs, pname, algo->get<std::vector<Mat> >(pname));
|
||||
else if( p.type == Param::ALGORITHM )
|
||||
{
|
||||
WriteStructContext ws(fs, pname, CV_NODE_MAP);
|
||||
@@ -431,7 +429,7 @@ void AlgorithmInfo::write(const Algorithm* algo, FileStorage& fs) const
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = format("unknown/unsupported type of '%s' parameter == %d", pname.c_str(), p.type);
|
||||
std::string msg = format("unknown/unsupported type of '%s' parameter == %d", pname.c_str(), p.type);
|
||||
CV_Error( CV_StsUnsupportedFormat, msg.c_str());
|
||||
}
|
||||
}
|
||||
@@ -445,7 +443,7 @@ void AlgorithmInfo::read(Algorithm* algo, const FileNode& fn) const
|
||||
for( i = 0; i < nparams; i++ )
|
||||
{
|
||||
const Param& p = data->params.vec[i].second;
|
||||
const string& pname = data->params.vec[i].first;
|
||||
const std::string& pname = data->params.vec[i].first;
|
||||
const FileNode n = fn[pname];
|
||||
if( n.empty() )
|
||||
continue;
|
||||
@@ -466,7 +464,7 @@ void AlgorithmInfo::read(Algorithm* algo, const FileNode& fn) const
|
||||
}
|
||||
else if( p.type == Param::STRING )
|
||||
{
|
||||
string val = (string)n;
|
||||
std::string val = (std::string)n;
|
||||
info->set(algo, pname.c_str(), p.type, &val, true);
|
||||
}
|
||||
else if( p.type == Param::MAT )
|
||||
@@ -477,26 +475,26 @@ void AlgorithmInfo::read(Algorithm* algo, const FileNode& fn) const
|
||||
}
|
||||
else if( p.type == Param::MAT_VECTOR )
|
||||
{
|
||||
vector<Mat> mv;
|
||||
std::vector<Mat> mv;
|
||||
cv::read(n, mv);
|
||||
info->set(algo, pname.c_str(), p.type, &mv, true);
|
||||
}
|
||||
else if( p.type == Param::ALGORITHM )
|
||||
{
|
||||
Ptr<Algorithm> nestedAlgo = Algorithm::_create((string)n["name"]);
|
||||
Ptr<Algorithm> nestedAlgo = Algorithm::_create((std::string)n["name"]);
|
||||
CV_Assert( !nestedAlgo.empty() );
|
||||
nestedAlgo->read(n);
|
||||
info->set(algo, pname.c_str(), p.type, &nestedAlgo, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = format("unknown/unsupported type of '%s' parameter == %d", pname.c_str(), p.type);
|
||||
std::string msg = format("unknown/unsupported type of '%s' parameter == %d", pname.c_str(), p.type);
|
||||
CV_Error( CV_StsUnsupportedFormat, msg.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string AlgorithmInfo::name() const
|
||||
std::string AlgorithmInfo::name() const
|
||||
{
|
||||
return data->_name;
|
||||
}
|
||||
@@ -506,23 +504,23 @@ union GetSetParam
|
||||
int (Algorithm::*get_int)() const;
|
||||
bool (Algorithm::*get_bool)() const;
|
||||
double (Algorithm::*get_double)() const;
|
||||
string (Algorithm::*get_string)() const;
|
||||
std::string (Algorithm::*get_string)() const;
|
||||
Mat (Algorithm::*get_mat)() const;
|
||||
vector<Mat> (Algorithm::*get_mat_vector)() const;
|
||||
std::vector<Mat> (Algorithm::*get_mat_vector)() const;
|
||||
Ptr<Algorithm> (Algorithm::*get_algo)() const;
|
||||
|
||||
void (Algorithm::*set_int)(int);
|
||||
void (Algorithm::*set_bool)(bool);
|
||||
void (Algorithm::*set_double)(double);
|
||||
void (Algorithm::*set_string)(const string&);
|
||||
void (Algorithm::*set_string)(const std::string&);
|
||||
void (Algorithm::*set_mat)(const Mat&);
|
||||
void (Algorithm::*set_mat_vector)(const vector<Mat>&);
|
||||
void (Algorithm::*set_mat_vector)(const std::vector<Mat>&);
|
||||
void (Algorithm::*set_algo)(const Ptr<Algorithm>&);
|
||||
};
|
||||
|
||||
static string getNameOfType(int argType);
|
||||
static std::string getNameOfType(int argType);
|
||||
|
||||
static string getNameOfType(int argType)
|
||||
static std::string getNameOfType(int argType)
|
||||
{
|
||||
switch(argType)
|
||||
{
|
||||
@@ -537,10 +535,10 @@ static string getNameOfType(int argType)
|
||||
}
|
||||
return "";
|
||||
}
|
||||
static string getErrorMessageForWrongArgumentInSetter(string algoName, string paramName, int paramType, int argType);
|
||||
static string getErrorMessageForWrongArgumentInSetter(string algoName, string paramName, int paramType, int argType)
|
||||
|
||||
static std::string getErrorMessageForWrongArgumentInSetter(std::string algoName, std::string paramName, int paramType, int argType)
|
||||
{
|
||||
string message = string("Argument error: the setter")
|
||||
std::string message = std::string("Argument error: the setter")
|
||||
+ " method was called for the parameter '" + paramName + "' of the algorithm '" + algoName
|
||||
+"', the parameter has " + getNameOfType(paramType) + " type, ";
|
||||
|
||||
@@ -553,10 +551,9 @@ static string getErrorMessageForWrongArgumentInSetter(string algoName, string pa
|
||||
return message;
|
||||
}
|
||||
|
||||
static string getErrorMessageForWrongArgumentInGetter(string algoName, string paramName, int paramType, int argType);
|
||||
static string getErrorMessageForWrongArgumentInGetter(string algoName, string paramName, int paramType, int argType)
|
||||
static std::string getErrorMessageForWrongArgumentInGetter(std::string algoName, std::string paramName, int paramType, int argType)
|
||||
{
|
||||
string message = string("Argument error: the getter")
|
||||
std::string message = std::string("Argument error: the getter")
|
||||
+ " method was called for the parameter '" + paramName + "' of the algorithm '" + algoName
|
||||
+"', the parameter has " + getNameOfType(paramType) + " type, ";
|
||||
|
||||
@@ -590,7 +587,7 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con
|
||||
{
|
||||
if ( !( p->type == Param::INT || p->type == Param::REAL || p->type == Param::BOOLEAN) )
|
||||
{
|
||||
string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
std::string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
|
||||
@@ -629,21 +626,21 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con
|
||||
{
|
||||
if( p->type != Param::STRING )
|
||||
{
|
||||
string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
std::string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
|
||||
const string& val = *(const string*)value;
|
||||
const std::string& val = *(const std::string*)value;
|
||||
if( p->setter )
|
||||
(algo->*f.set_string)(val);
|
||||
else
|
||||
*(string*)((uchar*)algo + p->offset) = val;
|
||||
*(std::string*)((uchar*)algo + p->offset) = val;
|
||||
}
|
||||
else if( argType == Param::MAT )
|
||||
{
|
||||
if( p->type != Param::MAT )
|
||||
{
|
||||
string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
std::string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
|
||||
@@ -657,21 +654,21 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con
|
||||
{
|
||||
if( p->type != Param::MAT_VECTOR )
|
||||
{
|
||||
string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
std::string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
|
||||
const vector<Mat>& val = *(const vector<Mat>*)value;
|
||||
const std::vector<Mat>& val = *(const std::vector<Mat>*)value;
|
||||
if( p->setter )
|
||||
(algo->*f.set_mat_vector)(val);
|
||||
else
|
||||
*(vector<Mat>*)((uchar*)algo + p->offset) = val;
|
||||
*(std::vector<Mat>*)((uchar*)algo + p->offset) = val;
|
||||
}
|
||||
else if( argType == Param::ALGORITHM )
|
||||
{
|
||||
if( p->type != Param::ALGORITHM )
|
||||
{
|
||||
string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
std::string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
|
||||
@@ -700,7 +697,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
|
||||
{
|
||||
if (!( argType == Param::INT || argType == Param::REAL ))
|
||||
{
|
||||
string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
std::string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
int val = p->getter ? (algo->*f.get_int)() : *(int*)((uchar*)algo + p->offset);
|
||||
@@ -714,7 +711,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
|
||||
{
|
||||
if (!( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL ))
|
||||
{
|
||||
string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
std::string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
bool val = p->getter ? (algo->*f.get_bool)() : *(bool*)((uchar*)algo + p->offset);
|
||||
@@ -730,7 +727,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
|
||||
{
|
||||
if( argType != Param::REAL )
|
||||
{
|
||||
string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
std::string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
double val = p->getter ? (algo->*f.get_double)() : *(double*)((uchar*)algo + p->offset);
|
||||
@@ -742,18 +739,18 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
|
||||
{
|
||||
if( p->type != Param::STRING )
|
||||
{
|
||||
string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
std::string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
|
||||
*(string*)value = p->getter ? (algo->*f.get_string)() :
|
||||
*(string*)((uchar*)algo + p->offset);
|
||||
*(std::string*)value = p->getter ? (algo->*f.get_string)() :
|
||||
*(std::string*)((uchar*)algo + p->offset);
|
||||
}
|
||||
else if( argType == Param::MAT )
|
||||
{
|
||||
if( p->type != Param::MAT )
|
||||
{
|
||||
string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
std::string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
|
||||
@@ -764,18 +761,18 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
|
||||
{
|
||||
if( p->type != Param::MAT_VECTOR )
|
||||
{
|
||||
string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
std::string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
|
||||
*(vector<Mat>*)value = p->getter ? (algo->*f.get_mat_vector)() :
|
||||
*(vector<Mat>*)((uchar*)algo + p->offset);
|
||||
*(std::vector<Mat>*)value = p->getter ? (algo->*f.get_mat_vector)() :
|
||||
*(std::vector<Mat>*)((uchar*)algo + p->offset);
|
||||
}
|
||||
else if( argType == Param::ALGORITHM )
|
||||
{
|
||||
if( p->type != Param::ALGORITHM )
|
||||
{
|
||||
string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
std::string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
|
||||
@@ -784,7 +781,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
|
||||
}
|
||||
else
|
||||
{
|
||||
string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
std::string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
}
|
||||
@@ -799,7 +796,7 @@ int AlgorithmInfo::paramType(const char* parameter) const
|
||||
}
|
||||
|
||||
|
||||
string AlgorithmInfo::paramHelp(const char* parameter) const
|
||||
std::string AlgorithmInfo::paramHelp(const char* parameter) const
|
||||
{
|
||||
const Param* p = findstr(data->params, parameter);
|
||||
if( !p )
|
||||
@@ -808,7 +805,7 @@ string AlgorithmInfo::paramHelp(const char* parameter) const
|
||||
}
|
||||
|
||||
|
||||
void AlgorithmInfo::getParams(vector<string>& names) const
|
||||
void AlgorithmInfo::getParams(std::vector<std::string>& names) const
|
||||
{
|
||||
data->params.get_keys(names);
|
||||
}
|
||||
@@ -817,13 +814,13 @@ void AlgorithmInfo::getParams(vector<string>& names) const
|
||||
void AlgorithmInfo::addParam_(Algorithm& algo, const char* parameter, int argType,
|
||||
void* value, bool readOnly,
|
||||
Algorithm::Getter getter, Algorithm::Setter setter,
|
||||
const string& help)
|
||||
const std::string& help)
|
||||
{
|
||||
CV_Assert( argType == Param::INT || argType == Param::BOOLEAN ||
|
||||
argType == Param::REAL || argType == Param::STRING ||
|
||||
argType == Param::MAT || argType == Param::MAT_VECTOR ||
|
||||
argType == Param::ALGORITHM );
|
||||
data->params.add(string(parameter), Param(argType, readOnly,
|
||||
data->params.add(std::string(parameter), Param(argType, readOnly,
|
||||
(int)((size_t)value - (size_t)(void*)&algo),
|
||||
getter, setter, help));
|
||||
}
|
||||
@@ -833,7 +830,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
int& value, bool readOnly,
|
||||
int (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(int),
|
||||
const string& help)
|
||||
const std::string& help)
|
||||
{
|
||||
addParam_(algo, parameter, ParamType<int>::type, &value, readOnly,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
@@ -843,7 +840,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
bool& value, bool readOnly,
|
||||
int (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(int),
|
||||
const string& help)
|
||||
const std::string& help)
|
||||
{
|
||||
addParam_(algo, parameter, ParamType<bool>::type, &value, readOnly,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
@@ -853,19 +850,19 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
double& value, bool readOnly,
|
||||
double (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(double),
|
||||
const string& help)
|
||||
const std::string& help)
|
||||
{
|
||||
addParam_(algo, parameter, ParamType<double>::type, &value, readOnly,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
}
|
||||
|
||||
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
string& value, bool readOnly,
|
||||
string (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(const string&),
|
||||
const string& help)
|
||||
std::string& value, bool readOnly,
|
||||
std::string (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(const std::string&),
|
||||
const std::string& help)
|
||||
{
|
||||
addParam_(algo, parameter, ParamType<string>::type, &value, readOnly,
|
||||
addParam_(algo, parameter, ParamType<std::string>::type, &value, readOnly,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
}
|
||||
|
||||
@@ -873,19 +870,19 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
Mat& value, bool readOnly,
|
||||
Mat (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(const Mat&),
|
||||
const string& help)
|
||||
const std::string& help)
|
||||
{
|
||||
addParam_(algo, parameter, ParamType<Mat>::type, &value, readOnly,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
}
|
||||
|
||||
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
vector<Mat>& value, bool readOnly,
|
||||
vector<Mat> (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(const vector<Mat>&),
|
||||
const string& help)
|
||||
std::vector<Mat>& value, bool readOnly,
|
||||
std::vector<Mat> (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(const std::vector<Mat>&),
|
||||
const std::string& help)
|
||||
{
|
||||
addParam_(algo, parameter, ParamType<vector<Mat> >::type, &value, readOnly,
|
||||
addParam_(algo, parameter, ParamType<std::vector<Mat> >::type, &value, readOnly,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
}
|
||||
|
||||
@@ -893,7 +890,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
Ptr<Algorithm>& value, bool readOnly,
|
||||
Ptr<Algorithm> (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(const Ptr<Algorithm>&),
|
||||
const string& help)
|
||||
const std::string& help)
|
||||
{
|
||||
addParam_(algo, parameter, ParamType<Algorithm>::type, &value, readOnly,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
|
@@ -9,9 +9,9 @@ namespace cv
|
||||
struct CommandLineParserParams
|
||||
{
|
||||
public:
|
||||
string help_message;
|
||||
string def_value;
|
||||
vector<string> keys;
|
||||
std::string help_message;
|
||||
std::string def_value;
|
||||
std::vector<std::string> keys;
|
||||
int number;
|
||||
};
|
||||
|
||||
@@ -19,27 +19,27 @@ public:
|
||||
struct CommandLineParser::Impl
|
||||
{
|
||||
bool error;
|
||||
string error_message;
|
||||
string about_message;
|
||||
std::string error_message;
|
||||
std::string about_message;
|
||||
|
||||
string path_to_app;
|
||||
string app_name;
|
||||
std::string path_to_app;
|
||||
std::string app_name;
|
||||
|
||||
vector<CommandLineParserParams> data;
|
||||
std::vector<CommandLineParserParams> data;
|
||||
|
||||
vector<string> split_range_string(const string& str, char fs, char ss) const;
|
||||
vector<string> split_string(const string& str, char symbol = ' ', bool create_empty_item = false) const;
|
||||
string cat_string(const string& str) const;
|
||||
std::vector<std::string> split_range_string(const std::string& str, char fs, char ss) const;
|
||||
std::vector<std::string> split_string(const std::string& str, char symbol = ' ', bool create_empty_item = false) const;
|
||||
std::string cat_string(const std::string& str) const;
|
||||
|
||||
void apply_params(const string& key, const string& value);
|
||||
void apply_params(int i, string value);
|
||||
void apply_params(const std::string& key, const std::string& value);
|
||||
void apply_params(int i, std::string value);
|
||||
|
||||
void sort_params();
|
||||
int refcount;
|
||||
};
|
||||
|
||||
|
||||
static string get_type_name(int type)
|
||||
static std::string get_type_name(int type)
|
||||
{
|
||||
if( type == Param::INT )
|
||||
return "int";
|
||||
@@ -56,7 +56,7 @@ static string get_type_name(int type)
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
static void from_str(const string& str, int type, void* dst)
|
||||
static void from_str(const std::string& str, int type, void* dst)
|
||||
{
|
||||
std::stringstream ss(str);
|
||||
if( type == Param::INT )
|
||||
@@ -70,20 +70,20 @@ static void from_str(const string& str, int type, void* dst)
|
||||
else if( type == Param::REAL )
|
||||
ss >> *(double*)dst;
|
||||
else if( type == Param::STRING )
|
||||
*(string*)dst = str;
|
||||
*(std::string*)dst = str;
|
||||
else
|
||||
throw cv::Exception(CV_StsBadArg, "unknown/unsupported parameter type", "", __FILE__, __LINE__);
|
||||
|
||||
if (ss.fail())
|
||||
{
|
||||
string err_msg = "can not convert: [" + str +
|
||||
std::string err_msg = "can not convert: [" + str +
|
||||
+ "] to [" + get_type_name(type) + "]";
|
||||
|
||||
throw cv::Exception(CV_StsBadArg, err_msg, "", __FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
|
||||
void CommandLineParser::getByName(const string& name, bool space_delete, int type, void* dst) const
|
||||
void CommandLineParser::getByName(const std::string& name, bool space_delete, int type, void* dst) const
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -93,7 +93,7 @@ void CommandLineParser::getByName(const string& name, bool space_delete, int typ
|
||||
{
|
||||
if (name.compare(impl->data[i].keys[j]) == 0)
|
||||
{
|
||||
string v = impl->data[i].def_value;
|
||||
std::string v = impl->data[i].def_value;
|
||||
if (space_delete)
|
||||
v = impl->cat_string(v);
|
||||
from_str(v, type, dst);
|
||||
@@ -107,7 +107,7 @@ void CommandLineParser::getByName(const string& name, bool space_delete, int typ
|
||||
catch (std::exception& e)
|
||||
{
|
||||
impl->error = true;
|
||||
impl->error_message += "Exception: " + string(e.what()) + "\n";
|
||||
impl->error_message += "Exception: " + std::string(e.what()) + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ void CommandLineParser::getByIndex(int index, bool space_delete, int type, void*
|
||||
{
|
||||
if (impl->data[i].number == index)
|
||||
{
|
||||
string v = impl->data[i].def_value;
|
||||
std::string v = impl->data[i].def_value;
|
||||
if (space_delete == true) v = impl->cat_string(v);
|
||||
from_str(v, type, dst);
|
||||
return;
|
||||
@@ -132,7 +132,7 @@ void CommandLineParser::getByIndex(int index, bool space_delete, int type, void*
|
||||
catch(std::exception & e)
|
||||
{
|
||||
impl->error = true;
|
||||
impl->error_message += "Exception: " + string(e.what()) + "\n";
|
||||
impl->error_message += "Exception: " + std::string(e.what()) + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,34 +152,34 @@ static bool cmp_params(const CommandLineParserParams & p1, const CommandLinePars
|
||||
return true;
|
||||
}
|
||||
|
||||
CommandLineParser::CommandLineParser(int argc, const char* const argv[], const string& keys)
|
||||
CommandLineParser::CommandLineParser(int argc, const char* const argv[], const std::string& keys)
|
||||
{
|
||||
impl = new Impl;
|
||||
impl->refcount = 1;
|
||||
|
||||
// path to application
|
||||
size_t pos_s = string(argv[0]).find_last_of("/\\");
|
||||
if (pos_s == string::npos)
|
||||
size_t pos_s = std::string(argv[0]).find_last_of("/\\");
|
||||
if (pos_s == std::string::npos)
|
||||
{
|
||||
impl->path_to_app = "";
|
||||
impl->app_name = string(argv[0]);
|
||||
impl->app_name = std::string(argv[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
impl->path_to_app = string(argv[0]).substr(0, pos_s);
|
||||
impl->app_name = string(argv[0]).substr(pos_s + 1, string(argv[0]).length() - pos_s);
|
||||
impl->path_to_app = std::string(argv[0]).substr(0, pos_s);
|
||||
impl->app_name = std::string(argv[0]).substr(pos_s + 1, std::string(argv[0]).length() - pos_s);
|
||||
}
|
||||
|
||||
impl->error = false;
|
||||
impl->error_message = "";
|
||||
|
||||
// parse keys
|
||||
vector<string> k = impl->split_range_string(keys, '{', '}');
|
||||
std::vector<std::string> k = impl->split_range_string(keys, '{', '}');
|
||||
|
||||
int jj = 0;
|
||||
for (size_t i = 0; i < k.size(); i++)
|
||||
{
|
||||
vector<string> l = impl->split_string(k[i], '|', true);
|
||||
std::vector<std::string> l = impl->split_string(k[i], '|', true);
|
||||
CommandLineParserParams p;
|
||||
p.keys = impl->split_string(l[0]);
|
||||
p.def_value = l[1];
|
||||
@@ -206,11 +206,11 @@ CommandLineParser::CommandLineParser(int argc, const char* const argv[], const s
|
||||
jj = 0;
|
||||
for (int i = 1; i < argc; i++)
|
||||
{
|
||||
string s = string(argv[i]);
|
||||
std::string s = std::string(argv[i]);
|
||||
|
||||
if (s.find('=') != string::npos && s.find('=') < s.length())
|
||||
if (s.find('=') != std::string::npos && s.find('=') < s.length())
|
||||
{
|
||||
vector<string> k_v = impl->split_string(s, '=', true);
|
||||
std::vector<std::string> k_v = impl->split_string(s, '=', true);
|
||||
for (int h = 0; h < 2; h++)
|
||||
{
|
||||
if (k_v[0][0] == '-')
|
||||
@@ -256,12 +256,12 @@ CommandLineParser& CommandLineParser::operator = (const CommandLineParser& parse
|
||||
return *this;
|
||||
}
|
||||
|
||||
void CommandLineParser::about(const string& message)
|
||||
void CommandLineParser::about(const std::string& message)
|
||||
{
|
||||
impl->about_message = message;
|
||||
}
|
||||
|
||||
void CommandLineParser::Impl::apply_params(const string& key, const string& value)
|
||||
void CommandLineParser::Impl::apply_params(const std::string& key, const std::string& value)
|
||||
{
|
||||
for (size_t i = 0; i < data.size(); i++)
|
||||
{
|
||||
@@ -276,7 +276,7 @@ void CommandLineParser::Impl::apply_params(const string& key, const string& valu
|
||||
}
|
||||
}
|
||||
|
||||
void CommandLineParser::Impl::apply_params(int i, string value)
|
||||
void CommandLineParser::Impl::apply_params(int i, std::string value)
|
||||
{
|
||||
for (size_t j = 0; j < data.size(); j++)
|
||||
{
|
||||
@@ -298,28 +298,28 @@ void CommandLineParser::Impl::sort_params()
|
||||
std::sort (data.begin(), data.end(), cmp_params);
|
||||
}
|
||||
|
||||
string CommandLineParser::Impl::cat_string(const string& str) const
|
||||
std::string CommandLineParser::Impl::cat_string(const std::string& str) const
|
||||
{
|
||||
int left = 0, right = (int)str.length();
|
||||
while( left <= right && str[left] == ' ' )
|
||||
left++;
|
||||
while( right > left && str[right-1] == ' ' )
|
||||
right--;
|
||||
return left >= right ? string("") : str.substr(left, right-left);
|
||||
return left >= right ? std::string("") : str.substr(left, right-left);
|
||||
}
|
||||
|
||||
string CommandLineParser::getPathToApplication() const
|
||||
std::string CommandLineParser::getPathToApplication() const
|
||||
{
|
||||
return impl->path_to_app;
|
||||
}
|
||||
|
||||
bool CommandLineParser::has(const string& name) const
|
||||
bool CommandLineParser::has(const std::string& name) const
|
||||
{
|
||||
for (size_t i = 0; i < impl->data.size(); i++)
|
||||
{
|
||||
for (size_t j = 0; j < impl->data[i].keys.size(); j++)
|
||||
{
|
||||
if (name.compare(impl->data[i].keys[j]) == 0 && string("true").compare(impl->data[i].def_value) == 0)
|
||||
if (name.compare(impl->data[i].keys[j]) == 0 && std::string("true").compare(impl->data[i].def_value) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -352,7 +352,7 @@ void CommandLineParser::printMessage() const
|
||||
{
|
||||
if (impl->data[i].number > -1)
|
||||
{
|
||||
string name = impl->data[i].keys[0].substr(1, impl->data[i].keys[0].length() - 1);
|
||||
std::string name = impl->data[i].keys[0].substr(1, impl->data[i].keys[0].length() - 1);
|
||||
std::cout << name << " ";
|
||||
}
|
||||
}
|
||||
@@ -366,7 +366,7 @@ void CommandLineParser::printMessage() const
|
||||
std::cout << "\t";
|
||||
for (size_t j = 0; j < impl->data[i].keys.size(); j++)
|
||||
{
|
||||
string k = impl->data[i].keys[j];
|
||||
std::string k = impl->data[i].keys[j];
|
||||
if (k.length() > 1)
|
||||
{
|
||||
std::cout << "--";
|
||||
@@ -382,7 +382,7 @@ void CommandLineParser::printMessage() const
|
||||
std::cout << ", ";
|
||||
}
|
||||
}
|
||||
string dv = impl->cat_string(impl->data[i].def_value);
|
||||
std::string dv = impl->cat_string(impl->data[i].def_value);
|
||||
if (dv.compare("") != 0)
|
||||
{
|
||||
std::cout << " (value:" << dv << ")";
|
||||
@@ -397,12 +397,12 @@ void CommandLineParser::printMessage() const
|
||||
if (impl->data[i].number != -1)
|
||||
{
|
||||
std::cout << "\t";
|
||||
string k = impl->data[i].keys[0];
|
||||
std::string k = impl->data[i].keys[0];
|
||||
k = k.substr(1, k.length() - 1);
|
||||
|
||||
std::cout << k;
|
||||
|
||||
string dv = impl->cat_string(impl->data[i].def_value);
|
||||
std::string dv = impl->cat_string(impl->data[i].def_value);
|
||||
if (dv.compare("") != 0)
|
||||
{
|
||||
std::cout << " (value:" << dv << ")";
|
||||
@@ -412,11 +412,11 @@ void CommandLineParser::printMessage() const
|
||||
}
|
||||
}
|
||||
|
||||
vector<string> CommandLineParser::Impl::split_range_string(const string& _str, char fs, char ss) const
|
||||
std::vector<std::string> CommandLineParser::Impl::split_range_string(const std::string& _str, char fs, char ss) const
|
||||
{
|
||||
string str = _str;
|
||||
vector<string> vec;
|
||||
string word = "";
|
||||
std::string str = _str;
|
||||
std::vector<std::string> vec;
|
||||
std::string word = "";
|
||||
bool begin = false;
|
||||
|
||||
while (!str.empty())
|
||||
@@ -426,13 +426,13 @@ vector<string> CommandLineParser::Impl::split_range_string(const string& _str, c
|
||||
if (begin == true)
|
||||
{
|
||||
throw cv::Exception(CV_StsParseError,
|
||||
string("error in split_range_string(")
|
||||
std::string("error in split_range_string(")
|
||||
+ str
|
||||
+ string(", ")
|
||||
+ string(1, fs)
|
||||
+ string(", ")
|
||||
+ string(1, ss)
|
||||
+ string(")"),
|
||||
+ std::string(", ")
|
||||
+ std::string(1, fs)
|
||||
+ std::string(", ")
|
||||
+ std::string(1, ss)
|
||||
+ std::string(")"),
|
||||
"", __FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
@@ -446,13 +446,13 @@ vector<string> CommandLineParser::Impl::split_range_string(const string& _str, c
|
||||
if (begin == false)
|
||||
{
|
||||
throw cv::Exception(CV_StsParseError,
|
||||
string("error in split_range_string(")
|
||||
std::string("error in split_range_string(")
|
||||
+ str
|
||||
+ string(", ")
|
||||
+ string(1, fs)
|
||||
+ string(", ")
|
||||
+ string(1, ss)
|
||||
+ string(")"),
|
||||
+ std::string(", ")
|
||||
+ std::string(1, fs)
|
||||
+ std::string(", ")
|
||||
+ std::string(1, ss)
|
||||
+ std::string(")"),
|
||||
"", __FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
@@ -470,13 +470,13 @@ vector<string> CommandLineParser::Impl::split_range_string(const string& _str, c
|
||||
if (begin == true)
|
||||
{
|
||||
throw cv::Exception(CV_StsParseError,
|
||||
string("error in split_range_string(")
|
||||
std::string("error in split_range_string(")
|
||||
+ str
|
||||
+ string(", ")
|
||||
+ string(1, fs)
|
||||
+ string(", ")
|
||||
+ string(1, ss)
|
||||
+ string(")"),
|
||||
+ std::string(", ")
|
||||
+ std::string(1, fs)
|
||||
+ std::string(", ")
|
||||
+ std::string(1, ss)
|
||||
+ std::string(")"),
|
||||
"", __FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
@@ -484,11 +484,11 @@ vector<string> CommandLineParser::Impl::split_range_string(const string& _str, c
|
||||
return vec;
|
||||
}
|
||||
|
||||
vector<string> CommandLineParser::Impl::split_string(const string& _str, char symbol, bool create_empty_item) const
|
||||
std::vector<std::string> CommandLineParser::Impl::split_string(const std::string& _str, char symbol, bool create_empty_item) const
|
||||
{
|
||||
string str = _str;
|
||||
vector<string> vec;
|
||||
string word = "";
|
||||
std::string str = _str;
|
||||
std::vector<std::string> vec;
|
||||
std::string word = "";
|
||||
|
||||
while (!str.empty())
|
||||
{
|
||||
|
@@ -344,7 +344,7 @@ void cv::merge(const Mat* mv, size_t n, OutputArray _dst)
|
||||
|
||||
void cv::merge(InputArrayOfArrays _mv, OutputArray _dst)
|
||||
{
|
||||
vector<Mat> mv;
|
||||
std::vector<Mat> mv;
|
||||
_mv.getMatVector(mv);
|
||||
merge(!mv.empty() ? &mv[0] : 0, mv.size(), _dst);
|
||||
}
|
||||
@@ -505,7 +505,7 @@ void cv::mixChannels( const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts, cons
|
||||
}
|
||||
|
||||
|
||||
void cv::mixChannels(const vector<Mat>& src, vector<Mat>& dst,
|
||||
void cv::mixChannels(const std::vector<Mat>& src, std::vector<Mat>& dst,
|
||||
const int* fromTo, size_t npairs)
|
||||
{
|
||||
mixChannels(!src.empty() ? &src[0] : 0, src.size(),
|
||||
@@ -513,7 +513,7 @@ void cv::mixChannels(const vector<Mat>& src, vector<Mat>& dst,
|
||||
}
|
||||
|
||||
void cv::mixChannels(InputArrayOfArrays src, InputArrayOfArrays dst,
|
||||
const vector<int>& fromTo)
|
||||
const std::vector<int>& fromTo)
|
||||
{
|
||||
if(fromTo.empty())
|
||||
return;
|
||||
@@ -1247,8 +1247,8 @@ cvSplit( const void* srcarr, void* dstarr0, void* dstarr1, void* dstarr2, void*
|
||||
for( i = 0; i < 4; i++ )
|
||||
nz += dptrs[i] != 0;
|
||||
CV_Assert( nz > 0 );
|
||||
cv::vector<cv::Mat> dvec(nz);
|
||||
cv::vector<int> pairs(nz*2);
|
||||
std::vector<cv::Mat> dvec(nz);
|
||||
std::vector<int> pairs(nz*2);
|
||||
|
||||
for( i = j = 0; i < 4; i++ )
|
||||
{
|
||||
@@ -1283,8 +1283,8 @@ cvMerge( const void* srcarr0, const void* srcarr1, const void* srcarr2,
|
||||
for( i = 0; i < 4; i++ )
|
||||
nz += sptrs[i] != 0;
|
||||
CV_Assert( nz > 0 );
|
||||
cv::vector<cv::Mat> svec(nz);
|
||||
cv::vector<int> pairs(nz*2);
|
||||
std::vector<cv::Mat> svec(nz);
|
||||
std::vector<int> pairs(nz*2);
|
||||
|
||||
for( i = j = 0; i < 4; i++ )
|
||||
{
|
||||
|
@@ -3643,7 +3643,7 @@ void KDTree::build(InputArray __points, InputArray __labels, bool _copyData)
|
||||
{
|
||||
Mat _points = __points.getMat(), _labels = __labels.getMat();
|
||||
CV_Assert(_points.type() == CV_32F && !_points.empty());
|
||||
vector<KDTree::Node>().swap(nodes);
|
||||
std::vector<KDTree::Node>().swap(nodes);
|
||||
|
||||
if( !_copyData )
|
||||
points = _points;
|
||||
@@ -3672,7 +3672,7 @@ void KDTree::build(InputArray __points, InputArray __labels, bool _copyData)
|
||||
Mat sumstack(MAX_TREE_DEPTH*2, ptdims*2, CV_64F);
|
||||
SubTree stack[MAX_TREE_DEPTH*2];
|
||||
|
||||
vector<size_t> _ptofs(n);
|
||||
std::vector<size_t> _ptofs(n);
|
||||
size_t* ptofs = &_ptofs[0];
|
||||
|
||||
for( i = 0; i < n; i++ )
|
||||
@@ -3909,7 +3909,7 @@ void KDTree::findOrthoRange(InputArray _lowerBound,
|
||||
const float* L = lowerBound.ptr<float>();
|
||||
const float* R = upperBound.ptr<float>();
|
||||
|
||||
vector<int> idx;
|
||||
std::vector<int> idx;
|
||||
AutoBuffer<int> _stack(MAX_TREE_DEPTH*2 + 1);
|
||||
int* stack = _stack;
|
||||
int top = 0;
|
||||
|
@@ -57,11 +57,11 @@ struct PolyEdge
|
||||
|
||||
static void
|
||||
CollectPolyEdges( Mat& img, const Point* v, int npts,
|
||||
vector<PolyEdge>& edges, const void* color, int line_type,
|
||||
std::vector<PolyEdge>& edges, const void* color, int line_type,
|
||||
int shift, Point offset=Point() );
|
||||
|
||||
static void
|
||||
FillEdgeCollection( Mat& img, vector<PolyEdge>& edges, const void* color );
|
||||
FillEdgeCollection( Mat& img, std::vector<PolyEdge>& edges, const void* color );
|
||||
|
||||
static void
|
||||
PolyLine( Mat& img, const Point* v, int npts, bool closed,
|
||||
@@ -835,7 +835,7 @@ sincos( int angle, float& cosval, float& sinval )
|
||||
*/
|
||||
void ellipse2Poly( Point center, Size axes, int angle,
|
||||
int arc_start, int arc_end,
|
||||
int delta, vector<Point>& pts )
|
||||
int delta, std::vector<Point>& pts )
|
||||
{
|
||||
float alpha, beta;
|
||||
double size_a = axes.width, size_b = axes.height;
|
||||
@@ -904,7 +904,7 @@ EllipseEx( Mat& img, Point center, Size axes,
|
||||
int delta = (std::max(axes.width,axes.height)+(XY_ONE>>1))>>XY_SHIFT;
|
||||
delta = delta < 3 ? 90 : delta < 10 ? 30 : delta < 15 ? 18 : 5;
|
||||
|
||||
vector<Point> v;
|
||||
std::vector<Point> v;
|
||||
ellipse2Poly( center, axes, angle, arc_start, arc_end, delta, v );
|
||||
|
||||
if( thickness >= 0 )
|
||||
@@ -914,7 +914,7 @@ EllipseEx( Mat& img, Point center, Size axes,
|
||||
else
|
||||
{
|
||||
v.push_back(center);
|
||||
vector<PolyEdge> edges;
|
||||
std::vector<PolyEdge> edges;
|
||||
CollectPolyEdges( img, &v[0], (int)v.size(), edges, color, line_type, XY_SHIFT );
|
||||
FillEdgeCollection( img, edges, color );
|
||||
}
|
||||
@@ -1104,7 +1104,7 @@ FillConvexPoly( Mat& img, const Point* v, int npts, const void* color, int line_
|
||||
/******** Arbitrary polygon **********/
|
||||
|
||||
static void
|
||||
CollectPolyEdges( Mat& img, const Point* v, int count, vector<PolyEdge>& edges,
|
||||
CollectPolyEdges( Mat& img, const Point* v, int count, std::vector<PolyEdge>& edges,
|
||||
const void* color, int line_type, int shift, Point offset )
|
||||
{
|
||||
int i, delta = offset.y + (shift ? 1 << (shift - 1) : 0);
|
||||
@@ -1170,7 +1170,7 @@ struct CmpEdges
|
||||
/**************** helper macros and functions for sequence/contour processing ***********/
|
||||
|
||||
static void
|
||||
FillEdgeCollection( Mat& img, vector<PolyEdge>& edges, const void* color )
|
||||
FillEdgeCollection( Mat& img, std::vector<PolyEdge>& edges, const void* color )
|
||||
{
|
||||
PolyEdge tmp;
|
||||
int i, y, total = (int)edges.size();
|
||||
@@ -1716,7 +1716,7 @@ void fillPoly( Mat& img, const Point** pts, const int* npts, int ncontours,
|
||||
double buf[4];
|
||||
scalarToRawData(color, buf, img.type(), 0);
|
||||
|
||||
vector<PolyEdge> edges;
|
||||
std::vector<PolyEdge> edges;
|
||||
|
||||
int i, total = 0;
|
||||
for( i = 0; i < ncontours; i++ )
|
||||
@@ -1914,7 +1914,7 @@ static const int* getFontData(int fontFace)
|
||||
}
|
||||
|
||||
|
||||
void putText( Mat& img, const string& text, Point org,
|
||||
void putText( Mat& img, const std::string& text, Point org,
|
||||
int fontFace, double fontScale, Scalar color,
|
||||
int thickness, int line_type, bool bottomLeftOrigin )
|
||||
|
||||
@@ -1935,7 +1935,7 @@ void putText( Mat& img, const string& text, Point org,
|
||||
|
||||
int view_x = org.x << XY_SHIFT;
|
||||
int view_y = (org.y << XY_SHIFT) + base_line*vscale;
|
||||
vector<Point> pts;
|
||||
std::vector<Point> pts;
|
||||
pts.reserve(1 << 10);
|
||||
const char **faces = cv::g_HersheyGlyphs;
|
||||
|
||||
@@ -1976,7 +1976,7 @@ void putText( Mat& img, const string& text, Point org,
|
||||
}
|
||||
}
|
||||
|
||||
Size getTextSize( const string& text, int fontFace, double fontScale, int thickness, int* _base_line)
|
||||
Size getTextSize( const std::string& text, int fontFace, double fontScale, int thickness, int* _base_line)
|
||||
{
|
||||
Size size;
|
||||
double view_x = 0;
|
||||
@@ -2076,8 +2076,8 @@ using namespace cv;
|
||||
static void addChildContour(InputArrayOfArrays contours,
|
||||
size_t ncontours,
|
||||
const Vec4i* hierarchy,
|
||||
int i, vector<CvSeq>& seq,
|
||||
vector<CvSeqBlock>& block)
|
||||
int i, std::vector<CvSeq>& seq,
|
||||
std::vector<CvSeqBlock>& block)
|
||||
{
|
||||
for( ; i >= 0; i = hierarchy[i][0] )
|
||||
{
|
||||
@@ -2109,8 +2109,8 @@ void cv::drawContours( InputOutputArray _image, InputArrayOfArrays _contours,
|
||||
|
||||
size_t ncontours = _contours.total();
|
||||
size_t i = 0, first = 0, last = ncontours;
|
||||
vector<CvSeq> seq;
|
||||
vector<CvSeqBlock> block;
|
||||
std::vector<CvSeq> seq;
|
||||
std::vector<CvSeqBlock> block;
|
||||
|
||||
if( !last )
|
||||
return;
|
||||
@@ -2194,8 +2194,8 @@ cvDrawContours( void* _img, CvSeq* contour,
|
||||
{
|
||||
CvSeq *contour0 = contour, *h_next = 0;
|
||||
CvTreeNodeIterator iterator;
|
||||
cv::vector<cv::PolyEdge> edges;
|
||||
cv::vector<cv::Point> pts;
|
||||
std::vector<cv::PolyEdge> edges;
|
||||
std::vector<cv::Point> pts;
|
||||
cv::Scalar externalColor = _externalColor, holeColor = _holeColor;
|
||||
cv::Mat img = cv::cvarrToMat(_img);
|
||||
cv::Point offset = _offset;
|
||||
@@ -2318,7 +2318,7 @@ CV_IMPL int
|
||||
cvEllipse2Poly( CvPoint center, CvSize axes, int angle,
|
||||
int arc_start, int arc_end, CvPoint* _pts, int delta )
|
||||
{
|
||||
cv::vector<cv::Point> pts;
|
||||
std::vector<cv::Point> pts;
|
||||
cv::ellipse2Poly( center, axes, angle, arc_start, arc_end, delta, pts );
|
||||
memcpy( _pts, &pts[0], pts.size()*sizeof(_pts[0]) );
|
||||
return (int)pts.size();
|
||||
|
@@ -60,10 +60,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace cv::gpu;
|
||||
|
||||
//////////////////////////////// Initialization & Info ////////////////////////
|
||||
|
||||
namespace
|
||||
@@ -73,7 +69,7 @@ namespace
|
||||
public:
|
||||
CudaArch();
|
||||
|
||||
bool builtWith(FeatureSet feature_set) const;
|
||||
bool builtWith(cv::gpu::FeatureSet feature_set) const;
|
||||
bool hasPtx(int major, int minor) const;
|
||||
bool hasBin(int major, int minor) const;
|
||||
bool hasEqualOrLessPtx(int major, int minor) const;
|
||||
@@ -81,11 +77,11 @@ namespace
|
||||
bool hasEqualOrGreaterBin(int major, int minor) const;
|
||||
|
||||
private:
|
||||
static void fromStr(const string& set_as_str, vector<int>& arr);
|
||||
static void fromStr(const std::string& set_as_str, std::vector<int>& arr);
|
||||
|
||||
vector<int> bin;
|
||||
vector<int> ptx;
|
||||
vector<int> features;
|
||||
std::vector<int> bin;
|
||||
std::vector<int> ptx;
|
||||
std::vector<int> features;
|
||||
};
|
||||
|
||||
const CudaArch cudaArch;
|
||||
@@ -99,19 +95,19 @@ namespace
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CudaArch::builtWith(FeatureSet feature_set) const
|
||||
bool CudaArch::builtWith(cv::gpu::FeatureSet feature_set) const
|
||||
{
|
||||
return !features.empty() && (features.back() >= feature_set);
|
||||
}
|
||||
|
||||
bool CudaArch::hasPtx(int major, int minor) const
|
||||
{
|
||||
return find(ptx.begin(), ptx.end(), major * 10 + minor) != ptx.end();
|
||||
return std::find(ptx.begin(), ptx.end(), major * 10 + minor) != ptx.end();
|
||||
}
|
||||
|
||||
bool CudaArch::hasBin(int major, int minor) const
|
||||
{
|
||||
return find(bin.begin(), bin.end(), major * 10 + minor) != bin.end();
|
||||
return std::find(bin.begin(), bin.end(), major * 10 + minor) != bin.end();
|
||||
}
|
||||
|
||||
bool CudaArch::hasEqualOrLessPtx(int major, int minor) const
|
||||
@@ -129,12 +125,12 @@ namespace
|
||||
return !bin.empty() && (bin.back() >= major * 10 + minor);
|
||||
}
|
||||
|
||||
void CudaArch::fromStr(const string& set_as_str, vector<int>& arr)
|
||||
void CudaArch::fromStr(const std::string& set_as_str, std::vector<int>& arr)
|
||||
{
|
||||
if (set_as_str.find_first_not_of(" ") == string::npos)
|
||||
if (set_as_str.find_first_not_of(" ") == std::string::npos)
|
||||
return;
|
||||
|
||||
istringstream stream(set_as_str);
|
||||
std::istringstream stream(set_as_str);
|
||||
int cur_value;
|
||||
|
||||
while (!stream.eof())
|
||||
@@ -143,7 +139,7 @@ namespace
|
||||
arr.push_back(cur_value);
|
||||
}
|
||||
|
||||
sort(arr.begin(), arr.end());
|
||||
std::sort(arr.begin(), arr.end());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -646,7 +642,7 @@ cv::gpu::GpuMat::GpuMat(const Mat& m) :
|
||||
upload(m);
|
||||
}
|
||||
|
||||
GpuMat& cv::gpu::GpuMat::operator = (const GpuMat& m)
|
||||
cv::gpu::GpuMat& cv::gpu::GpuMat::operator = (const cv::gpu::GpuMat& m)
|
||||
{
|
||||
if (this != &m)
|
||||
{
|
||||
@@ -693,7 +689,7 @@ void cv::gpu::GpuMat::locateROI(Size& wholeSize, Point& ofs) const
|
||||
wholeSize.width = std::max(static_cast<int>((delta2 - step * (wholeSize.height - 1)) / esz), ofs.x + cols);
|
||||
}
|
||||
|
||||
GpuMat& cv::gpu::GpuMat::adjustROI(int dtop, int dbottom, int dleft, int dright)
|
||||
cv::gpu::GpuMat& cv::gpu::GpuMat::adjustROI(int dtop, int dbottom, int dleft, int dright)
|
||||
{
|
||||
Size wholeSize;
|
||||
Point ofs;
|
||||
@@ -719,7 +715,7 @@ GpuMat& cv::gpu::GpuMat::adjustROI(int dtop, int dbottom, int dleft, int dright)
|
||||
return *this;
|
||||
}
|
||||
|
||||
GpuMat cv::gpu::GpuMat::reshape(int new_cn, int new_rows) const
|
||||
cv::gpu::GpuMat cv::gpu::GpuMat::reshape(int new_cn, int new_rows) const
|
||||
{
|
||||
GpuMat hdr = *this;
|
||||
|
||||
@@ -762,7 +758,7 @@ GpuMat cv::gpu::GpuMat::reshape(int new_cn, int new_rows) const
|
||||
return hdr;
|
||||
}
|
||||
|
||||
cv::Mat::Mat(const GpuMat& m) : flags(0), dims(0), rows(0), cols(0), data(0), refcount(0), datastart(0), dataend(0), datalimit(0), allocator(0), size(&rows)
|
||||
cv::Mat::Mat(const cv::gpu::GpuMat& m) : flags(0), dims(0), rows(0), cols(0), data(0), refcount(0), datastart(0), dataend(0), datalimit(0), allocator(0), size(&rows)
|
||||
{
|
||||
m.download(*this);
|
||||
}
|
||||
@@ -804,7 +800,7 @@ void cv::gpu::ensureSizeIsEnough(int rows, int cols, int type, GpuMat& m)
|
||||
}
|
||||
}
|
||||
|
||||
GpuMat cv::gpu::allocMatFromBuf(int rows, int cols, int type, GpuMat &mat)
|
||||
cv::gpu::GpuMat cv::gpu::allocMatFromBuf(int rows, int cols, int type, GpuMat &mat)
|
||||
{
|
||||
if (!mat.empty() && mat.type() == type && mat.rows >= rows && mat.cols >= cols)
|
||||
return mat(Rect(0, 0, cols, rows));
|
||||
@@ -818,16 +814,16 @@ namespace
|
||||
public:
|
||||
virtual ~GpuFuncTable() {}
|
||||
|
||||
virtual void copy(const Mat& src, GpuMat& dst) const = 0;
|
||||
virtual void copy(const GpuMat& src, Mat& dst) const = 0;
|
||||
virtual void copy(const GpuMat& src, GpuMat& dst) const = 0;
|
||||
virtual void copy(const cv::Mat& src, cv::gpu::GpuMat& dst) const = 0;
|
||||
virtual void copy(const cv::gpu::GpuMat& src, cv::Mat& dst) const = 0;
|
||||
virtual void copy(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst) const = 0;
|
||||
|
||||
virtual void copyWithMask(const GpuMat& src, GpuMat& dst, const GpuMat& mask) const = 0;
|
||||
virtual void copyWithMask(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst, const cv::gpu::GpuMat& mask) const = 0;
|
||||
|
||||
virtual void convert(const GpuMat& src, GpuMat& dst) const = 0;
|
||||
virtual void convert(const GpuMat& src, GpuMat& dst, double alpha, double beta) const = 0;
|
||||
virtual void convert(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst) const = 0;
|
||||
virtual void convert(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst, double alpha, double beta) const = 0;
|
||||
|
||||
virtual void setTo(GpuMat& m, Scalar s, const GpuMat& mask) const = 0;
|
||||
virtual void setTo(cv::gpu::GpuMat& m, cv::Scalar s, const cv::gpu::GpuMat& mask) const = 0;
|
||||
|
||||
virtual void mallocPitch(void** devPtr, size_t* step, size_t width, size_t height) const = 0;
|
||||
virtual void free(void* devPtr) const = 0;
|
||||
@@ -841,16 +837,16 @@ namespace
|
||||
class EmptyFuncTable : public GpuFuncTable
|
||||
{
|
||||
public:
|
||||
void copy(const Mat&, GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
|
||||
void copy(const GpuMat&, Mat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
|
||||
void copy(const GpuMat&, GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
|
||||
void copy(const cv::Mat&, cv::gpu::GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
|
||||
void copy(const cv::gpu::GpuMat&, cv::Mat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
|
||||
void copy(const cv::gpu::GpuMat&, cv::gpu::GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
|
||||
|
||||
void copyWithMask(const GpuMat&, GpuMat&, const GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
|
||||
void copyWithMask(const cv::gpu::GpuMat&, cv::gpu::GpuMat&, const cv::gpu::GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
|
||||
|
||||
void convert(const GpuMat&, GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
|
||||
void convert(const GpuMat&, GpuMat&, double, double) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
|
||||
void convert(const cv::gpu::GpuMat&, cv::gpu::GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
|
||||
void convert(const cv::gpu::GpuMat&, cv::gpu::GpuMat&, double, double) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
|
||||
|
||||
void setTo(GpuMat&, Scalar, const GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
|
||||
void setTo(cv::gpu::GpuMat&, cv::Scalar, const cv::gpu::GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
|
||||
|
||||
void mallocPitch(void**, size_t*, size_t, size_t) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
|
||||
void free(void*) const {}
|
||||
@@ -880,15 +876,15 @@ namespace cv { namespace gpu { namespace device
|
||||
|
||||
namespace
|
||||
{
|
||||
template <typename T> void kernelSetCaller(GpuMat& src, Scalar s, cudaStream_t stream)
|
||||
template <typename T> void kernelSetCaller(cv::gpu::GpuMat& src, cv::Scalar s, cudaStream_t stream)
|
||||
{
|
||||
Scalar_<T> sf = s;
|
||||
cv::Scalar_<T> sf = s;
|
||||
cv::gpu::device::set_to_gpu(src, sf.val, src.channels(), stream);
|
||||
}
|
||||
|
||||
template <typename T> void kernelSetCaller(GpuMat& src, Scalar s, const GpuMat& mask, cudaStream_t stream)
|
||||
template <typename T> void kernelSetCaller(cv::gpu::GpuMat& src, cv::Scalar s, const cv::gpu::GpuMat& mask, cudaStream_t stream)
|
||||
{
|
||||
Scalar_<T> sf = s;
|
||||
cv::Scalar_<T> sf = s;
|
||||
cv::gpu::device::set_to_gpu(src, sf.val, mask, src.channels(), stream);
|
||||
}
|
||||
}
|
||||
@@ -996,7 +992,7 @@ namespace
|
||||
typedef typename NPPTypeTraits<SDEPTH>::npp_type src_t;
|
||||
typedef typename NPPTypeTraits<DDEPTH>::npp_type dst_t;
|
||||
|
||||
static void call(const GpuMat& src, GpuMat& dst)
|
||||
static void call(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst)
|
||||
{
|
||||
NppiSize sz;
|
||||
sz.width = src.cols;
|
||||
@@ -1011,7 +1007,7 @@ namespace
|
||||
{
|
||||
typedef typename NPPTypeTraits<DDEPTH>::npp_type dst_t;
|
||||
|
||||
static void call(const GpuMat& src, GpuMat& dst)
|
||||
static void call(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst)
|
||||
{
|
||||
NppiSize sz;
|
||||
sz.width = src.cols;
|
||||
@@ -1051,13 +1047,13 @@ namespace
|
||||
{
|
||||
typedef typename NPPTypeTraits<SDEPTH>::npp_type src_t;
|
||||
|
||||
static void call(GpuMat& src, Scalar s)
|
||||
static void call(cv::gpu::GpuMat& src, cv::Scalar s)
|
||||
{
|
||||
NppiSize sz;
|
||||
sz.width = src.cols;
|
||||
sz.height = src.rows;
|
||||
|
||||
Scalar_<src_t> nppS = s;
|
||||
cv::Scalar_<src_t> nppS = s;
|
||||
|
||||
nppSafeCall( func(nppS.val, src.ptr<src_t>(), static_cast<int>(src.step), sz) );
|
||||
|
||||
@@ -1068,13 +1064,13 @@ namespace
|
||||
{
|
||||
typedef typename NPPTypeTraits<SDEPTH>::npp_type src_t;
|
||||
|
||||
static void call(GpuMat& src, Scalar s)
|
||||
static void call(cv::gpu::GpuMat& src, cv::Scalar s)
|
||||
{
|
||||
NppiSize sz;
|
||||
sz.width = src.cols;
|
||||
sz.height = src.rows;
|
||||
|
||||
Scalar_<src_t> nppS = s;
|
||||
cv::Scalar_<src_t> nppS = s;
|
||||
|
||||
nppSafeCall( func(nppS[0], src.ptr<src_t>(), static_cast<int>(src.step), sz) );
|
||||
|
||||
@@ -1099,13 +1095,13 @@ namespace
|
||||
{
|
||||
typedef typename NPPTypeTraits<SDEPTH>::npp_type src_t;
|
||||
|
||||
static void call(GpuMat& src, Scalar s, const GpuMat& mask)
|
||||
static void call(cv::gpu::GpuMat& src, cv::Scalar s, const cv::gpu::GpuMat& mask)
|
||||
{
|
||||
NppiSize sz;
|
||||
sz.width = src.cols;
|
||||
sz.height = src.rows;
|
||||
|
||||
Scalar_<src_t> nppS = s;
|
||||
cv::Scalar_<src_t> nppS = s;
|
||||
|
||||
nppSafeCall( func(nppS.val, src.ptr<src_t>(), static_cast<int>(src.step), sz, mask.ptr<Npp8u>(), static_cast<int>(mask.step)) );
|
||||
|
||||
@@ -1116,13 +1112,13 @@ namespace
|
||||
{
|
||||
typedef typename NPPTypeTraits<SDEPTH>::npp_type src_t;
|
||||
|
||||
static void call(GpuMat& src, Scalar s, const GpuMat& mask)
|
||||
static void call(cv::gpu::GpuMat& src, cv::Scalar s, const cv::gpu::GpuMat& mask)
|
||||
{
|
||||
NppiSize sz;
|
||||
sz.width = src.cols;
|
||||
sz.height = src.rows;
|
||||
|
||||
Scalar_<src_t> nppS = s;
|
||||
cv::Scalar_<src_t> nppS = s;
|
||||
|
||||
nppSafeCall( func(nppS[0], src.ptr<src_t>(), static_cast<int>(src.step), sz, mask.ptr<Npp8u>(), static_cast<int>(mask.step)) );
|
||||
|
||||
@@ -1144,7 +1140,7 @@ namespace
|
||||
{
|
||||
typedef typename NPPTypeTraits<SDEPTH>::npp_type src_t;
|
||||
|
||||
static void call(const GpuMat& src, GpuMat& dst, const GpuMat& mask, cudaStream_t /*stream*/)
|
||||
static void call(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst, const cv::gpu::GpuMat& mask, cudaStream_t /*stream*/)
|
||||
{
|
||||
NppiSize sz;
|
||||
sz.width = src.cols;
|
||||
@@ -1167,20 +1163,20 @@ namespace
|
||||
class CudaFuncTable : public GpuFuncTable
|
||||
{
|
||||
public:
|
||||
void copy(const Mat& src, GpuMat& dst) const
|
||||
void copy(const cv::Mat& src, cv::gpu::GpuMat& dst) const
|
||||
{
|
||||
cudaSafeCall( cudaMemcpy2D(dst.data, dst.step, src.data, src.step, src.cols * src.elemSize(), src.rows, cudaMemcpyHostToDevice) );
|
||||
}
|
||||
void copy(const GpuMat& src, Mat& dst) const
|
||||
void copy(const cv::gpu::GpuMat& src, cv::Mat& dst) const
|
||||
{
|
||||
cudaSafeCall( cudaMemcpy2D(dst.data, dst.step, src.data, src.step, src.cols * src.elemSize(), src.rows, cudaMemcpyDeviceToHost) );
|
||||
}
|
||||
void copy(const GpuMat& src, GpuMat& dst) const
|
||||
void copy(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst) const
|
||||
{
|
||||
cudaSafeCall( cudaMemcpy2D(dst.data, dst.step, src.data, src.step, src.cols * src.elemSize(), src.rows, cudaMemcpyDeviceToDevice) );
|
||||
}
|
||||
|
||||
void copyWithMask(const GpuMat& src, GpuMat& dst, const GpuMat& mask) const
|
||||
void copyWithMask(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst, const cv::gpu::GpuMat& mask) const
|
||||
{
|
||||
CV_Assert(src.depth() <= CV_64F && src.channels() <= 4);
|
||||
CV_Assert(src.size() == dst.size() && src.type() == dst.type());
|
||||
@@ -1188,11 +1184,11 @@ namespace
|
||||
|
||||
if (src.depth() == CV_64F)
|
||||
{
|
||||
if (!TargetArchs::builtWith(NATIVE_DOUBLE) || !DeviceInfo().supports(NATIVE_DOUBLE))
|
||||
if (!cv::gpu::TargetArchs::builtWith(cv::gpu::NATIVE_DOUBLE) || !cv::gpu::DeviceInfo().supports(cv::gpu::NATIVE_DOUBLE))
|
||||
CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double");
|
||||
}
|
||||
|
||||
typedef void (*func_t)(const GpuMat& src, GpuMat& dst, const GpuMat& mask, cudaStream_t stream);
|
||||
typedef void (*func_t)(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst, const cv::gpu::GpuMat& mask, cudaStream_t stream);
|
||||
static const func_t funcs[7][4] =
|
||||
{
|
||||
/* 8U */ {NppCopyMasked<CV_8U , nppiCopy_8u_C1MR >::call, cv::gpu::copyWithMask, NppCopyMasked<CV_8U , nppiCopy_8u_C3MR >::call, NppCopyMasked<CV_8U , nppiCopy_8u_C4MR >::call},
|
||||
@@ -1209,9 +1205,9 @@ namespace
|
||||
func(src, dst, mask, 0);
|
||||
}
|
||||
|
||||
void convert(const GpuMat& src, GpuMat& dst) const
|
||||
void convert(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst) const
|
||||
{
|
||||
typedef void (*func_t)(const GpuMat& src, GpuMat& dst);
|
||||
typedef void (*func_t)(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst);
|
||||
static const func_t funcs[7][7][4] =
|
||||
{
|
||||
{
|
||||
@@ -1285,7 +1281,7 @@ namespace
|
||||
|
||||
if (src.depth() == CV_64F || dst.depth() == CV_64F)
|
||||
{
|
||||
if (!TargetArchs::builtWith(NATIVE_DOUBLE) || !DeviceInfo().supports(NATIVE_DOUBLE))
|
||||
if (!cv::gpu::TargetArchs::builtWith(cv::gpu::NATIVE_DOUBLE) || !cv::gpu::DeviceInfo().supports(cv::gpu::NATIVE_DOUBLE))
|
||||
CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double");
|
||||
}
|
||||
|
||||
@@ -1302,21 +1298,21 @@ namespace
|
||||
func(src, dst);
|
||||
}
|
||||
|
||||
void convert(const GpuMat& src, GpuMat& dst, double alpha, double beta) const
|
||||
void convert(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst, double alpha, double beta) const
|
||||
{
|
||||
CV_Assert(src.depth() <= CV_64F && src.channels() <= 4);
|
||||
CV_Assert(dst.depth() <= CV_64F);
|
||||
|
||||
if (src.depth() == CV_64F || dst.depth() == CV_64F)
|
||||
{
|
||||
if (!TargetArchs::builtWith(NATIVE_DOUBLE) || !DeviceInfo().supports(NATIVE_DOUBLE))
|
||||
if (!cv::gpu::TargetArchs::builtWith(cv::gpu::NATIVE_DOUBLE) || !cv::gpu::DeviceInfo().supports(cv::gpu::NATIVE_DOUBLE))
|
||||
CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double");
|
||||
}
|
||||
|
||||
cv::gpu::convertTo(src, dst, alpha, beta);
|
||||
}
|
||||
|
||||
void setTo(GpuMat& m, Scalar s, const GpuMat& mask) const
|
||||
void setTo(cv::gpu::GpuMat& m, cv::Scalar s, const cv::gpu::GpuMat& mask) const
|
||||
{
|
||||
if (mask.empty())
|
||||
{
|
||||
@@ -1332,13 +1328,13 @@ namespace
|
||||
|
||||
if (cn == 1 || (cn == 2 && s[0] == s[1]) || (cn == 3 && s[0] == s[1] && s[0] == s[2]) || (cn == 4 && s[0] == s[1] && s[0] == s[2] && s[0] == s[3]))
|
||||
{
|
||||
int val = saturate_cast<uchar>(s[0]);
|
||||
int val = cv::saturate_cast<uchar>(s[0]);
|
||||
cudaSafeCall( cudaMemset2D(m.data, m.step, val, m.cols * m.elemSize(), m.rows) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (*func_t)(GpuMat& src, Scalar s);
|
||||
typedef void (*func_t)(cv::gpu::GpuMat& src, cv::Scalar s);
|
||||
static const func_t funcs[7][4] =
|
||||
{
|
||||
{NppSet<CV_8U , 1, nppiSet_8u_C1R >::call, cv::gpu::setTo , cv::gpu::setTo , NppSet<CV_8U , 4, nppiSet_8u_C4R >::call},
|
||||
@@ -1354,7 +1350,7 @@ namespace
|
||||
|
||||
if (m.depth() == CV_64F)
|
||||
{
|
||||
if (!TargetArchs::builtWith(NATIVE_DOUBLE) || !DeviceInfo().supports(NATIVE_DOUBLE))
|
||||
if (!cv::gpu::TargetArchs::builtWith(cv::gpu::NATIVE_DOUBLE) || !cv::gpu::DeviceInfo().supports(cv::gpu::NATIVE_DOUBLE))
|
||||
CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double");
|
||||
}
|
||||
|
||||
@@ -1362,7 +1358,7 @@ namespace
|
||||
}
|
||||
else
|
||||
{
|
||||
typedef void (*func_t)(GpuMat& src, Scalar s, const GpuMat& mask);
|
||||
typedef void (*func_t)(cv::gpu::GpuMat& src, cv::Scalar s, const cv::gpu::GpuMat& mask);
|
||||
static const func_t funcs[7][4] =
|
||||
{
|
||||
{NppSetMask<CV_8U , 1, nppiSet_8u_C1MR >::call, cv::gpu::setTo, cv::gpu::setTo, NppSetMask<CV_8U , 4, nppiSet_8u_C4MR >::call},
|
||||
@@ -1378,7 +1374,7 @@ namespace
|
||||
|
||||
if (m.depth() == CV_64F)
|
||||
{
|
||||
if (!TargetArchs::builtWith(NATIVE_DOUBLE) || !DeviceInfo().supports(NATIVE_DOUBLE))
|
||||
if (!cv::gpu::TargetArchs::builtWith(cv::gpu::NATIVE_DOUBLE) || !cv::gpu::DeviceInfo().supports(cv::gpu::NATIVE_DOUBLE))
|
||||
CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double");
|
||||
}
|
||||
|
||||
@@ -1406,7 +1402,7 @@ namespace
|
||||
|
||||
#endif // HAVE_CUDA
|
||||
|
||||
void cv::gpu::GpuMat::upload(const Mat& m)
|
||||
void cv::gpu::GpuMat::upload(const cv::Mat& m)
|
||||
{
|
||||
CV_DbgAssert(!m.empty());
|
||||
|
||||
@@ -1415,7 +1411,7 @@ void cv::gpu::GpuMat::upload(const Mat& m)
|
||||
gpuFuncTable()->copy(m, *this);
|
||||
}
|
||||
|
||||
void cv::gpu::GpuMat::download(Mat& m) const
|
||||
void cv::gpu::GpuMat::download(cv::Mat& m) const
|
||||
{
|
||||
CV_DbgAssert(!empty());
|
||||
|
||||
@@ -1424,7 +1420,7 @@ void cv::gpu::GpuMat::download(Mat& m) const
|
||||
gpuFuncTable()->copy(*this, m);
|
||||
}
|
||||
|
||||
void cv::gpu::GpuMat::copyTo(GpuMat& m) const
|
||||
void cv::gpu::GpuMat::copyTo(cv::gpu::GpuMat& m) const
|
||||
{
|
||||
CV_DbgAssert(!empty());
|
||||
|
||||
@@ -1433,7 +1429,7 @@ void cv::gpu::GpuMat::copyTo(GpuMat& m) const
|
||||
gpuFuncTable()->copy(*this, m);
|
||||
}
|
||||
|
||||
void cv::gpu::GpuMat::copyTo(GpuMat& mat, const GpuMat& mask) const
|
||||
void cv::gpu::GpuMat::copyTo(cv::gpu::GpuMat& mat, const cv::gpu::GpuMat& mask) const
|
||||
{
|
||||
if (mask.empty())
|
||||
copyTo(mat);
|
||||
@@ -1445,9 +1441,9 @@ void cv::gpu::GpuMat::copyTo(GpuMat& mat, const GpuMat& mask) const
|
||||
}
|
||||
}
|
||||
|
||||
void cv::gpu::GpuMat::convertTo(GpuMat& dst, int rtype, double alpha, double beta) const
|
||||
void cv::gpu::GpuMat::convertTo(cv::gpu::GpuMat& dst, int rtype, double alpha, double beta) const
|
||||
{
|
||||
bool noScale = fabs(alpha - 1) < numeric_limits<double>::epsilon() && fabs(beta) < numeric_limits<double>::epsilon();
|
||||
bool noScale = fabs(alpha - 1) < std::numeric_limits<double>::epsilon() && fabs(beta) < std::numeric_limits<double>::epsilon();
|
||||
|
||||
if (rtype < 0)
|
||||
rtype = type();
|
||||
@@ -1462,8 +1458,8 @@ void cv::gpu::GpuMat::convertTo(GpuMat& dst, int rtype, double alpha, double bet
|
||||
return;
|
||||
}
|
||||
|
||||
GpuMat temp;
|
||||
const GpuMat* psrc = this;
|
||||
cv::gpu::GpuMat temp;
|
||||
const cv::gpu::GpuMat* psrc = this;
|
||||
if (sdepth != ddepth && psrc == &dst)
|
||||
{
|
||||
temp = *this;
|
||||
@@ -1478,7 +1474,7 @@ void cv::gpu::GpuMat::convertTo(GpuMat& dst, int rtype, double alpha, double bet
|
||||
gpuFuncTable()->convert(*psrc, dst, alpha, beta);
|
||||
}
|
||||
|
||||
GpuMat& cv::gpu::GpuMat::setTo(Scalar s, const GpuMat& mask)
|
||||
cv::gpu::GpuMat& cv::gpu::GpuMat::setTo(cv::Scalar s, const cv::gpu::GpuMat& mask)
|
||||
{
|
||||
CV_Assert(mask.empty() || mask.type() == CV_8UC1);
|
||||
CV_DbgAssert(!empty());
|
||||
@@ -1502,7 +1498,7 @@ void cv::gpu::GpuMat::create(int _rows, int _cols, int _type)
|
||||
|
||||
if (_rows > 0 && _cols > 0)
|
||||
{
|
||||
flags = Mat::MAGIC_VAL + _type;
|
||||
flags = cv::Mat::MAGIC_VAL + _type;
|
||||
rows = _rows;
|
||||
cols = _cols;
|
||||
|
||||
@@ -1516,7 +1512,7 @@ void cv::gpu::GpuMat::create(int _rows, int _cols, int _type)
|
||||
step = esz * cols;
|
||||
|
||||
if (esz * cols == step)
|
||||
flags |= Mat::CONTINUOUS_FLAG;
|
||||
flags |= cv::Mat::CONTINUOUS_FLAG;
|
||||
|
||||
int64 _nettosize = static_cast<int64>(step) * rows;
|
||||
size_t nettosize = static_cast<size_t>(_nettosize);
|
||||
@@ -1550,13 +1546,13 @@ void cv::gpu::error(const char *error_string, const char *file, const int line,
|
||||
{
|
||||
int code = CV_GpuApiCallError;
|
||||
|
||||
if (uncaught_exception())
|
||||
if (std::uncaught_exception())
|
||||
{
|
||||
const char* errorStr = cvErrorStr(code);
|
||||
const char* function = func ? func : "unknown function";
|
||||
|
||||
cerr << "OpenCV Error: " << errorStr << "(" << error_string << ") in " << function << ", file " << file << ", line " << line;
|
||||
cerr.flush();
|
||||
std::cerr << "OpenCV Error: " << errorStr << "(" << error_string << ") in " << function << ", file " << file << ", line " << line;
|
||||
std::cerr.flush();
|
||||
}
|
||||
else
|
||||
cv::error( cv::Exception(code, error_string, func, file, line) );
|
||||
|
@@ -1991,7 +1991,7 @@ void pow( InputArray _src, double power, OutputArray _dst )
|
||||
|
||||
void sqrt(InputArray a, OutputArray b)
|
||||
{
|
||||
pow(a, 0.5, b);
|
||||
cv::pow(a, 0.5, b);
|
||||
}
|
||||
|
||||
/************************** CheckArray for NaN's, Inf's *********************************/
|
||||
@@ -2396,7 +2396,7 @@ int cv::solveCubic( InputArray _coeffs, OutputArray _roots )
|
||||
double d = a2*a2 - 4*a1*a3;
|
||||
if( d >= 0 )
|
||||
{
|
||||
d = sqrt(d);
|
||||
d = std::sqrt(d);
|
||||
double q1 = (-a2 + d) * 0.5;
|
||||
double q2 = (a2 + d) * -0.5;
|
||||
if( fabs(q1) > fabs(q2) )
|
||||
@@ -2427,8 +2427,8 @@ int cv::solveCubic( InputArray _coeffs, OutputArray _roots )
|
||||
|
||||
if( d >= 0 )
|
||||
{
|
||||
double theta = acos(R / sqrt(Qcubed));
|
||||
double sqrtQ = sqrt(Q);
|
||||
double theta = acos(R / std::sqrt(Qcubed));
|
||||
double sqrtQ = std::sqrt(Q);
|
||||
double t0 = -2 * sqrtQ;
|
||||
double t1 = theta * (1./3);
|
||||
double t2 = a1 * (1./3);
|
||||
@@ -2440,8 +2440,8 @@ int cv::solveCubic( InputArray _coeffs, OutputArray _roots )
|
||||
else
|
||||
{
|
||||
double e;
|
||||
d = sqrt(-d);
|
||||
e = pow(d + fabs(R), 0.333333333333);
|
||||
d = std::sqrt(-d);
|
||||
e = std::pow(d + fabs(R), 0.333333333333);
|
||||
if( R > 0 )
|
||||
e = -e;
|
||||
x0 = (e + Q / e) - a1 * (1./3);
|
||||
@@ -2519,7 +2519,7 @@ double cv::solvePoly( InputArray _coeffs0, OutputArray _roots0, int maxIters )
|
||||
}
|
||||
num /= denom;
|
||||
roots[i] = p - num;
|
||||
maxDiff = max(maxDiff, abs(num));
|
||||
maxDiff = std::max(maxDiff, cv::abs(num));
|
||||
}
|
||||
if( maxDiff <= 0 )
|
||||
break;
|
||||
|
@@ -2151,7 +2151,7 @@ void cv::calcCovarMatrix( InputArray _src, OutputArray _covar, InputOutputArray
|
||||
Mat _data(static_cast<int>(src.size()), size.area(), type);
|
||||
|
||||
int i = 0;
|
||||
for(vector<cv::Mat>::iterator each = src.begin(); each != src.end(); each++, i++ )
|
||||
for(std::vector<cv::Mat>::iterator each = src.begin(); each != src.end(); each++, i++ )
|
||||
{
|
||||
CV_Assert( (*each).size() == size && (*each).type() == type );
|
||||
Mat dataRow(size.height, size.width, type, _data.ptr(i));
|
||||
|
@@ -931,7 +931,7 @@ void scalarToRawData(const Scalar& s, void* _buf, int type, int unroll_to)
|
||||
_InputArray::_InputArray() : flags(0), obj(0) {}
|
||||
_InputArray::~_InputArray() {}
|
||||
_InputArray::_InputArray(const Mat& m) : flags(MAT), obj((void*)&m) {}
|
||||
_InputArray::_InputArray(const vector<Mat>& vec) : flags(STD_VECTOR_MAT), obj((void*)&vec) {}
|
||||
_InputArray::_InputArray(const std::vector<Mat>& vec) : flags(STD_VECTOR_MAT), obj((void*)&vec) {}
|
||||
_InputArray::_InputArray(const double& val) : flags(FIXED_TYPE + FIXED_SIZE + MATX + CV_64F), obj((void*)&val), sz(Size(1,1)) {}
|
||||
_InputArray::_InputArray(const MatExpr& expr) : flags(FIXED_TYPE + FIXED_SIZE + EXPR), obj((void*)&expr) {}
|
||||
_InputArray::_InputArray(const GlBuffer& buf) : flags(OPENGL_BUFFER), obj((void*)&buf) {}
|
||||
@@ -966,7 +966,7 @@ Mat _InputArray::getMat(int i) const
|
||||
{
|
||||
CV_Assert( i < 0 );
|
||||
int t = CV_MAT_TYPE(flags);
|
||||
const vector<uchar>& v = *(const vector<uchar>*)obj;
|
||||
const std::vector<uchar>& v = *(const std::vector<uchar>*)obj;
|
||||
|
||||
return !v.empty() ? Mat(size(), t, (void*)&v[0]) : Mat();
|
||||
}
|
||||
@@ -977,9 +977,9 @@ Mat _InputArray::getMat(int i) const
|
||||
if( k == STD_VECTOR_VECTOR )
|
||||
{
|
||||
int t = type(i);
|
||||
const vector<vector<uchar> >& vv = *(const vector<vector<uchar> >*)obj;
|
||||
const std::vector<std::vector<uchar> >& vv = *(const std::vector<std::vector<uchar> >*)obj;
|
||||
CV_Assert( 0 <= i && i < (int)vv.size() );
|
||||
const vector<uchar>& v = vv[i];
|
||||
const std::vector<uchar>& v = vv[i];
|
||||
|
||||
return !v.empty() ? Mat(size(i), t, (void*)&v[0]) : Mat();
|
||||
}
|
||||
@@ -987,7 +987,7 @@ Mat _InputArray::getMat(int i) const
|
||||
CV_Assert( k == STD_VECTOR_MAT );
|
||||
//if( k == STD_VECTOR_MAT )
|
||||
{
|
||||
const vector<Mat>& v = *(const vector<Mat>*)obj;
|
||||
const std::vector<Mat>& v = *(const std::vector<Mat>*)obj;
|
||||
CV_Assert( 0 <= i && i < (int)v.size() );
|
||||
|
||||
return v[i];
|
||||
@@ -995,7 +995,7 @@ Mat _InputArray::getMat(int i) const
|
||||
}
|
||||
|
||||
|
||||
void _InputArray::getMatVector(vector<Mat>& mv) const
|
||||
void _InputArray::getMatVector(std::vector<Mat>& mv) const
|
||||
{
|
||||
int k = kind();
|
||||
|
||||
@@ -1034,7 +1034,7 @@ void _InputArray::getMatVector(vector<Mat>& mv) const
|
||||
|
||||
if( k == STD_VECTOR )
|
||||
{
|
||||
const vector<uchar>& v = *(const vector<uchar>*)obj;
|
||||
const std::vector<uchar>& v = *(const std::vector<uchar>*)obj;
|
||||
|
||||
size_t i, n = v.size(), esz = CV_ELEM_SIZE(flags);
|
||||
int t = CV_MAT_DEPTH(flags), cn = CV_MAT_CN(flags);
|
||||
@@ -1053,14 +1053,14 @@ void _InputArray::getMatVector(vector<Mat>& mv) const
|
||||
|
||||
if( k == STD_VECTOR_VECTOR )
|
||||
{
|
||||
const vector<vector<uchar> >& vv = *(const vector<vector<uchar> >*)obj;
|
||||
const std::vector<std::vector<uchar> >& vv = *(const std::vector<std::vector<uchar> >*)obj;
|
||||
int i, n = (int)vv.size();
|
||||
int t = CV_MAT_TYPE(flags);
|
||||
mv.resize(n);
|
||||
|
||||
for( i = 0; i < n; i++ )
|
||||
{
|
||||
const vector<uchar>& v = vv[i];
|
||||
const std::vector<uchar>& v = vv[i];
|
||||
mv[i] = Mat(size(i), t, (void*)&v[0]);
|
||||
}
|
||||
return;
|
||||
@@ -1069,7 +1069,7 @@ void _InputArray::getMatVector(vector<Mat>& mv) const
|
||||
CV_Assert( k == STD_VECTOR_MAT );
|
||||
//if( k == STD_VECTOR_MAT )
|
||||
{
|
||||
const vector<Mat>& v = *(const vector<Mat>*)obj;
|
||||
const std::vector<Mat>& v = *(const std::vector<Mat>*)obj;
|
||||
mv.resize(v.size());
|
||||
std::copy(v.begin(), v.end(), mv.begin());
|
||||
return;
|
||||
@@ -1142,8 +1142,8 @@ Size _InputArray::size(int i) const
|
||||
if( k == STD_VECTOR )
|
||||
{
|
||||
CV_Assert( i < 0 );
|
||||
const vector<uchar>& v = *(const vector<uchar>*)obj;
|
||||
const vector<int>& iv = *(const vector<int>*)obj;
|
||||
const std::vector<uchar>& v = *(const std::vector<uchar>*)obj;
|
||||
const std::vector<int>& iv = *(const std::vector<int>*)obj;
|
||||
size_t szb = v.size(), szi = iv.size();
|
||||
return szb == szi ? Size((int)szb, 1) : Size((int)(szb/CV_ELEM_SIZE(flags)), 1);
|
||||
}
|
||||
@@ -1153,11 +1153,11 @@ Size _InputArray::size(int i) const
|
||||
|
||||
if( k == STD_VECTOR_VECTOR )
|
||||
{
|
||||
const vector<vector<uchar> >& vv = *(const vector<vector<uchar> >*)obj;
|
||||
const std::vector<std::vector<uchar> >& vv = *(const std::vector<std::vector<uchar> >*)obj;
|
||||
if( i < 0 )
|
||||
return vv.empty() ? Size() : Size((int)vv.size(), 1);
|
||||
CV_Assert( i < (int)vv.size() );
|
||||
const vector<vector<int> >& ivv = *(const vector<vector<int> >*)obj;
|
||||
const std::vector<std::vector<int> >& ivv = *(const std::vector<std::vector<int> >*)obj;
|
||||
|
||||
size_t szb = vv[i].size(), szi = ivv[i].size();
|
||||
return szb == szi ? Size((int)szb, 1) : Size((int)(szb/CV_ELEM_SIZE(flags)), 1);
|
||||
@@ -1165,7 +1165,7 @@ Size _InputArray::size(int i) const
|
||||
|
||||
if( k == STD_VECTOR_MAT )
|
||||
{
|
||||
const vector<Mat>& vv = *(const vector<Mat>*)obj;
|
||||
const std::vector<Mat>& vv = *(const std::vector<Mat>*)obj;
|
||||
if( i < 0 )
|
||||
return vv.empty() ? Size() : Size((int)vv.size(), 1);
|
||||
CV_Assert( i < (int)vv.size() );
|
||||
@@ -1208,7 +1208,7 @@ size_t _InputArray::total(int i) const
|
||||
|
||||
if( k == STD_VECTOR_MAT )
|
||||
{
|
||||
const vector<Mat>& vv = *(const vector<Mat>*)obj;
|
||||
const std::vector<Mat>& vv = *(const std::vector<Mat>*)obj;
|
||||
if( i < 0 )
|
||||
return vv.size();
|
||||
|
||||
@@ -1237,7 +1237,7 @@ int _InputArray::type(int i) const
|
||||
|
||||
if( k == STD_VECTOR_MAT )
|
||||
{
|
||||
const vector<Mat>& vv = *(const vector<Mat>*)obj;
|
||||
const std::vector<Mat>& vv = *(const std::vector<Mat>*)obj;
|
||||
CV_Assert( i < (int)vv.size() );
|
||||
|
||||
return vv[i >= 0 ? i : 0].type();
|
||||
@@ -1276,7 +1276,7 @@ bool _InputArray::empty() const
|
||||
|
||||
if( k == STD_VECTOR )
|
||||
{
|
||||
const vector<uchar>& v = *(const vector<uchar>*)obj;
|
||||
const std::vector<uchar>& v = *(const std::vector<uchar>*)obj;
|
||||
return v.empty();
|
||||
}
|
||||
|
||||
@@ -1285,13 +1285,13 @@ bool _InputArray::empty() const
|
||||
|
||||
if( k == STD_VECTOR_VECTOR )
|
||||
{
|
||||
const vector<vector<uchar> >& vv = *(const vector<vector<uchar> >*)obj;
|
||||
const std::vector<std::vector<uchar> >& vv = *(const std::vector<std::vector<uchar> >*)obj;
|
||||
return vv.empty();
|
||||
}
|
||||
|
||||
if( k == STD_VECTOR_MAT )
|
||||
{
|
||||
const vector<Mat>& vv = *(const vector<Mat>*)obj;
|
||||
const std::vector<Mat>& vv = *(const std::vector<Mat>*)obj;
|
||||
return vv.empty();
|
||||
}
|
||||
|
||||
@@ -1310,13 +1310,13 @@ bool _InputArray::empty() const
|
||||
_OutputArray::_OutputArray() {}
|
||||
_OutputArray::~_OutputArray() {}
|
||||
_OutputArray::_OutputArray(Mat& m) : _InputArray(m) {}
|
||||
_OutputArray::_OutputArray(vector<Mat>& vec) : _InputArray(vec) {}
|
||||
_OutputArray::_OutputArray(std::vector<Mat>& vec) : _InputArray(vec) {}
|
||||
_OutputArray::_OutputArray(gpu::GpuMat& d_mat) : _InputArray(d_mat) {}
|
||||
_OutputArray::_OutputArray(GlBuffer& buf) : _InputArray(buf) {}
|
||||
_OutputArray::_OutputArray(GlTexture2D& tex) : _InputArray(tex) {}
|
||||
|
||||
_OutputArray::_OutputArray(const Mat& m) : _InputArray(m) {flags |= FIXED_SIZE|FIXED_TYPE;}
|
||||
_OutputArray::_OutputArray(const vector<Mat>& vec) : _InputArray(vec) {flags |= FIXED_SIZE;}
|
||||
_OutputArray::_OutputArray(const std::vector<Mat>& vec) : _InputArray(vec) {flags |= FIXED_SIZE;}
|
||||
_OutputArray::_OutputArray(const gpu::GpuMat& d_mat) : _InputArray(d_mat) {flags |= FIXED_SIZE|FIXED_TYPE;}
|
||||
_OutputArray::_OutputArray(const GlBuffer& buf) : _InputArray(buf) {flags |= FIXED_SIZE|FIXED_TYPE;}
|
||||
_OutputArray::_OutputArray(const GlTexture2D& tex) : _InputArray(tex) {flags |= FIXED_SIZE|FIXED_TYPE;}
|
||||
@@ -1441,11 +1441,11 @@ void _OutputArray::create(int dims, const int* sizes, int mtype, int i, bool all
|
||||
{
|
||||
CV_Assert( dims == 2 && (sizes[0] == 1 || sizes[1] == 1 || sizes[0]*sizes[1] == 0) );
|
||||
size_t len = sizes[0]*sizes[1] > 0 ? sizes[0] + sizes[1] - 1 : 0;
|
||||
vector<uchar>* v = (vector<uchar>*)obj;
|
||||
std::vector<uchar>* v = (std::vector<uchar>*)obj;
|
||||
|
||||
if( k == STD_VECTOR_VECTOR )
|
||||
{
|
||||
vector<vector<uchar> >& vv = *(vector<vector<uchar> >*)obj;
|
||||
std::vector<std::vector<uchar> >& vv = *(std::vector<std::vector<uchar> >*)obj;
|
||||
if( i < 0 )
|
||||
{
|
||||
CV_Assert(!fixedSize() || len == vv.size());
|
||||
@@ -1462,56 +1462,56 @@ void _OutputArray::create(int dims, const int* sizes, int mtype, int i, bool all
|
||||
CV_Assert( mtype == type0 || (CV_MAT_CN(mtype) == CV_MAT_CN(type0) && ((1 << type0) & fixedDepthMask) != 0) );
|
||||
|
||||
int esz = CV_ELEM_SIZE(type0);
|
||||
CV_Assert(!fixedSize() || len == ((vector<uchar>*)v)->size() / esz);
|
||||
CV_Assert(!fixedSize() || len == ((std::vector<uchar>*)v)->size() / esz);
|
||||
switch( esz )
|
||||
{
|
||||
case 1:
|
||||
((vector<uchar>*)v)->resize(len);
|
||||
((std::vector<uchar>*)v)->resize(len);
|
||||
break;
|
||||
case 2:
|
||||
((vector<Vec2b>*)v)->resize(len);
|
||||
((std::vector<Vec2b>*)v)->resize(len);
|
||||
break;
|
||||
case 3:
|
||||
((vector<Vec3b>*)v)->resize(len);
|
||||
((std::vector<Vec3b>*)v)->resize(len);
|
||||
break;
|
||||
case 4:
|
||||
((vector<int>*)v)->resize(len);
|
||||
((std::vector<int>*)v)->resize(len);
|
||||
break;
|
||||
case 6:
|
||||
((vector<Vec3s>*)v)->resize(len);
|
||||
((std::vector<Vec3s>*)v)->resize(len);
|
||||
break;
|
||||
case 8:
|
||||
((vector<Vec2i>*)v)->resize(len);
|
||||
((std::vector<Vec2i>*)v)->resize(len);
|
||||
break;
|
||||
case 12:
|
||||
((vector<Vec3i>*)v)->resize(len);
|
||||
((std::vector<Vec3i>*)v)->resize(len);
|
||||
break;
|
||||
case 16:
|
||||
((vector<Vec4i>*)v)->resize(len);
|
||||
((std::vector<Vec4i>*)v)->resize(len);
|
||||
break;
|
||||
case 24:
|
||||
((vector<Vec6i>*)v)->resize(len);
|
||||
((std::vector<Vec6i>*)v)->resize(len);
|
||||
break;
|
||||
case 32:
|
||||
((vector<Vec8i>*)v)->resize(len);
|
||||
((std::vector<Vec8i>*)v)->resize(len);
|
||||
break;
|
||||
case 36:
|
||||
((vector<Vec<int, 9> >*)v)->resize(len);
|
||||
((std::vector<Vec<int, 9> >*)v)->resize(len);
|
||||
break;
|
||||
case 48:
|
||||
((vector<Vec<int, 12> >*)v)->resize(len);
|
||||
((std::vector<Vec<int, 12> >*)v)->resize(len);
|
||||
break;
|
||||
case 64:
|
||||
((vector<Vec<int, 16> >*)v)->resize(len);
|
||||
((std::vector<Vec<int, 16> >*)v)->resize(len);
|
||||
break;
|
||||
case 128:
|
||||
((vector<Vec<int, 32> >*)v)->resize(len);
|
||||
((std::vector<Vec<int, 32> >*)v)->resize(len);
|
||||
break;
|
||||
case 256:
|
||||
((vector<Vec<int, 64> >*)v)->resize(len);
|
||||
((std::vector<Vec<int, 64> >*)v)->resize(len);
|
||||
break;
|
||||
case 512:
|
||||
((vector<Vec<int, 128> >*)v)->resize(len);
|
||||
((std::vector<Vec<int, 128> >*)v)->resize(len);
|
||||
break;
|
||||
default:
|
||||
CV_Error_(CV_StsBadArg, ("Vectors with element size %d are not supported. Please, modify OutputArray::create()\n", esz));
|
||||
@@ -1528,7 +1528,7 @@ void _OutputArray::create(int dims, const int* sizes, int mtype, int i, bool all
|
||||
CV_Assert( k == STD_VECTOR_MAT );
|
||||
//if( k == STD_VECTOR_MAT )
|
||||
{
|
||||
vector<Mat>& v = *(vector<Mat>*)obj;
|
||||
std::vector<Mat>& v = *(std::vector<Mat>*)obj;
|
||||
|
||||
if( i < 0 )
|
||||
{
|
||||
@@ -1626,14 +1626,14 @@ void _OutputArray::release() const
|
||||
|
||||
if( k == STD_VECTOR_VECTOR )
|
||||
{
|
||||
((vector<vector<uchar> >*)obj)->clear();
|
||||
((std::vector<std::vector<uchar> >*)obj)->clear();
|
||||
return;
|
||||
}
|
||||
|
||||
CV_Assert( k == STD_VECTOR_MAT );
|
||||
//if( k == STD_VECTOR_MAT )
|
||||
{
|
||||
((vector<Mat>*)obj)->clear();
|
||||
((std::vector<Mat>*)obj)->clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1667,7 +1667,7 @@ Mat& _OutputArray::getMatRef(int i) const
|
||||
else
|
||||
{
|
||||
CV_Assert( k == STD_VECTOR_MAT );
|
||||
vector<Mat>& v = *(vector<Mat>*)obj;
|
||||
std::vector<Mat>& v = *(std::vector<Mat>*)obj;
|
||||
CV_Assert( i < (int)v.size() );
|
||||
return v[i];
|
||||
}
|
||||
@@ -1738,7 +1738,7 @@ void cv::hconcat(InputArray src1, InputArray src2, OutputArray dst)
|
||||
|
||||
void cv::hconcat(InputArray _src, OutputArray dst)
|
||||
{
|
||||
vector<Mat> src;
|
||||
std::vector<Mat> src;
|
||||
_src.getMatVector(src);
|
||||
hconcat(!src.empty() ? &src[0] : 0, src.size(), dst);
|
||||
}
|
||||
@@ -1778,7 +1778,7 @@ void cv::vconcat(InputArray src1, InputArray src2, OutputArray dst)
|
||||
|
||||
void cv::vconcat(InputArray _src, OutputArray dst)
|
||||
{
|
||||
vector<Mat> src;
|
||||
std::vector<Mat> src;
|
||||
_src.getMatVector(src);
|
||||
vconcat(!src.empty() ? &src[0] : 0, src.size(), dst);
|
||||
}
|
||||
@@ -2504,7 +2504,7 @@ void cv::sortIdx( InputArray _src, OutputArray _dst, int flags )
|
||||
namespace cv
|
||||
{
|
||||
|
||||
static void generateRandomCenter(const vector<Vec2f>& box, float* center, RNG& rng)
|
||||
static void generateRandomCenter(const std::vector<Vec2f>& box, float* center, RNG& rng)
|
||||
{
|
||||
size_t j, dims = box.size();
|
||||
float margin = 1.f/dims;
|
||||
@@ -2560,9 +2560,9 @@ static void generateCentersPP(const Mat& _data, Mat& _out_centers,
|
||||
int i, j, k, dims = _data.cols, N = _data.rows;
|
||||
const float* data = _data.ptr<float>(0);
|
||||
size_t step = _data.step/sizeof(data[0]);
|
||||
vector<int> _centers(K);
|
||||
std::vector<int> _centers(K);
|
||||
int* centers = &_centers[0];
|
||||
vector<float> _dist(N*3);
|
||||
std::vector<float> _dist(N*3);
|
||||
float* dist = &_dist[0], *tdist = dist + N, *tdist2 = tdist + N;
|
||||
double sum0 = 0;
|
||||
|
||||
@@ -2710,8 +2710,8 @@ double cv::kmeans( InputArray _data, int K,
|
||||
int* labels = _labels.ptr<int>();
|
||||
|
||||
Mat centers(K, dims, type), old_centers(K, dims, type), temp(1, dims, type);
|
||||
vector<int> counters(K);
|
||||
vector<Vec2f> _box(dims);
|
||||
std::vector<int> counters(K);
|
||||
std::vector<Vec2f> _box(dims);
|
||||
Vec2f* box = &_box[0];
|
||||
double best_compactness = DBL_MAX, compactness = 0;
|
||||
RNG& rng = theRNG();
|
||||
@@ -3973,7 +3973,7 @@ void SparseMat::resizeHashTab(size_t newsize)
|
||||
newsize = (size_t)1 << cvCeil(std::log((double)newsize)/CV_LOG2);
|
||||
|
||||
size_t i, hsize = hdr->hashtab.size();
|
||||
vector<size_t> _newh(newsize);
|
||||
std::vector<size_t> _newh(newsize);
|
||||
size_t* newh = &_newh[0];
|
||||
for( i = 0; i < newsize; i++ )
|
||||
newh[i] = 0;
|
||||
@@ -4062,7 +4062,7 @@ SparseMatConstIterator::SparseMatConstIterator(const SparseMat* _m)
|
||||
if(!_m || !_m->hdr)
|
||||
return;
|
||||
SparseMat::Hdr& hdr = *m->hdr;
|
||||
const vector<size_t>& htab = hdr.hashtab;
|
||||
const std::vector<size_t>& htab = hdr.hashtab;
|
||||
size_t i, hsize = htab.size();
|
||||
for( i = 0; i < hsize; i++ )
|
||||
{
|
||||
@@ -4252,10 +4252,10 @@ Rect RotatedRect::boundingRect() const
|
||||
{
|
||||
Point2f pt[4];
|
||||
points(pt);
|
||||
Rect r(cvFloor(min(min(min(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
|
||||
cvFloor(min(min(min(pt[0].y, pt[1].y), pt[2].y), pt[3].y)),
|
||||
cvCeil(max(max(max(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
|
||||
cvCeil(max(max(max(pt[0].y, pt[1].y), pt[2].y), pt[3].y)));
|
||||
Rect r(cvFloor(std::min(std::min(std::min(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
|
||||
cvFloor(std::min(std::min(std::min(pt[0].y, pt[1].y), pt[2].y), pt[3].y)),
|
||||
cvCeil(std::max(std::max(std::max(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
|
||||
cvCeil(std::max(std::max(std::max(pt[0].y, pt[1].y), pt[2].y), pt[3].y)));
|
||||
r.width -= r.x - 1;
|
||||
r.height -= r.y - 1;
|
||||
return r;
|
||||
|
@@ -53,10 +53,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace cv::gpu;
|
||||
|
||||
namespace
|
||||
{
|
||||
#ifndef HAVE_OPENGL
|
||||
@@ -363,7 +359,7 @@ private:
|
||||
#endif
|
||||
};
|
||||
|
||||
const Ptr<cv::GlBuffer::Impl>& cv::GlBuffer::Impl::empty()
|
||||
const cv::Ptr<cv::GlBuffer::Impl>& cv::GlBuffer::Impl::empty()
|
||||
{
|
||||
static Ptr<Impl> p(new Impl);
|
||||
return p;
|
||||
@@ -720,7 +716,7 @@ void cv::GlBuffer::copyTo(OutputArray arr, Target target, bool autoRelease) cons
|
||||
#endif
|
||||
}
|
||||
|
||||
GlBuffer cv::GlBuffer::clone(Target target, bool autoRelease) const
|
||||
cv::GlBuffer cv::GlBuffer::clone(Target target, bool autoRelease) const
|
||||
{
|
||||
#ifndef HAVE_OPENGL
|
||||
(void) target;
|
||||
@@ -755,14 +751,14 @@ void cv::GlBuffer::unbind(Target target)
|
||||
#endif
|
||||
}
|
||||
|
||||
Mat cv::GlBuffer::mapHost(Access access)
|
||||
cv::Mat cv::GlBuffer::mapHost(Access access)
|
||||
{
|
||||
#ifndef HAVE_OPENGL
|
||||
(void) access;
|
||||
throw_nogl();
|
||||
return Mat();
|
||||
return cv::Mat();
|
||||
#else
|
||||
return Mat(rows_, cols_, type_, impl_->mapHost(access));
|
||||
return cv::Mat(rows_, cols_, type_, impl_->mapHost(access));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -775,17 +771,17 @@ void cv::GlBuffer::unmapHost()
|
||||
#endif
|
||||
}
|
||||
|
||||
GpuMat cv::GlBuffer::mapDevice()
|
||||
cv::gpu::GpuMat cv::GlBuffer::mapDevice()
|
||||
{
|
||||
#ifndef HAVE_OPENGL
|
||||
throw_nogl();
|
||||
return GpuMat();
|
||||
return cv::gpu::GpuMat();
|
||||
#else
|
||||
#if !defined HAVE_CUDA || defined(CUDA_DISABLER)
|
||||
throw_nocuda();
|
||||
return GpuMat();
|
||||
return cv::gpu::GpuMat();
|
||||
#else
|
||||
return GpuMat(rows_, cols_, type_, impl_->mapDevice());
|
||||
return cv::gpu::GpuMat(rows_, cols_, type_, impl_->mapDevice());
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
@@ -854,7 +850,7 @@ private:
|
||||
bool autoRelease_;
|
||||
};
|
||||
|
||||
const Ptr<cv::GlTexture2D::Impl> cv::GlTexture2D::Impl::empty()
|
||||
const cv::Ptr<cv::GlTexture2D::Impl> cv::GlTexture2D::Impl::empty()
|
||||
{
|
||||
static Ptr<Impl> p(new Impl);
|
||||
return p;
|
||||
|
@@ -282,7 +282,7 @@ const Formatter* Formatter::setDefault(const Formatter* fmt)
|
||||
}
|
||||
|
||||
Formatted::Formatted(const Mat& _m, const Formatter* _fmt,
|
||||
const vector<int>& _params)
|
||||
const std::vector<int>& _params)
|
||||
{
|
||||
mtx = _m;
|
||||
fmt = _fmt ? _fmt : Formatter::get();
|
||||
|
@@ -116,7 +116,7 @@ static char* icv_itoa( int _val, char* buffer, int /*radix*/ )
|
||||
return ptr;
|
||||
}
|
||||
|
||||
cv::string cv::FileStorage::getDefaultObjectName(const string& _filename)
|
||||
std::string cv::FileStorage::getDefaultObjectName(const std::string& _filename)
|
||||
{
|
||||
static const char* stubname = "unnamed";
|
||||
const char* filename = _filename.c_str();
|
||||
@@ -152,7 +152,7 @@ cv::string cv::FileStorage::getDefaultObjectName(const string& _filename)
|
||||
name = name_buf;
|
||||
if( strcmp( name, "_" ) == 0 )
|
||||
strcpy( name, stubname );
|
||||
return cv::string(name);
|
||||
return std::string(name);
|
||||
}
|
||||
|
||||
typedef struct CvGenericHash
|
||||
@@ -5011,7 +5011,7 @@ cvSave( const char* filename, const void* struct_ptr,
|
||||
if( !fs )
|
||||
CV_Error( CV_StsError, "Could not open the file storage. Check the path and permissions" );
|
||||
|
||||
cv::string name = _name ? cv::string(_name) : cv::FileStorage::getDefaultObjectName(filename);
|
||||
std::string name = _name ? std::string(_name) : cv::FileStorage::getDefaultObjectName(filename);
|
||||
|
||||
if( comment )
|
||||
cvWriteComment( fs, comment, 0 );
|
||||
@@ -5105,7 +5105,7 @@ stop_search:
|
||||
namespace cv
|
||||
{
|
||||
|
||||
static void getElemSize( const string& fmt, size_t& elemSize, size_t& cn )
|
||||
static void getElemSize( const std::string& fmt, size_t& elemSize, size_t& cn )
|
||||
{
|
||||
const char* dt = fmt.c_str();
|
||||
cn = 1;
|
||||
@@ -5125,7 +5125,7 @@ FileStorage::FileStorage()
|
||||
state = UNDEFINED;
|
||||
}
|
||||
|
||||
FileStorage::FileStorage(const string& filename, int flags, const string& encoding)
|
||||
FileStorage::FileStorage(const std::string& filename, int flags, const std::string& encoding)
|
||||
{
|
||||
state = UNDEFINED;
|
||||
open( filename, flags, encoding );
|
||||
@@ -5146,7 +5146,7 @@ FileStorage::~FileStorage()
|
||||
}
|
||||
}
|
||||
|
||||
bool FileStorage::open(const string& filename, int flags, const string& encoding)
|
||||
bool FileStorage::open(const std::string& filename, int flags, const std::string& encoding)
|
||||
{
|
||||
release();
|
||||
fs = Ptr<CvFileStorage>(cvOpenFileStorage( filename.c_str(), 0, flags,
|
||||
@@ -5168,9 +5168,9 @@ void FileStorage::release()
|
||||
state = UNDEFINED;
|
||||
}
|
||||
|
||||
string FileStorage::releaseAndGetString()
|
||||
std::string FileStorage::releaseAndGetString()
|
||||
{
|
||||
string buf;
|
||||
std::string buf;
|
||||
buf.reserve(16); // HACK: Work around for compiler bug
|
||||
if( fs.obj && fs.obj->outbuf )
|
||||
icvClose(fs.obj, &buf);
|
||||
@@ -5184,7 +5184,7 @@ FileNode FileStorage::root(int streamidx) const
|
||||
return isOpened() ? FileNode(fs, cvGetRootFileNode(fs, streamidx)) : FileNode();
|
||||
}
|
||||
|
||||
FileStorage& operator << (FileStorage& fs, const string& str)
|
||||
FileStorage& operator << (FileStorage& fs, const std::string& str)
|
||||
{
|
||||
enum { NAME_EXPECTED = FileStorage::NAME_EXPECTED,
|
||||
VALUE_EXPECTED = FileStorage::VALUE_EXPECTED,
|
||||
@@ -5203,7 +5203,7 @@ FileStorage& operator << (FileStorage& fs, const string& str)
|
||||
fs.state = fs.structs.empty() || fs.structs.back() == '{' ?
|
||||
INSIDE_MAP + NAME_EXPECTED : VALUE_EXPECTED;
|
||||
cvEndWriteStruct( *fs );
|
||||
fs.elname = string();
|
||||
fs.elname = std::string();
|
||||
}
|
||||
else if( fs.state == NAME_EXPECTED + INSIDE_MAP )
|
||||
{
|
||||
@@ -5227,12 +5227,12 @@ FileStorage& operator << (FileStorage& fs, const string& str)
|
||||
}
|
||||
cvStartWriteStruct( *fs, fs.elname.size() > 0 ? fs.elname.c_str() : 0,
|
||||
flags, *_str ? _str : 0 );
|
||||
fs.elname = string();
|
||||
fs.elname = std::string();
|
||||
}
|
||||
else
|
||||
{
|
||||
write( fs, fs.elname, (_str[0] == '\\' && (_str[1] == '{' || _str[1] == '}' ||
|
||||
_str[1] == '[' || _str[1] == ']')) ? string(_str+1) : str );
|
||||
_str[1] == '[' || _str[1] == ']')) ? std::string(_str+1) : str );
|
||||
if( fs.state == INSIDE_MAP + VALUE_EXPECTED )
|
||||
fs.state = INSIDE_MAP + NAME_EXPECTED;
|
||||
}
|
||||
@@ -5243,7 +5243,7 @@ FileStorage& operator << (FileStorage& fs, const string& str)
|
||||
}
|
||||
|
||||
|
||||
void FileStorage::writeRaw( const string& fmt, const uchar* vec, size_t len )
|
||||
void FileStorage::writeRaw( const std::string& fmt, const uchar* vec, size_t len )
|
||||
{
|
||||
if( !isOpened() )
|
||||
return;
|
||||
@@ -5254,7 +5254,7 @@ void FileStorage::writeRaw( const string& fmt, const uchar* vec, size_t len )
|
||||
}
|
||||
|
||||
|
||||
void FileStorage::writeObj( const string& name, const void* obj )
|
||||
void FileStorage::writeObj( const std::string& name, const void* obj )
|
||||
{
|
||||
if( !isOpened() )
|
||||
return;
|
||||
@@ -5262,7 +5262,7 @@ void FileStorage::writeObj( const string& name, const void* obj )
|
||||
}
|
||||
|
||||
|
||||
FileNode FileStorage::operator[](const string& nodename) const
|
||||
FileNode FileStorage::operator[](const std::string& nodename) const
|
||||
{
|
||||
return FileNode(fs, cvGetFileNodeByName(fs, 0, nodename.c_str()));
|
||||
}
|
||||
@@ -5272,7 +5272,7 @@ FileNode FileStorage::operator[](const char* nodename) const
|
||||
return FileNode(fs, cvGetFileNodeByName(fs, 0, nodename));
|
||||
}
|
||||
|
||||
FileNode FileNode::operator[](const string& nodename) const
|
||||
FileNode FileNode::operator[](const std::string& nodename) const
|
||||
{
|
||||
return FileNode(fs, cvGetFileNodeByName(fs, node, nodename.c_str()));
|
||||
}
|
||||
@@ -5288,10 +5288,10 @@ FileNode FileNode::operator[](int i) const
|
||||
i == 0 ? *this : FileNode();
|
||||
}
|
||||
|
||||
string FileNode::name() const
|
||||
std::string FileNode::name() const
|
||||
{
|
||||
const char* str;
|
||||
return !node || (str = cvGetFileNodeName(node)) == 0 ? string() : string(str);
|
||||
return !node || (str = cvGetFileNodeName(node)) == 0 ? std::string() : std::string(str);
|
||||
}
|
||||
|
||||
void* FileNode::readObj() const
|
||||
@@ -5406,7 +5406,7 @@ FileNodeIterator& FileNodeIterator::operator -= (int ofs)
|
||||
}
|
||||
|
||||
|
||||
FileNodeIterator& FileNodeIterator::readRaw( const string& fmt, uchar* vec, size_t maxCount )
|
||||
FileNodeIterator& FileNodeIterator::readRaw( const std::string& fmt, uchar* vec, size_t maxCount )
|
||||
{
|
||||
if( fs && container && remaining > 0 )
|
||||
{
|
||||
@@ -5430,16 +5430,16 @@ FileNodeIterator& FileNodeIterator::readRaw( const string& fmt, uchar* vec, size
|
||||
}
|
||||
|
||||
|
||||
void write( FileStorage& fs, const string& name, int value )
|
||||
void write( FileStorage& fs, const std::string& name, int value )
|
||||
{ cvWriteInt( *fs, name.size() ? name.c_str() : 0, value ); }
|
||||
|
||||
void write( FileStorage& fs, const string& name, float value )
|
||||
void write( FileStorage& fs, const std::string& name, float value )
|
||||
{ cvWriteReal( *fs, name.size() ? name.c_str() : 0, value ); }
|
||||
|
||||
void write( FileStorage& fs, const string& name, double value )
|
||||
void write( FileStorage& fs, const std::string& name, double value )
|
||||
{ cvWriteReal( *fs, name.size() ? name.c_str() : 0, value ); }
|
||||
|
||||
void write( FileStorage& fs, const string& name, const string& value )
|
||||
void write( FileStorage& fs, const std::string& name, const std::string& value )
|
||||
{ cvWriteString( *fs, name.size() ? name.c_str() : 0, value.c_str() ); }
|
||||
|
||||
void writeScalar(FileStorage& fs, int value )
|
||||
@@ -5451,11 +5451,11 @@ void writeScalar(FileStorage& fs, float value )
|
||||
void writeScalar(FileStorage& fs, double value )
|
||||
{ cvWriteReal( *fs, 0, value ); }
|
||||
|
||||
void writeScalar(FileStorage& fs, const string& value )
|
||||
void writeScalar(FileStorage& fs, const std::string& value )
|
||||
{ cvWriteString( *fs, 0, value.c_str() ); }
|
||||
|
||||
|
||||
void write( FileStorage& fs, const string& name, const Mat& value )
|
||||
void write( FileStorage& fs, const std::string& name, const Mat& value )
|
||||
{
|
||||
if( value.dims <= 2 )
|
||||
{
|
||||
@@ -5470,15 +5470,15 @@ void write( FileStorage& fs, const string& name, const Mat& value )
|
||||
}
|
||||
|
||||
// TODO: the 4 functions below need to be implemented more efficiently
|
||||
void write( FileStorage& fs, const string& name, const SparseMat& value )
|
||||
void write( FileStorage& fs, const std::string& name, const SparseMat& value )
|
||||
{
|
||||
Ptr<CvSparseMat> mat = (CvSparseMat*)value;
|
||||
cvWrite( *fs, name.size() ? name.c_str() : 0, mat );
|
||||
}
|
||||
|
||||
|
||||
WriteStructContext::WriteStructContext(FileStorage& _fs, const string& name,
|
||||
int flags, const string& typeName) : fs(&_fs)
|
||||
WriteStructContext::WriteStructContext(FileStorage& _fs, const std::string& name,
|
||||
int flags, const std::string& typeName) : fs(&_fs)
|
||||
{
|
||||
cvStartWriteStruct(**fs, !name.empty() ? name.c_str() : 0, flags,
|
||||
!typeName.empty() ? typeName.c_str() : 0);
|
||||
|
@@ -537,13 +537,13 @@ void RNG::fill( InputOutputArray _mat, int disttype,
|
||||
ip = (Vec2i*)(parambuf + cn*2);
|
||||
for( j = 0, fast_int_mode = 1; j < cn; j++ )
|
||||
{
|
||||
double a = min(p1[j], p2[j]);
|
||||
double b = max(p1[j], p2[j]);
|
||||
double a = std::min(p1[j], p2[j]);
|
||||
double b = std::max(p1[j], p2[j]);
|
||||
if( saturateRange )
|
||||
{
|
||||
a = max(a, depth == CV_8U || depth == CV_16U ? 0. :
|
||||
a = std::max(a, depth == CV_8U || depth == CV_16U ? 0. :
|
||||
depth == CV_8S ? -128. : depth == CV_16S ? -32768. : (double)INT_MIN);
|
||||
b = min(b, depth == CV_8U ? 256. : depth == CV_16U ? 65536. :
|
||||
b = std::min(b, depth == CV_8U ? 256. : depth == CV_16U ? 65536. :
|
||||
depth == CV_8S ? 128. : depth == CV_16S ? 32768. : (double)INT_MAX);
|
||||
}
|
||||
ip[j][1] = cvCeil(a);
|
||||
@@ -573,8 +573,8 @@ void RNG::fill( InputOutputArray _mat, int disttype,
|
||||
while(((uint64)1 << l) < d)
|
||||
l++;
|
||||
ds[j].M = (unsigned)(((uint64)1 << 32)*(((uint64)1 << l) - d)/d) + 1;
|
||||
ds[j].sh1 = min(l, 1);
|
||||
ds[j].sh2 = max(l - 1, 0);
|
||||
ds[j].sh1 = std::min(l, 1);
|
||||
ds[j].sh2 = std::max(l - 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -113,7 +113,7 @@ namespace cv
|
||||
|
||||
Exception::Exception() { code = 0; line = 0; }
|
||||
|
||||
Exception::Exception(int _code, const string& _err, const string& _func, const string& _file, int _line)
|
||||
Exception::Exception(int _code, const std::string& _err, const std::string& _func, const std::string& _file, int _line)
|
||||
: code(_code), err(_err), func(_func), file(_file), line(_line)
|
||||
{
|
||||
formatMessage();
|
||||
@@ -348,19 +348,19 @@ const std::string& getBuildInformation()
|
||||
return build_info;
|
||||
}
|
||||
|
||||
string format( const char* fmt, ... )
|
||||
std::string format( const char* fmt, ... )
|
||||
{
|
||||
char buf[1 << 16];
|
||||
va_list args;
|
||||
va_start( args, fmt );
|
||||
vsprintf( buf, fmt, args );
|
||||
return string(buf);
|
||||
return std::string(buf);
|
||||
}
|
||||
|
||||
string tempfile( const char* suffix )
|
||||
std::string tempfile( const char* suffix )
|
||||
{
|
||||
const char *temp_dir = getenv("OPENCV_TEMP_PATH");
|
||||
string fname;
|
||||
std::string fname;
|
||||
|
||||
#if defined WIN32 || defined _WIN32
|
||||
char temp_dir2[MAX_PATH + 1] = { 0 };
|
||||
@@ -372,7 +372,7 @@ string tempfile( const char* suffix )
|
||||
temp_dir = temp_dir2;
|
||||
}
|
||||
if(0 == ::GetTempFileNameA(temp_dir, "ocv", 0, temp_file))
|
||||
return string();
|
||||
return std::string();
|
||||
|
||||
DeleteFileA(temp_file);
|
||||
|
||||
@@ -397,7 +397,7 @@ string tempfile( const char* suffix )
|
||||
}
|
||||
|
||||
const int fd = mkstemp((char*)fname.c_str());
|
||||
if (fd == -1) return string();
|
||||
if (fd == -1) return std::string();
|
||||
|
||||
close(fd);
|
||||
remove(fname.c_str());
|
||||
|
Reference in New Issue
Block a user