46 #ifndef __OPENCV_CORE_HPP__
47 #define __OPENCV_CORE_HPP__
63 #endif // SKIP_INCLUDES
84 typedef std::string
String;
85 typedef std::basic_string<wchar_t>
WString;
131 Exception(
int _code,
const string& _err,
const string& _func,
const string& _file,
int _line)
132 : code(_code), err(_err), func(_func), file(_file),
line(_line)
140 virtual const char *
what()
const throw() {
return msg.c_str(); }
144 if( func.size() > 0 )
145 msg =
format(
"%s:%d: error: (%d) %s in function %s\n", file.c_str(),
line, code, err.c_str(), func.c_str());
147 msg =
format(
"%s:%d: error: (%d) %s\n", file.c_str(),
line, code, err.c_str());
182 const char* err_msg,
const char* file_name,
183 int line,
void* userdata );
197 void* userdata=0,
void** prevUserdata=0);
200 #define CV_Error( code, msg ) cv::error( cv::Exception(code, msg, __func__, __FILE__, __LINE__) )
201 #define CV_Error_( code, args ) cv::error( cv::Exception(code, cv::format args, __func__, __FILE__, __LINE__) )
202 #define CV_Assert( expr ) if((expr)) ; else cv::error( cv::Exception(CV_StsAssert, #expr, __func__, __FILE__, __LINE__) )
204 #define CV_Error( code, msg ) cv::error( cv::Exception(code, msg, "", __FILE__, __LINE__) )
205 #define CV_Error_( code, args ) cv::error( cv::Exception(code, cv::format args, "", __FILE__, __LINE__) )
206 #define CV_Assert( expr ) if((expr)) ; else cv::error( cv::Exception(CV_StsAssert, #expr, "", __FILE__, __LINE__) )
210 #define CV_DbgAssert(expr) CV_Assert(expr)
212 #define CV_DbgAssert(expr)
293 template<
typename _Tp>
static inline _Tp* allocate(
size_t n)
298 template<
typename _Tp>
static inline void deallocate(_Tp* ptr,
size_t)
309 template<
typename _Tp>
static inline _Tp* alignPtr(_Tp* ptr,
int n=(
int)
sizeof(_Tp))
311 return (_Tp*)(((size_t)ptr + n-1) & -n);
319 static inline size_t alignSize(
size_t sz,
int n)
321 return (sz + n-1) & -n;
373 {
return max(static_cast<_Tp>(-1)/
sizeof(_Tp), 1); }
389 template<>
class DataDepth<bool> {
public:
enum { value =
CV_8U, fmt=(int)
'u' }; };
392 template<>
class DataDepth<char> {
public:
enum { value =
CV_8S, fmt=(int)
'c' }; };
397 template<>
class DataDepth<unsigned> {
public:
enum { value =
CV_32S, fmt=(int)
'i' }; };
399 template<>
class DataDepth<double> {
public:
enum { value =
CV_64F, fmt=(int)
'd' }; };
441 Matx(_Tp v0, _Tp v1);
442 Matx(_Tp v0, _Tp v1, _Tp v2);
443 Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3);
444 Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4);
445 Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5);
446 Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6);
447 Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7);
448 Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8);
449 Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9);
450 Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3,
451 _Tp v4, _Tp v5, _Tp v6, _Tp v7,
452 _Tp v8, _Tp v9, _Tp v10, _Tp v11);
453 Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3,
454 _Tp v4, _Tp v5, _Tp v6, _Tp v7,
455 _Tp v8, _Tp v9, _Tp v10, _Tp v11,
456 _Tp v12, _Tp v13, _Tp v14, _Tp v15);
457 explicit Matx(
const _Tp* vals);
459 static Matx all(_Tp alpha);
463 static Matx diag(
const diag_type& d);
464 static Matx randu(_Tp a, _Tp b);
505 const _Tp& operator ()(
int i,
int j)
const;
506 _Tp& operator ()(
int i,
int j);
509 const _Tp& operator ()(
int i)
const;
510 _Tp& operator ()(
int i);
588 Vec(_Tp v0, _Tp v1, _Tp v2);
589 Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3);
590 Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4);
591 Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5);
592 Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6);
593 Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7);
594 Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8);
595 Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9);
596 explicit Vec(
const _Tp* values);
599 static Vec all(_Tp alpha);
609 Vec cross(
const Vec& v)
const;
611 template<
typename T2>
operator Vec<T2, cn>()
const;
616 const _Tp& operator [](
int i)
const;
617 _Tp& operator[](
int i);
618 const _Tp& operator ()(
int i)
const;
619 _Tp& operator ()(
int i);
670 Complex(
const std::complex<_Tp>& c );
673 template<
typename T2>
operator Complex<T2>()
const;
677 operator std::complex<_Tp>()
const;
725 double ddot(
const Point_& pt)
const;
747 Point3_(_Tp _x, _Tp _y, _Tp _z);
764 double ddot(
const Point3_& pt)
const;
786 Size_(_Tp _width, _Tp _height);
797 template<
typename _Tp2>
operator Size_<_Tp2>()
const;
821 Rect_(_Tp _x, _Tp _y, _Tp _width, _Tp _height);
839 template<
typename _Tp2>
operator Rect_<_Tp2>()
const;
846 _Tp
x,
y, width, height;
880 RotatedRect(
const Point2f& _center,
const Size2f& _size,
float _angle);
884 void points(Point2f pts[])
const;
908 Scalar_(_Tp v0, _Tp v1, _Tp v2=0, _Tp v3=0);
918 template<
typename T2>
operator Scalar_<T2>()
const;
945 Range(
int _start,
int _end);
1101 template<
typename _Tp>
class DataType<std::complex<_Tp> >
1233 Ptr& operator = (
const Ptr& ptr);
1245 _Tp* operator -> ();
1246 const _Tp* operator -> ()
const;
1249 operator const _Tp*()
const;
1260 static inline size_t getElemSize(
int type) {
return CV_ELEM_SIZE(type); }
1271 virtual void allocate(
int dims,
const int* sizes,
int type,
int*& refcount,
1272 uchar*& datastart,
uchar*& data,
size_t* step) = 0;
1273 virtual void deallocate(
int* refcount,
uchar* datastart,
uchar* data) = 0;
1495 Mat(
int _rows,
int _cols,
int _type);
1496 Mat(Size _size,
int _type);
1498 Mat(
int _rows,
int _cols,
int _type,
const Scalar& _s);
1499 Mat(Size _size,
int _type,
const Scalar& _s);
1502 Mat(
int _ndims,
const int* _sizes,
int _type);
1503 Mat(
int _ndims,
const int* _sizes,
int _type,
const Scalar& _s);
1508 Mat(
int _rows,
int _cols,
int _type,
void* _data,
size_t _step=AUTO_STEP);
1509 Mat(Size _size,
int _type,
void* _data,
size_t _step=AUTO_STEP);
1510 Mat(
int _ndims,
const int* _sizes,
int _type,
void* _data,
const size_t* _steps=0);
1514 Mat(
const Mat& m,
const Rect& roi);
1517 Mat(
const CvMat* m,
bool copyData=
false);
1523 template<
typename _Tp>
explicit Mat(
const vector<_Tp>& vec,
bool copyData=
false);
1525 template<
typename _Tp,
int n>
explicit Mat(
const Vec<_Tp, n>& vec,
1526 bool copyData=
true);
1528 template<
typename _Tp,
int m,
int n>
explicit Mat(
const Matx<_Tp, m, n>& mtx,
1529 bool copyData=
true);
1531 template<
typename _Tp>
explicit Mat(
const Point_<_Tp>& pt,
bool copyData=
true);
1533 template<
typename _Tp>
explicit Mat(
const Point3_<_Tp>& pt,
bool copyData=
true);
1539 Mat& operator = (
const Mat& m);
1540 Mat& operator = (
const MatExpr& expr);
1543 Mat row(
int y)
const;
1545 Mat col(
int x)
const;
1547 Mat rowRange(
int startrow,
int endrow)
const;
1548 Mat rowRange(
const Range& r)
const;
1550 Mat colRange(
int startcol,
int endcol)
const;
1551 Mat colRange(
const Range& r)
const;
1556 Mat diag(
int d=0)
const;
1558 static Mat diag(
const Mat& d);
1564 void copyTo( Mat& m )
const;
1565 template<
typename _Tp>
void copyTo( vector<_Tp>& v )
const;
1567 void copyTo( Mat& m,
const Mat&
mask )
const;
1569 void convertTo( Mat& m,
int rtype,
double alpha=1,
double beta=0 )
const;
1571 void assignTo( Mat& m,
int type=-1 )
const;
1574 Mat& operator = (
const Scalar& s);
1576 Mat& setTo(
const Scalar& s,
const Mat& mask=Mat());
1579 Mat reshape(
int _cn,
int _rows=0)
const;
1580 Mat reshape(
int _cn,
int _newndims,
const int* _newsz)
const;
1591 Mat cross(
const Mat& m)
const;
1593 double dot(
const Mat& m)
const;
1596 static MatExpr zeros(
int rows,
int cols,
int type);
1597 static MatExpr zeros(Size size,
int type);
1598 static MatExpr zeros(
int ndims,
const int* sz,
int type);
1599 static MatExpr ones(
int rows,
int cols,
int type);
1600 static MatExpr ones(Size size,
int type);
1601 static MatExpr ones(
int ndims,
const int* sz,
int type);
1602 static MatExpr eye(
int rows,
int cols,
int type);
1603 static MatExpr eye(Size size,
int type);
1607 void create(
int _rows,
int _cols,
int _type);
1608 void create(Size _size,
int _type);
1609 void create(
int _ndims,
const int* _sizes,
int _type);
1620 void copySize(
const Mat& m);
1623 void reserve(
size_t sz);
1627 void resize(
size_t sz,
const Scalar& s);
1629 void push_back_(
const void* elem);
1631 template<
typename _Tp>
void push_back(
const _Tp& elem);
1632 template<
typename _Tp>
void push_back(
const Mat_<_Tp>& elem);
1633 void push_back(
const Mat& m);
1635 void pop_back(
size_t nelems=1);
1638 void locateROI( Size& wholeSize, Point& ofs )
const;
1640 Mat& adjustROI(
int dtop,
int dbottom,
int dleft,
int dright );
1643 Mat operator()(
Range rowRange,
Range colRange )
const;
1644 Mat operator()(
const Rect& roi )
const;
1645 Mat operator()(
const Range* ranges )
const;
1648 operator CvMat()
const;
1654 template<
typename _Tp>
operator vector<_Tp>()
const;
1655 template<
typename _Tp,
int n>
operator Vec<_Tp, n>()
const;
1656 template<
typename _Tp,
int m,
int n>
operator Matx<_Tp, m, n>()
const;
1661 bool isContinuous()
const;
1664 bool isSubmatrix()
const;
1668 size_t elemSize()
const;
1670 size_t elemSize1()
const;
1676 int channels()
const;
1678 size_t step1(
int i=0)
const;
1682 size_t total()
const;
1685 int checkVector(
int elemChannels,
int depth=-1,
bool requireContinuous=
true)
const;
1688 uchar* ptr(
int i0=0);
1689 const uchar* ptr(
int i0=0)
const;
1692 uchar* ptr(
int i0,
int i1);
1693 const uchar* ptr(
int i0,
int i1)
const;
1696 uchar* ptr(
int i0,
int i1,
int i2);
1697 const uchar* ptr(
int i0,
int i1,
int i2)
const;
1700 uchar* ptr(
const int* idx);
1702 const uchar* ptr(
const int* idx)
const;
1708 template<
typename _Tp> _Tp* ptr(
int i0=0);
1709 template<
typename _Tp>
const _Tp* ptr(
int i0=0)
const;
1711 template<
typename _Tp> _Tp* ptr(
int i0,
int i1);
1712 template<
typename _Tp>
const _Tp* ptr(
int i0,
int i1)
const;
1714 template<
typename _Tp> _Tp* ptr(
int i0,
int i1,
int i2);
1715 template<
typename _Tp>
const _Tp* ptr(
int i0,
int i1,
int i2)
const;
1717 template<
typename _Tp> _Tp* ptr(
const int* idx);
1718 template<
typename _Tp>
const _Tp* ptr(
const int* idx)
const;
1720 template<
typename _Tp,
int n> _Tp* ptr(
const Vec<int, n>& idx);
1721 template<
typename _Tp,
int n>
const _Tp* ptr(
const Vec<int, n>& idx)
const;
1724 template<
typename _Tp> _Tp& at(
int i0=0);
1725 template<
typename _Tp>
const _Tp& at(
int i0=0)
const;
1727 template<
typename _Tp> _Tp& at(
int i0,
int i1);
1728 template<
typename _Tp>
const _Tp& at(
int i0,
int i1)
const;
1730 template<
typename _Tp> _Tp& at(
int i0,
int i1,
int i2);
1731 template<
typename _Tp>
const _Tp& at(
int i0,
int i1,
int i2)
const;
1733 template<
typename _Tp> _Tp& at(
const int* idx);
1734 template<
typename _Tp>
const _Tp& at(
const int* idx)
const;
1736 template<
typename _Tp,
int n> _Tp& at(
const Vec<int, n>& idx);
1737 template<
typename _Tp,
int n>
const _Tp& at(
const Vec<int, n>& idx)
const;
1740 template<
typename _Tp> _Tp& at(Point pt);
1741 template<
typename _Tp>
const _Tp& at(Point pt)
const;
1781 Size operator()()
const;
1782 int operator[](
int i)
const;
1783 int& operator[](
int i);
1784 operator const int*()
const;
1795 size_t operator[](
int i)
const;
1796 size_t& operator[](
int i);
1797 operator size_t()
const;
1798 MStep& operator = (
size_t s);
1803 MStep& operator = (
const MStep&);
1819 enum { A=4164903690U, UNIFORM=0, NORMAL=1 };
1830 operator unsigned();
1832 unsigned operator()(
unsigned N);
1833 unsigned operator ()();
1838 int uniform(
int a,
int b);
1840 float uniform(
float a,
float b);
1842 double uniform(
double a,
double b);
1843 void fill(
Mat& mat,
int distType,
const Scalar& a,
const Scalar& b );
1845 double gaussian(
double sigma);
1869 TermCriteria(
int _type,
int _maxCount,
double _epsilon);
1885 bool allowND=
true,
int coiMode=0);
1917 double beta,
double gamma,
CV_OUT Mat& dst);
1952 int* minIdx=0,
int* maxIdx=0,
const Mat&
mask=
Mat());
1968 const int* fromTo,
size_t npairs);
1970 const int* fromTo,
int npairs);
2042 bool angleInDegrees=
false);
2045 bool angleInDegrees=
false);
2050 double minVal=-DBL_MAX,
double maxVal=DBL_MAX);
2057 double scale=1,
int rtype=-1 );
2090 int lowindex=-1,
int highindex=-1);
2158 PCA(
const Mat& data,
const Mat& mean,
int flags,
int maxComponents=0);
2160 PCA& operator()(
const Mat& data,
const Mat& mean,
int flags,
int maxComponents=0);
2162 Mat project(
const Mat& vec)
const;
2164 void project(
const Mat& vec,
CV_OUT Mat& result)
const;
2166 Mat backProject(
const Mat& vec)
const;
2168 void backProject(
const Mat& vec,
CV_OUT Mat& result)
const;
2191 enum { MODIFY_A=1, NO_UV=2, FULL_UV=4 };
2204 static void backSubst(
const Mat& w,
const Mat& u,
const Mat& vt,
2207 template<
typename _Tp,
int m,
int n,
int nm>
static void compute(
const Matx<_Tp, m, n>& a,
2209 template<
typename _Tp,
int m,
int n,
int nm>
static void compute(
const Matx<_Tp, m, n>& a,
2211 template<
typename _Tp,
int m,
int n,
int nm,
int nb>
static void backSubst(
const Matx<_Tp, nm, 1>& w,
2212 const Matx<_Tp, m, nm>& u,
const Matx<_Tp, n, nm>& vt,
const Matx<_Tp, m, nb>& rhs,
Matx<_Tp, n, nb>& dst );
2217 void backSubst(
const Mat& rhs,
CV_OUT Mat& dst )
const;
2237 int flags,
bool conjB=
false);
2252 TermCriteria criteria,
int attempts,
2259 template<
typename _Tp>
static inline _Tp randu() {
return (_Tp)
theRNG(); }
2271 CV_EXPORTS_W void line(Mat& img, Point pt1, Point pt2,
const Scalar& color,
2272 int thickness=1,
int lineType=8,
int shift=0);
2276 const Scalar& color,
int thickness=1,
2277 int lineType=8,
int shift=0);
2281 const Scalar& color,
int thickness=1,
2282 int lineType=8,
int shift=0);
2286 const Scalar& color,
int thickness=1,
2287 int lineType=8,
int shift=0);
2291 double angle,
double startAngle,
double endAngle,
2292 const Scalar& color,
int thickness=1,
2293 int lineType=8,
int shift=0);
2297 int thickness=1,
int lineType=8);
2301 const Scalar& color,
int lineType=8,
2306 const int* npts,
int ncontours,
2307 const Scalar& color,
int lineType=8,
int shift=0,
2308 Point offset=
Point() );
2312 int ncontours,
bool isClosed,
const Scalar& color,
2313 int thickness=1,
int lineType=8,
int shift=0 );
2332 int connectivity=8,
bool leftToRight=
false );
2352 int arcStart,
int arcEnd,
int delta,
2353 CV_OUT vector<Point>& pts );
2370 int fontFace,
double fontScale, Scalar color,
2371 int thickness=1,
int linetype=8,
2372 bool bottomLeftOrigin=
false );
2376 double fontScale,
int thickness,
2437 Mat_(
int _rows,
int _cols);
2439 Mat_(
int _rows,
int _cols,
const _Tp& value);
2441 explicit Mat_(Size _size);
2443 Mat_(Size _size,
const _Tp& value);
2445 Mat_(
int _ndims,
const int* _sizes);
2447 Mat_(
int _ndims,
const int* _sizes,
const _Tp& value);
2453 Mat_(
int _rows,
int _cols, _Tp* _data,
size_t _step=AUTO_STEP);
2455 Mat_(
int _ndims,
const int* _sizes, _Tp* _data,
const size_t* _steps=0);
2459 Mat_(
const Mat_& m,
const Rect& roi);
2463 explicit Mat_(
const vector<_Tp>& vec,
bool copyData=
false);
2470 Mat_& operator = (
const Mat& m);
2473 Mat_& operator = (
const _Tp& s);
2482 void create(
int _rows,
int _cols);
2484 void create(Size _size);
2486 void create(
int _ndims,
const int* _sizes);
2492 template<
typename T2>
operator Mat_<T2>()
const;
2494 Mat_ row(
int y)
const;
2495 Mat_ col(
int x)
const;
2496 Mat_ diag(
int d=0)
const;
2500 size_t elemSize()
const;
2501 size_t elemSize1()
const;
2504 int channels()
const;
2505 size_t step1(
int i=0)
const;
2507 size_t stepT(
int i=0)
const;
2510 static MatExpr zeros(
int rows,
int cols);
2511 static MatExpr zeros(Size size);
2512 static MatExpr zeros(
int _ndims,
const int* _sizes);
2513 static MatExpr ones(
int rows,
int cols);
2514 static MatExpr ones(Size size);
2515 static MatExpr ones(
int _ndims,
const int* _sizes);
2516 static MatExpr eye(
int rows,
int cols);
2517 static MatExpr eye(Size size);
2520 Mat_ reshape(
int _rows)
const;
2521 Mat_& adjustROI(
int dtop,
int dbottom,
int dleft,
int dright );
2522 Mat_ operator()(
const Range& rowRange,
const Range& colRange )
const;
2523 Mat_ operator()(
const Rect& roi )
const;
2524 Mat_ operator()(
const Range* ranges )
const;
2527 _Tp* operator [](
int y);
2528 const _Tp* operator [](
int y)
const;
2531 _Tp& operator ()(
const int* idx);
2533 const _Tp& operator ()(
const int* idx)
const;
2536 template<
int n> _Tp& operator ()(
const Vec<int, n>& idx);
2538 template<
int n>
const _Tp& operator ()(
const Vec<int, n>& idx)
const;
2541 _Tp& operator ()(
int idx0);
2543 const _Tp& operator ()(
int idx0)
const;
2545 _Tp& operator ()(
int idx0,
int idx1);
2547 const _Tp& operator ()(
int idx0,
int idx1)
const;
2549 _Tp& operator ()(
int idx0,
int idx1,
int idx2);
2551 const _Tp& operator ()(
int idx0,
int idx1,
int idx2)
const;
2553 _Tp& operator ()(Point pt);
2554 const _Tp& operator ()(Point pt)
const;
2557 operator vector<_Tp>()
const;
2623 uchar* operator [](ptrdiff_t i)
const;
2640 void pos(
int* _idx)
const;
2641 ptrdiff_t lpos()
const;
2642 void seek(ptrdiff_t ofs,
bool relative=
false);
2643 void seek(
const int* _idx,
bool relative=
false);
2656 template<
typename _Tp>
2684 _Tp operator [](ptrdiff_t i)
const;
2707 template<
typename _Tp>
2733 _Tp& operator [](ptrdiff_t i)
const;
2838 void allocate(
size_t _size);
2844 operator const _Tp* ()
const;
2852 _Tp buf[fixed_size];
2915 void init(
const Mat** arrays,
Mat* planes,
int narrays=-1);
3046 Hdr(
int _dims,
const int* _sizes,
int _type);
3073 SparseMat(
int dims,
const int* _sizes,
int _type);
3099 void copyTo(
Mat& m )
const;
3101 void convertTo(
SparseMat& m,
int rtype,
double alpha=1 )
const;
3108 void convertTo(
Mat& m,
int rtype,
double alpha=1,
double beta=0 )
const;
3111 void assignTo(
SparseMat& m,
int type=-1 )
const;
3119 void create(
int dims,
const int* _sizes,
int _type);
3130 size_t elemSize()
const;
3132 size_t elemSize1()
const;
3139 int channels()
const;
3142 const int* size()
const;
3144 int size(
int i)
const;
3148 size_t nzcount()
const;
3151 size_t hash(
int i0)
const;
3153 size_t hash(
int i0,
int i1)
const;
3155 size_t hash(
int i0,
int i1,
int i2)
const;
3157 size_t hash(
const int* idx)
const;
3174 uchar* ptr(
int i0,
bool createMissing,
size_t* hashval=0);
3176 uchar* ptr(
int i0,
int i1,
bool createMissing,
size_t* hashval=0);
3178 uchar* ptr(
int i0,
int i1,
int i2,
bool createMissing,
size_t* hashval=0);
3180 uchar* ptr(
const int* idx,
bool createMissing,
size_t* hashval=0);
3192 template<
typename _Tp> _Tp& ref(
int i0,
size_t* hashval=0);
3194 template<
typename _Tp> _Tp& ref(
int i0,
int i1,
size_t* hashval=0);
3196 template<
typename _Tp> _Tp& ref(
int i0,
int i1,
int i2,
size_t* hashval=0);
3198 template<
typename _Tp> _Tp& ref(
const int* idx,
size_t* hashval=0);
3214 template<
typename _Tp> _Tp value(
int i0,
size_t* hashval=0)
const;
3216 template<
typename _Tp> _Tp value(
int i0,
int i1,
size_t* hashval=0)
const;
3218 template<
typename _Tp> _Tp value(
int i0,
int i1,
int i2,
size_t* hashval=0)
const;
3220 template<
typename _Tp> _Tp value(
const int* idx,
size_t* hashval=0)
const;
3232 template<
typename _Tp>
const _Tp* find(
int i0,
size_t* hashval=0)
const;
3234 template<
typename _Tp>
const _Tp* find(
int i0,
int i1,
size_t* hashval=0)
const;
3236 template<
typename _Tp>
const _Tp* find(
int i0,
int i1,
int i2,
size_t* hashval=0)
const;
3238 template<
typename _Tp>
const _Tp* find(
const int* idx,
size_t* hashval=0)
const;
3241 void erase(
int i0,
int i1,
size_t* hashval=0);
3243 void erase(
int i0,
int i1,
int i2,
size_t* hashval=0);
3245 void erase(
const int* idx,
size_t* hashval=0);
3273 template<
typename _Tp> _Tp& value(
Node* n);
3275 template<
typename _Tp>
const _Tp& value(
const Node* n)
const;
3278 Node* node(
size_t nidx);
3279 const Node* node(
size_t nidx)
const;
3281 uchar* newNode(
const int* idx,
size_t hashval);
3282 void removeNode(
size_t hidx,
size_t nidx,
size_t previdx);
3283 void resizeHashTab(
size_t newsize);
3285 enum { MAGIC_VAL=0x42FD0000, MAX_DIM=
CV_MAX_DIM, HASH_SCALE=0x5bd1e995, HASH_BIT=0x80000000 };
3293 double* maxVal,
int* minIdx=0,
int* maxIdx=0);
3325 template<
typename _Tp>
const _Tp& value()
const;
3367 template<
typename _Tp> _Tp& value()
const;
3418 void create(
int dims,
const int* _sizes);
3427 int channels()
const;
3430 _Tp& ref(
int i0,
size_t* hashval=0);
3432 _Tp& ref(
int i0,
int i1,
size_t* hashval=0);
3434 _Tp& ref(
int i0,
int i1,
int i2,
size_t* hashval=0);
3436 _Tp& ref(
const int* idx,
size_t* hashval=0);
3439 _Tp operator()(
int i0,
size_t* hashval=0)
const;
3441 _Tp operator()(
int i0,
int i1,
size_t* hashval=0)
const;
3443 _Tp operator()(
int i0,
int i1,
int i2,
size_t* hashval=0)
const;
3445 _Tp operator()(
const int* idx,
size_t* hashval=0)
const;
3550 Node() : idx(-1), left(-1), right(-1), boundary(0.f) {}
3551 Node(
int _idx,
int _left,
int _right,
float _boundary)
3552 : idx(_idx), left(_left), right(_right), boundary(_boundary) {}
3568 CV_WRAP void build(
const Mat& _points,
bool copyAndReorderPoints=
false);
3570 CV_WRAP void build(
const Mat& _points,
const Mat& _labels,
bool copyAndReorderPoints=
false);
3572 int findNearest(
const float* vec,
3573 int K,
int Emax,
int* neighborsIdx,
3574 Mat* neighbors=0,
float* dist=0,
int* labels=0)
const;
3576 int findNearest(
const float* vec,
int K,
int Emax,
3577 vector<int>* neighborsIdx,
3579 vector<float>* dist=0,
3580 vector<int>* labels=0)
const;
3581 CV_WRAP int findNearest(
const vector<float>& vec,
int K,
int Emax,
3582 CV_OUT vector<int>* neighborsIdx,
3584 CV_OUT vector<float>* dist=0,
3585 CV_OUT vector<int>* labels=0)
const;
3587 void findOrthoRange(
const float* minBounds,
const float* maxBounds,
3588 vector<int>* neighborsIdx,
Mat* neighbors=0,
3589 vector<int>* labels=0)
const;
3590 CV_WRAP void findOrthoRange(
const vector<float>& minBounds,
const vector<float>& maxBounds,
3592 CV_OUT vector<int>* labels=0)
const;
3594 void getPoints(
const int* idx,
size_t nidx,
Mat& pts, vector<int>* labels=0)
const;
3596 CV_WRAP void getPoints(
const vector<int>& idxs,
Mat& pts,
CV_OUT vector<int>* labels=0)
const;
3598 const float* getPoint(
int ptidx,
int* label=0)
const;
3737 CV_WRAP virtual bool open(
const string& filename,
int flags);
3739 CV_WRAP virtual bool isOpened()
const;
3741 CV_WRAP virtual void release();
3744 CV_WRAP FileNode getFirstTopLevelNode()
const;
3746 CV_WRAP FileNode root(
int streamidx=0)
const;
3748 FileNode operator[](
const string& nodename)
const;
3750 CV_WRAP FileNode operator[](
const char* nodename)
const;
3757 void writeRaw(
const string& fmt,
const uchar* vec,
size_t len );
3759 void writeObj(
const string& name,
const void* obj );
3762 static string getDefaultObjectName(
const string& filename);
3808 FileNode(
const FileNode& node);
3810 FileNode operator[](
const string& nodename)
const;
3812 CV_WRAP FileNode operator[](
const char* nodename)
const;
3814 CV_WRAP FileNode operator[](
int i)
const;
3831 CV_WRAP bool isString()
const;
3839 operator int()
const;
3841 operator float()
const;
3843 operator double()
const;
3845 operator string()
const;
3853 FileNodeIterator begin()
const;
3855 FileNodeIterator end()
const;
3858 void readRaw(
const string& fmt,
uchar* vec,
size_t len )
const;
3860 void* readObj()
const;
3881 FileNodeIterator(
const FileNodeIterator& it);
3885 FileNode operator ->()
const;
3888 FileNodeIterator& operator ++ ();
3890 FileNodeIterator operator ++ (
int);
3892 FileNodeIterator& operator -- ();
3894 FileNodeIterator operator -- (
int);
3896 FileNodeIterator& operator += (
int);
3898 FileNodeIterator& operator -= (
int);
3901 FileNodeIterator& readRaw(
const string& fmt,
uchar* vec,
3902 size_t maxCount=(
size_t)INT_MAX );
3937 Seq(MemStorage& storage,
int headerSize =
sizeof(
CvSeq));
3939 _Tp& operator [](
int idx);
3941 const _Tp& operator[](
int idx)
const;
3947 size_t size()
const;
3953 int channels()
const;
3955 size_t elemSize()
const;
3957 size_t index(
const _Tp& elem)
const;
3959 void push_back(
const _Tp& elem);
3961 void push_front(
const _Tp& elem);
3963 void push_back(
const _Tp* elems,
size_t count);
3965 void push_front(
const _Tp* elems,
size_t count);
3967 void insert(
int idx,
const _Tp& elem);
3969 void insert(
int idx,
const _Tp* elems,
size_t count);
3971 void remove(
int idx);
3973 void remove(
const Range& r);
3978 const _Tp& front()
const;
3982 const _Tp& back()
const;
3993 void pop_front(_Tp* elems,
size_t count);
3995 void pop_back(_Tp* elems,
size_t count);
4000 operator vector<_Tp>()
const;
4017 void seek(
size_t pos);
4019 size_t tell()
const;
4045 #endif // __cplusplus