Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
cv::Mat_< _Tp > Class Template Reference

Template matrix class derived from Mat. More...

#include <core.hpp>

Inherits cv::Mat.

Public Types

typedef _Tp value_type
 
typedef DataType< _Tp >
::channel_type 
channel_type
 
typedef MatIterator_< _Tp > iterator
 
typedef MatConstIterator_< _Tp > const_iterator
 
enum  { MAGIC_VAL =0x42FF0000, AUTO_STEP =0, CONTINUOUS_FLAG =CV_MAT_CONT_FLAG, SUBMATRIX_FLAG =CV_SUBMAT_FLAG }
 

Public Member Functions

 Mat_ ()
 default constructor More...
 
 Mat_ (int _rows, int _cols)
 equivalent to Mat(_rows, _cols, DataType<_Tp>::type) More...
 
 Mat_ (int _rows, int _cols, const _Tp &value)
 constructor that sets each matrix element to specified value More...
 
 Mat_ (Size _size)
 equivalent to Mat(_size, DataType<_Tp>::type) More...
 
 Mat_ (Size _size, const _Tp &value)
 constructor that sets each matrix element to specified value More...
 
 Mat_ (int _ndims, const int *_sizes)
 n-dim array constructor More...
 
 Mat_ (int _ndims, const int *_sizes, const _Tp &value)
 n-dim array constructor that sets each matrix element to specified value More...
 
 Mat_ (const Mat &m)
 copy/conversion contructor. If m is of different type, it's converted More...
 
 Mat_ (const Mat_ &m)
 copy constructor More...
 
 Mat_ (int _rows, int _cols, _Tp *_data, size_t _step=AUTO_STEP)
 constructs a matrix on top of user-allocated data. step is in bytes(!!!), regardless of the type More...
 
 Mat_ (int _ndims, const int *_sizes, _Tp *_data, const size_t *_steps=0)
 constructs n-dim matrix on top of user-allocated data. steps are in bytes(!!!), regardless of the type More...
 
 Mat_ (const Mat_ &m, const Range &rowRange, const Range &colRange=Range::all())
 selects a submatrix More...
 
 Mat_ (const Mat_ &m, const Rect &roi)
 selects a submatrix More...
 
 Mat_ (const Mat_ &m, const Range *ranges)
 selects a submatrix, n-dim version More...
 
 Mat_ (const MatExpr &e)
 from a matrix expression More...
 
 Mat_ (const vector< _Tp > &vec, bool copyData=false)
 makes a matrix out of Vec, std::vector, Point_ or Point3_. The matrix will have a single column More...
 
template<int n>
 Mat_ (const Vec< typename DataType< _Tp >::channel_type, n > &vec, bool copyData=true)
 
template<int m, int n>
 Mat_ (const Matx< typename DataType< _Tp >::channel_type, m, n > &mtx, bool copyData=true)
 
 Mat_ (const Point_< typename DataType< _Tp >::channel_type > &pt, bool copyData=true)
 
 Mat_ (const Point3_< typename DataType< _Tp >::channel_type > &pt, bool copyData=true)
 
 Mat_ (const MatCommaInitializer_< _Tp > &commaInitializer)
 
Mat_operator= (const Mat &m)
 
Mat_operator= (const Mat_ &m)
 
Mat_operator= (const _Tp &s)
 set all the elements to s. More...
 
Mat_operator= (const MatExpr &e)
 assign a matrix expression More...
 
iterator begin ()
 iterators; they are smart enough to skip gaps in the end of rows More...
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
void create (int _rows, int _cols)
 equivalent to Mat::create(_rows, _cols, DataType<_Tp>::type) More...
 
void create (Size _size)
 equivalent to Mat::create(_size, DataType<_Tp>::type) More...
 
void create (int _ndims, const int *_sizes)
 equivalent to Mat::create(_ndims, _sizes, DatType<_Tp>::type) More...
 
Mat_ cross (const Mat_ &m) const
 cross-product More...
 
template<typename T2 >
 operator Mat_< T2 > () const
 data type conversion More...
 
Mat_ row (int y) const
 overridden forms of Mat::row() etc. More...
 
Mat_ col (int x) const
 
Mat_ diag (int d=0) const
 
Mat_ clone () const
 
size_t elemSize () const
 overridden forms of Mat::elemSize() etc. More...
 
size_t elemSize1 () const
 
int type () const
 
int depth () const
 
int channels () const
 
size_t step1 (int i=0) const
 
size_t stepT (int i=0) const
 returns step()/sizeof(_Tp) More...
 
Mat_adjustROI (int dtop, int dbottom, int dleft, int dright)
 some more overriden methods More...
 
Mat_ operator() (const Range &rowRange, const Range &colRange) const
 
Mat_ operator() (const Rect &roi) const
 
Mat_ operator() (const Range *ranges) const
 
_Tp * operator[] (int y)
 more convenient forms of row and element access operators More...
 
const _Tp * operator[] (int y) const
 
_Tp & operator() (const int *idx)
 returns reference to the specified element More...
 
const _Tp & operator() (const int *idx) const
 returns read-only reference to the specified element More...
 
template<int n>
_Tp & operator() (const Vec< int, n > &idx)
 returns reference to the specified element More...
 
template<int n>
const _Tp & operator() (const Vec< int, n > &idx) const
 returns read-only reference to the specified element More...
 
_Tp & operator() (int idx0)
 returns reference to the specified element (1D case) More...
 
const _Tp & operator() (int idx0) const
 returns read-only reference to the specified element (1D case) More...
 
_Tp & operator() (int idx0, int idx1)
 returns reference to the specified element (2D case) More...
 
const _Tp & operator() (int idx0, int idx1) const
 returns read-only reference to the specified element (2D case) More...
 
_Tp & operator() (int idx0, int idx1, int idx2)
 returns reference to the specified element (3D case) More...
 
const _Tp & operator() (int idx0, int idx1, int idx2) const
 returns read-only reference to the specified element (3D case) More...
 
_Tp & operator() (Point pt)
 
const _Tp & operator() (Point pt) const
 
 operator vector< _Tp > () const
 conversion to vector. More...
 
template<int n>
 operator Vec< typename DataType< _Tp >::channel_type, n > () const
 conversion to Vec More...
 
template<int m, int n>
 operator Matx< typename DataType< _Tp >::channel_type, m, n > () const
 conversion to Matx More...
 
Mat rowRange (int startrow, int endrow) const
 ... for the specified row span More...
 
Mat rowRange (const Range &r) const
 
Mat colRange (int startcol, int endcol) const
 ... for the specified column span More...
 
Mat colRange (const Range &r) const
 
void copyTo (OutputArray m) const
 copies the matrix content to "m". More...
 
void copyTo (OutputArray m, InputArray mask) const
 copies those matrix elements to "m" that are marked with non-zero mask elements. More...
 
void convertTo (OutputArray m, int rtype, double alpha=1, double beta=0) const
 converts matrix to another datatype with optional scalng. See cvConvertScale. More...
 
void assignTo (Mat &m, int type=-1) const
 
MatsetTo (InputArray value, InputArray mask=noArray())
 sets some of the matrix elements to s, according to the mask More...
 
Mat reshape (int cn, int rows=0) const
 creates alternative matrix header for the same data, with different More...
 
Mat reshape (int cn, int newndims, const int *newsz) const
 
MatExpr t () const
 matrix transposition by means of matrix expressions More...
 
MatExpr inv (int method=DECOMP_LU) const
 matrix inversion by means of matrix expressions More...
 
MatExpr mul (InputArray m, double scale=1) const
 per-element matrix multiplication by means of matrix expressions More...
 
Mat cross (InputArray m) const
 computes cross-product of 2 3D vectors More...
 
double dot (InputArray m) const
 computes dot-product More...
 
void create (int rows, int cols, int type)
 allocates new matrix data unless the matrix already has specified size and type. More...
 
void create (Size size, int type)
 
void create (int ndims, const int *sizes, int type)
 
void addref ()
 increases the reference counter; use with care to avoid memleaks More...
 
void release ()
 decreases reference counter; More...
 
void deallocate ()
 deallocates the matrix data More...
 
void copySize (const Mat &m)
 internal use function; properly re-allocates _size, _step arrays More...
 
void reserve (size_t sz)
 reserves enough space to fit sz hyper-planes More...
 
void resize (size_t sz)
 resizes matrix to the specified number of hyper-planes More...
 
void resize (size_t sz, const Scalar &s)
 resizes matrix to the specified number of hyper-planes; initializes the newly added elements More...
 
void push_back_ (const void *elem)
 internal function More...
 
template<typename _Tp >
void push_back (const _Tp &elem)
 adds element to the end of 1d matrix (or possibly multiple elements when _Tp=Mat) More...
 
template<typename _Tp >
void push_back (const Mat_< _Tp > &elem)
 
void push_back (const Mat &m)
 
void pop_back (size_t nelems=1)
 removes several hyper-planes from bottom of the matrix More...
 
void locateROI (Size &wholeSize, Point &ofs) const
 locates matrix header within a parent matrix. See below More...
 
Mat operator() (Range rowRange, Range colRange) const
 extracts a rectangular sub-matrix More...
 
 operator CvMat () const
 converts header to CvMat; no data is copied More...
 
 operator CvMatND () const
 converts header to CvMatND; no data is copied More...
 
 operator IplImage () const
 converts header to IplImage; no data is copied More...
 
template<typename _Tp , int n>
 operator Vec< _Tp, n > () const
 
template<typename _Tp , int m, int n>
 operator Matx< _Tp, m, n > () const
 
bool isContinuous () const
 returns true iff the matrix data is continuous More...
 
bool isSubmatrix () const
 returns true if the matrix is a submatrix of another matrix More...
 
bool empty () const
 returns true if matrix data is NULL More...
 
size_t total () const
 returns the total number of matrix elements More...
 
int checkVector (int elemChannels, int depth=-1, bool requireContinuous=true) const
 returns N if the matrix is 1-channel (N x ptdim) or ptdim-channel (1 x N) or (N x 1); negative number otherwise More...
 
ucharptr (int i0=0)
 returns pointer to i0-th submatrix along the dimension #0 More...
 
const ucharptr (int i0=0) const
 
ucharptr (int i0, int i1)
 returns pointer to (i0,i1) submatrix along the dimensions #0 and #1 More...
 
const ucharptr (int i0, int i1) const
 
ucharptr (int i0, int i1, int i2)
 returns pointer to (i0,i1,i3) submatrix along the dimensions #0, #1, #2 More...
 
const ucharptr (int i0, int i1, int i2) const
 
ucharptr (const int *idx)
 returns pointer to the matrix element More...
 
const ucharptr (const int *idx) const
 returns read-only pointer to the matrix element More...
 
template<int n>
ucharptr (const Vec< int, n > &idx)
 
template<int n>
const ucharptr (const Vec< int, n > &idx) const
 
template<typename _Tp >
_Tp * ptr (int i0=0)
 template version of the above method More...
 
template<typename _Tp >
const _Tp * ptr (int i0=0) const
 
template<typename _Tp >
_Tp * ptr (int i0, int i1)
 
template<typename _Tp >
const _Tp * ptr (int i0, int i1) const
 
template<typename _Tp >
_Tp * ptr (int i0, int i1, int i2)
 
template<typename _Tp >
const _Tp * ptr (int i0, int i1, int i2) const
 
template<typename _Tp >
_Tp * ptr (const int *idx)
 
template<typename _Tp >
const _Tp * ptr (const int *idx) const
 
template<typename _Tp , int n>
_Tp * ptr (const Vec< int, n > &idx)
 
template<typename _Tp , int n>
const _Tp * ptr (const Vec< int, n > &idx) const
 
template<typename _Tp >
_Tp & at (int i0=0)
 the same as above, with the pointer dereferencing More...
 
template<typename _Tp >
const _Tp & at (int i0=0) const
 
template<typename _Tp >
_Tp & at (int i0, int i1)
 
template<typename _Tp >
const _Tp & at (int i0, int i1) const
 
template<typename _Tp >
_Tp & at (int i0, int i1, int i2)
 
template<typename _Tp >
const _Tp & at (int i0, int i1, int i2) const
 
template<typename _Tp >
_Tp & at (const int *idx)
 
template<typename _Tp >
const _Tp & at (const int *idx) const
 
template<typename _Tp , int n>
_Tp & at (const Vec< int, n > &idx)
 
template<typename _Tp , int n>
const _Tp & at (const Vec< int, n > &idx) const
 
template<typename _Tp >
_Tp & at (Point pt)
 special versions for 2D arrays (especially convenient for referencing image pixels) More...
 
template<typename _Tp >
const _Tp & at (Point pt) const
 

Static Public Member Functions

static MatExpr zeros (int rows, int cols)
 overridden forms of Mat::zeros() etc. Data type is omitted, of course More...
 
static MatExpr zeros (Size size)
 
static MatExpr zeros (int _ndims, const int *_sizes)
 
static MatExpr ones (int rows, int cols)
 
static MatExpr ones (Size size)
 
static MatExpr ones (int _ndims, const int *_sizes)
 
static MatExpr eye (int rows, int cols)
 
static MatExpr eye (Size size)
 
static Mat diag (const Mat &d)
 constructs a square diagonal matrix which main diagonal is vector "d" More...
 
static MatExpr zeros (int rows, int cols, int type)
 Matlab-style matrix initialization. More...
 
static MatExpr zeros (Size size, int type)
 
static MatExpr zeros (int ndims, const int *sz, int type)
 
static MatExpr ones (int rows, int cols, int type)
 
static MatExpr ones (Size size, int type)
 
static MatExpr ones (int ndims, const int *sz, int type)
 
static MatExpr eye (int rows, int cols, int type)
 
static MatExpr eye (Size size, int type)
 

Public Attributes

int flags
 includes several bit-fields: More...
 
int dims
 the matrix dimensionality, >= 2 More...
 
int rows
 the number of rows and columns or (-1, -1) when the matrix has more than 2 dimensions More...
 
int cols
 
uchardata
 pointer to the data More...
 
intrefcount
 pointer to the reference counter; More...
 
uchardatastart
 helper fields used in locateROI and adjustROI More...
 
uchardataend
 
uchardatalimit
 
MatAllocatorallocator
 custom allocator More...
 
MSize size
 
MStep step
 

Protected Member Functions

void initEmpty ()
 

Detailed Description

template<typename _Tp>
class cv::Mat_< _Tp >

Template matrix class derived from Mat.

The class Mat_ is a "thin" template wrapper on top of cv::Mat. It does not have any extra data fields, nor it or cv::Mat have any virtual methods and thus references or pointers to these two classes can be safely converted one to another. But do it with care, for example:

// create 100x100 8-bit matrix
Mat M(100,100,CV_8U);
// this will compile fine. no any data conversion will be done.
Mat_<float>& M1 = (Mat_<float>&)M;
// the program will likely crash at the statement below
M1(99,99) = 1.f;

While cv::Mat is sufficient in most cases, cv::Mat_ can be more convenient if you use a lot of element access operations and if you know matrix type at compile time. Note that cv::Mat::at<Tp>(int y, int x) and cv::Mat<_Tp>::operator ()(int y, int x) do absolutely the same thing and run at the same speed, but the latter is certainly shorter:

Mat_<double> M(20,20);
for(int i = 0; i < M.rows; i++)
for(int j = 0; j < M.cols; j++)
M(i,j) = 1./(i+j+1);
Mat E, V;
eigen(M,E,V);
cout << E.at<double>(0,0)/E.at<double>(M.rows-1,0);

It is easy to use Mat_ for multi-channel images/matrices - just pass cv::Vec as cv::Mat_ template parameter:

// allocate 320x240 color image and fill it with green (in RGB space)
Mat_<Vec3b> img(240, 320, Vec3b(0,255,0));
// now draw a diagonal white line
for(int i = 0; i < 100; i++)
img(i,i)=Vec3b(255,255,255);
// and now modify the 2nd (red) channel of each pixel
for(int i = 0; i < img.rows; i++)
for(int j = 0; j < img.cols; j++)
img(i,j)[2] ^= (uchar)(i ^ j); // img(y,x)[c] accesses c-th channel of the pixel (x,y)

Member Typedef Documentation

template<typename _Tp>
typedef _Tp cv::Mat_< _Tp >::value_type
template<typename _Tp>
typedef DataType<_Tp>::channel_type cv::Mat_< _Tp >::channel_type
template<typename _Tp>
typedef MatIterator_<_Tp> cv::Mat_< _Tp >::iterator
template<typename _Tp>
typedef MatConstIterator_<_Tp> cv::Mat_< _Tp >::const_iterator

Member Enumeration Documentation

anonymous enum
inherited
Enumerator
MAGIC_VAL 
AUTO_STEP 
CONTINUOUS_FLAG 
SUBMATRIX_FLAG 

Constructor & Destructor Documentation

template<typename _Tp >
cv::Mat_< _Tp >::Mat_ ( )

default constructor

template<typename _Tp >
cv::Mat_< _Tp >::Mat_ ( int  _rows,
int  _cols 
)

equivalent to Mat(_rows, _cols, DataType<_Tp>::type)

template<typename _Tp>
cv::Mat_< _Tp >::Mat_ ( int  _rows,
int  _cols,
const _Tp &  value 
)

constructor that sets each matrix element to specified value

template<typename _Tp>
cv::Mat_< _Tp >::Mat_ ( Size  _size)
explicit

equivalent to Mat(_size, DataType<_Tp>::type)

template<typename _Tp>
cv::Mat_< _Tp >::Mat_ ( Size  _size,
const _Tp &  value 
)

constructor that sets each matrix element to specified value

template<typename _Tp>
cv::Mat_< _Tp >::Mat_ ( int  _ndims,
const int _sizes 
)

n-dim array constructor

template<typename _Tp>
cv::Mat_< _Tp >::Mat_ ( int  _ndims,
const int _sizes,
const _Tp &  value 
)

n-dim array constructor that sets each matrix element to specified value

template<typename _Tp>
cv::Mat_< _Tp >::Mat_ ( const Mat m)

copy/conversion contructor. If m is of different type, it's converted

template<typename _Tp>
cv::Mat_< _Tp >::Mat_ ( const Mat_< _Tp > &  m)

copy constructor

template<typename _Tp>
cv::Mat_< _Tp >::Mat_ ( int  _rows,
int  _cols,
_Tp *  _data,
size_t  _step = AUTO_STEP 
)

constructs a matrix on top of user-allocated data. step is in bytes(!!!), regardless of the type

template<typename _Tp>
cv::Mat_< _Tp >::Mat_ ( int  _ndims,
const int _sizes,
_Tp *  _data,
const size_t *  _steps = 0 
)

constructs n-dim matrix on top of user-allocated data. steps are in bytes(!!!), regardless of the type

template<typename _Tp>
cv::Mat_< _Tp >::Mat_ ( const Mat_< _Tp > &  m,
const Range rowRange,
const Range colRange = Range::all() 
)

selects a submatrix

template<typename _Tp>
cv::Mat_< _Tp >::Mat_ ( const Mat_< _Tp > &  m,
const Rect roi 
)

selects a submatrix

template<typename _Tp>
cv::Mat_< _Tp >::Mat_ ( const Mat_< _Tp > &  m,
const Range ranges 
)

selects a submatrix, n-dim version

template<typename _Tp>
cv::Mat_< _Tp >::Mat_ ( const MatExpr e)
explicit

from a matrix expression

template<typename _Tp>
cv::Mat_< _Tp >::Mat_ ( const vector< _Tp > &  vec,
bool  copyData = false 
)
explicit

makes a matrix out of Vec, std::vector, Point_ or Point3_. The matrix will have a single column

template<typename _Tp>
template<int n>
cv::Mat_< _Tp >::Mat_ ( const Vec< typename DataType< _Tp >::channel_type, n > &  vec,
bool  copyData = true 
)
explicit
template<typename _Tp>
template<int m, int n>
cv::Mat_< _Tp >::Mat_ ( const Matx< typename DataType< _Tp >::channel_type, m, n > &  mtx,
bool  copyData = true 
)
explicit
template<typename _Tp>
cv::Mat_< _Tp >::Mat_ ( const Point_< typename DataType< _Tp >::channel_type > &  pt,
bool  copyData = true 
)
explicit
template<typename _Tp>
cv::Mat_< _Tp >::Mat_ ( const Point3_< typename DataType< _Tp >::channel_type > &  pt,
bool  copyData = true 
)
explicit
template<typename _Tp>
cv::Mat_< _Tp >::Mat_ ( const MatCommaInitializer_< _Tp > &  commaInitializer)
explicit

Member Function Documentation

template<typename _Tp >
Mat_< _Tp > & cv::Mat_< _Tp >::operator= ( const Mat m)
template<typename _Tp >
Mat_< _Tp > & cv::Mat_< _Tp >::operator= ( const Mat_< _Tp > &  m)
template<typename _Tp>
Mat_< _Tp > & cv::Mat_< _Tp >::operator= ( const _Tp &  s)

set all the elements to s.

template<typename _Tp>
Mat_< _Tp > & cv::Mat_< _Tp >::operator= ( const MatExpr e)

assign a matrix expression

template<typename _Tp >
MatIterator_< _Tp > cv::Mat_< _Tp >::begin ( )

iterators; they are smart enough to skip gaps in the end of rows

template<typename _Tp >
MatIterator_< _Tp > cv::Mat_< _Tp >::end ( )
template<typename _Tp >
MatConstIterator_< _Tp > cv::Mat_< _Tp >::begin ( ) const
template<typename _Tp >
MatConstIterator_< _Tp > cv::Mat_< _Tp >::end ( ) const
template<typename _Tp >
void cv::Mat_< _Tp >::create ( int  _rows,
int  _cols 
)

equivalent to Mat::create(_rows, _cols, DataType<_Tp>::type)

template<typename _Tp >
void cv::Mat_< _Tp >::create ( Size  _size)

equivalent to Mat::create(_size, DataType<_Tp>::type)

template<typename _Tp >
void cv::Mat_< _Tp >::create ( int  _ndims,
const int _sizes 
)

equivalent to Mat::create(_ndims, _sizes, DatType<_Tp>::type)

template<typename _Tp >
Mat_< _Tp > cv::Mat_< _Tp >::cross ( const Mat_< _Tp > &  m) const

cross-product

template<typename _Tp >
template<typename T2 >
cv::Mat_< _Tp >::operator Mat_< T2 > ( ) const

data type conversion

template<typename _Tp >
Mat_< _Tp > cv::Mat_< _Tp >::row ( int  y) const

overridden forms of Mat::row() etc.

template<typename _Tp >
Mat_< _Tp > cv::Mat_< _Tp >::col ( int  x) const
template<typename _Tp >
Mat_< _Tp > cv::Mat_< _Tp >::diag ( int  d = 0) const
template<typename _Tp >
Mat_< _Tp > cv::Mat_< _Tp >::clone ( ) const
template<typename _Tp >
size_t cv::Mat_< _Tp >::elemSize ( ) const

overridden forms of Mat::elemSize() etc.

template<typename _Tp >
size_t cv::Mat_< _Tp >::elemSize1 ( ) const
template<typename _Tp >
int cv::Mat_< _Tp >::type ( ) const
template<typename _Tp >
int cv::Mat_< _Tp >::depth ( ) const
template<typename _Tp >
int cv::Mat_< _Tp >::channels ( ) const
template<typename _Tp >
size_t cv::Mat_< _Tp >::step1 ( int  i = 0) const
template<typename _Tp >
size_t cv::Mat_< _Tp >::stepT ( int  i = 0) const

returns step()/sizeof(_Tp)

template<typename _Tp >
MatExpr cv::Mat_< _Tp >::zeros ( int  rows,
int  cols 
)
static

overridden forms of Mat::zeros() etc. Data type is omitted, of course

template<typename _Tp >
MatExpr cv::Mat_< _Tp >::zeros ( Size  size)
static
template<typename _Tp>
static MatExpr cv::Mat_< _Tp >::zeros ( int  _ndims,
const int _sizes 
)
static
template<typename _Tp >
MatExpr cv::Mat_< _Tp >::ones ( int  rows,
int  cols 
)
static
template<typename _Tp >
MatExpr cv::Mat_< _Tp >::ones ( Size  size)
static
template<typename _Tp>
static MatExpr cv::Mat_< _Tp >::ones ( int  _ndims,
const int _sizes 
)
static
template<typename _Tp >
MatExpr cv::Mat_< _Tp >::eye ( int  rows,
int  cols 
)
static
template<typename _Tp >
MatExpr cv::Mat_< _Tp >::eye ( Size  size)
static
template<typename _Tp >
Mat_< _Tp > & cv::Mat_< _Tp >::adjustROI ( int  dtop,
int  dbottom,
int  dleft,
int  dright 
)

some more overriden methods

template<typename _Tp >
Mat_< _Tp > cv::Mat_< _Tp >::operator() ( const Range rowRange,
const Range colRange 
) const
template<typename _Tp >
Mat_< _Tp > cv::Mat_< _Tp >::operator() ( const Rect roi) const
template<typename _Tp >
Mat_< _Tp > cv::Mat_< _Tp >::operator() ( const Range ranges) const
template<typename _Tp >
_Tp * cv::Mat_< _Tp >::operator[] ( int  y)

more convenient forms of row and element access operators

template<typename _Tp >
const _Tp * cv::Mat_< _Tp >::operator[] ( int  y) const
template<typename _Tp >
_Tp & cv::Mat_< _Tp >::operator() ( const int idx)

returns reference to the specified element

template<typename _Tp >
const _Tp & cv::Mat_< _Tp >::operator() ( const int idx) const

returns read-only reference to the specified element

template<typename _Tp >
template<int n>
_Tp & cv::Mat_< _Tp >::operator() ( const Vec< int, n > &  idx)

returns reference to the specified element

template<typename _Tp >
template<int n>
const _Tp & cv::Mat_< _Tp >::operator() ( const Vec< int, n > &  idx) const

returns read-only reference to the specified element

template<typename _Tp >
_Tp & cv::Mat_< _Tp >::operator() ( int  idx0)

returns reference to the specified element (1D case)

template<typename _Tp >
const _Tp & cv::Mat_< _Tp >::operator() ( int  idx0) const

returns read-only reference to the specified element (1D case)

template<typename _Tp >
_Tp & cv::Mat_< _Tp >::operator() ( int  idx0,
int  idx1 
)

returns reference to the specified element (2D case)

template<typename _Tp >
const _Tp & cv::Mat_< _Tp >::operator() ( int  idx0,
int  idx1 
) const

returns read-only reference to the specified element (2D case)

template<typename _Tp >
_Tp & cv::Mat_< _Tp >::operator() ( int  idx0,
int  idx1,
int  idx2 
)

returns reference to the specified element (3D case)

template<typename _Tp >
const _Tp & cv::Mat_< _Tp >::operator() ( int  idx0,
int  idx1,
int  idx2 
) const

returns read-only reference to the specified element (3D case)

template<typename _Tp >
_Tp & cv::Mat_< _Tp >::operator() ( Point  pt)
template<typename _Tp >
const _Tp & cv::Mat_< _Tp >::operator() ( Point  pt) const
template<typename _Tp >
cv::Mat_< _Tp >::operator vector< _Tp > ( ) const

conversion to vector.

template<typename _Tp >
template<int n>
cv::Mat_< _Tp >::operator Vec< typename DataType< _Tp >::channel_type, n > ( ) const

conversion to Vec

template<typename _Tp >
template<int m, int n>
cv::Mat_< _Tp >::operator Matx< typename DataType< _Tp >::channel_type, m, n > ( ) const

conversion to Matx

Mat cv::Mat::rowRange ( int  startrow,
int  endrow 
) const
inherited

... for the specified row span

Mat cv::Mat::rowRange ( const Range r) const
inherited
Mat cv::Mat::colRange ( int  startcol,
int  endcol 
) const
inherited

... for the specified column span

Mat cv::Mat::colRange ( const Range r) const
inherited
Mat cv::Mat::diag ( const Mat d)
staticinherited

constructs a square diagonal matrix which main diagonal is vector "d"

void cv::Mat::copyTo ( OutputArray  m) const
inherited

copies the matrix content to "m".

void cv::Mat::copyTo ( OutputArray  m,
InputArray  mask 
) const
inherited

copies those matrix elements to "m" that are marked with non-zero mask elements.

void cv::Mat::convertTo ( OutputArray  m,
int  rtype,
double  alpha = 1,
double  beta = 0 
) const
inherited

converts matrix to another datatype with optional scalng. See cvConvertScale.

void cv::Mat::assignTo ( Mat m,
int  type = -1 
) const
inherited
Mat& cv::Mat::setTo ( InputArray  value,
InputArray  mask = noArray() 
)
inherited

sets some of the matrix elements to s, according to the mask

Mat cv::Mat::reshape ( int  cn,
int  rows = 0 
) const
inherited

creates alternative matrix header for the same data, with different

Mat cv::Mat::reshape ( int  cn,
int  newndims,
const int newsz 
) const
inherited
MatExpr cv::Mat::t ( ) const
inherited

matrix transposition by means of matrix expressions

MatExpr cv::Mat::inv ( int  method = DECOMP_LU) const
inherited

matrix inversion by means of matrix expressions

MatExpr cv::Mat::mul ( InputArray  m,
double  scale = 1 
) const
inherited

per-element matrix multiplication by means of matrix expressions

Mat cv::Mat::cross ( InputArray  m) const
inherited

computes cross-product of 2 3D vectors

double cv::Mat::dot ( InputArray  m) const
inherited

computes dot-product

static MatExpr cv::Mat::zeros ( int  rows,
int  cols,
int  type 
)
staticinherited

Matlab-style matrix initialization.

static MatExpr cv::Mat::zeros ( Size  size,
int  type 
)
staticinherited
static MatExpr cv::Mat::zeros ( int  ndims,
const int sz,
int  type 
)
staticinherited
static MatExpr cv::Mat::ones ( int  rows,
int  cols,
int  type 
)
staticinherited
static MatExpr cv::Mat::ones ( Size  size,
int  type 
)
staticinherited
static MatExpr cv::Mat::ones ( int  ndims,
const int sz,
int  type 
)
staticinherited
static MatExpr cv::Mat::eye ( int  rows,
int  cols,
int  type 
)
staticinherited
static MatExpr cv::Mat::eye ( Size  size,
int  type 
)
staticinherited
void cv::Mat::create ( int  rows,
int  cols,
int  type 
)
inherited

allocates new matrix data unless the matrix already has specified size and type.

void cv::Mat::create ( Size  size,
int  type 
)
inherited
void cv::Mat::create ( int  ndims,
const int sizes,
int  type 
)
inherited
void cv::Mat::addref ( )
inherited

increases the reference counter; use with care to avoid memleaks

void cv::Mat::release ( )
inherited

decreases reference counter;

void cv::Mat::deallocate ( )
inherited

deallocates the matrix data

void cv::Mat::copySize ( const Mat m)
inherited

internal use function; properly re-allocates _size, _step arrays

void cv::Mat::reserve ( size_t  sz)
inherited

reserves enough space to fit sz hyper-planes

void cv::Mat::resize ( size_t  sz)
inherited

resizes matrix to the specified number of hyper-planes

void cv::Mat::resize ( size_t  sz,
const Scalar s 
)
inherited

resizes matrix to the specified number of hyper-planes; initializes the newly added elements

void cv::Mat::push_back_ ( const void elem)
inherited

internal function

template<typename _Tp >
void cv::Mat::push_back ( const _Tp &  elem)
inherited

adds element to the end of 1d matrix (or possibly multiple elements when _Tp=Mat)

template<typename _Tp >
void cv::Mat::push_back ( const Mat_< _Tp > &  elem)
inherited
void cv::Mat::push_back ( const Mat m)
inherited
void cv::Mat::pop_back ( size_t  nelems = 1)
inherited

removes several hyper-planes from bottom of the matrix

void cv::Mat::locateROI ( Size wholeSize,
Point ofs 
) const
inherited

locates matrix header within a parent matrix. See below

Mat cv::Mat::operator() ( Range  rowRange,
Range  colRange 
) const
inherited

extracts a rectangular sub-matrix

cv::Mat::operator CvMat ( ) const
inherited

converts header to CvMat; no data is copied

cv::Mat::operator CvMatND ( ) const
inherited

converts header to CvMatND; no data is copied

cv::Mat::operator IplImage ( ) const
inherited

converts header to IplImage; no data is copied

template<typename _Tp , int n>
cv::Mat::operator Vec< _Tp, n > ( ) const
inherited
template<typename _Tp , int m, int n>
cv::Mat::operator Matx< _Tp, m, n > ( ) const
inherited
bool cv::Mat::isContinuous ( ) const
inherited

returns true iff the matrix data is continuous

bool cv::Mat::isSubmatrix ( ) const
inherited

returns true if the matrix is a submatrix of another matrix

bool cv::Mat::empty ( ) const
inherited

returns true if matrix data is NULL

size_t cv::Mat::total ( ) const
inherited

returns the total number of matrix elements

int cv::Mat::checkVector ( int  elemChannels,
int  depth = -1,
bool  requireContinuous = true 
) const
inherited

returns N if the matrix is 1-channel (N x ptdim) or ptdim-channel (1 x N) or (N x 1); negative number otherwise

uchar * cv::Mat::ptr ( int  i0 = 0)
inherited

returns pointer to i0-th submatrix along the dimension #0

const uchar * cv::Mat::ptr ( int  i0 = 0) const
inherited
uchar * cv::Mat::ptr ( int  i0,
int  i1 
)
inherited

returns pointer to (i0,i1) submatrix along the dimensions #0 and #1

const uchar * cv::Mat::ptr ( int  i0,
int  i1 
) const
inherited
uchar * cv::Mat::ptr ( int  i0,
int  i1,
int  i2 
)
inherited

returns pointer to (i0,i1,i3) submatrix along the dimensions #0, #1, #2

const uchar * cv::Mat::ptr ( int  i0,
int  i1,
int  i2 
) const
inherited
uchar * cv::Mat::ptr ( const int idx)
inherited

returns pointer to the matrix element

const uchar * cv::Mat::ptr ( const int idx) const
inherited

returns read-only pointer to the matrix element

template<int n>
uchar* cv::Mat::ptr ( const Vec< int, n > &  idx)
inherited
template<int n>
const uchar* cv::Mat::ptr ( const Vec< int, n > &  idx) const
inherited
template<typename _Tp>
_Tp * cv::Mat::ptr ( int  i0 = 0)
inherited

template version of the above method

template<typename _Tp>
const _Tp * cv::Mat::ptr ( int  i0 = 0) const
inherited
template<typename _Tp>
_Tp * cv::Mat::ptr ( int  i0,
int  i1 
)
inherited
template<typename _Tp>
const _Tp * cv::Mat::ptr ( int  i0,
int  i1 
) const
inherited
template<typename _Tp>
_Tp * cv::Mat::ptr ( int  i0,
int  i1,
int  i2 
)
inherited
template<typename _Tp>
const _Tp * cv::Mat::ptr ( int  i0,
int  i1,
int  i2 
) const
inherited
template<typename _Tp >
_Tp* cv::Mat::ptr ( const int idx)
inherited
template<typename _Tp >
const _Tp* cv::Mat::ptr ( const int idx) const
inherited
template<typename _Tp , int n>
_Tp* cv::Mat::ptr ( const Vec< int, n > &  idx)
inherited
template<typename _Tp , int n>
const _Tp* cv::Mat::ptr ( const Vec< int, n > &  idx) const
inherited
template<typename _Tp >
_Tp & cv::Mat::at ( int  i0 = 0)
inherited

the same as above, with the pointer dereferencing

template<typename _Tp >
const _Tp & cv::Mat::at ( int  i0 = 0) const
inherited
template<typename _Tp >
_Tp & cv::Mat::at ( int  i0,
int  i1 
)
inherited
template<typename _Tp >
const _Tp & cv::Mat::at ( int  i0,
int  i1 
) const
inherited
template<typename _Tp >
_Tp & cv::Mat::at ( int  i0,
int  i1,
int  i2 
)
inherited
template<typename _Tp >
const _Tp & cv::Mat::at ( int  i0,
int  i1,
int  i2 
) const
inherited
template<typename _Tp >
_Tp & cv::Mat::at ( const int idx)
inherited
template<typename _Tp >
const _Tp & cv::Mat::at ( const int idx) const
inherited
template<typename _Tp , int n>
_Tp & cv::Mat::at ( const Vec< int, n > &  idx)
inherited
template<typename _Tp , int n>
const _Tp & cv::Mat::at ( const Vec< int, n > &  idx) const
inherited
template<typename _Tp >
_Tp & cv::Mat::at ( Point  pt)
inherited

special versions for 2D arrays (especially convenient for referencing image pixels)

template<typename _Tp >
const _Tp & cv::Mat::at ( Point  pt) const
inherited
void cv::Mat::initEmpty ( )
protectedinherited

Member Data Documentation

int cv::Mat::flags
inherited

includes several bit-fields:

  • the magic signature
  • continuity flag
  • depth
  • number of channels
int cv::Mat::dims
inherited

the matrix dimensionality, >= 2

int cv::Mat::rows
inherited

the number of rows and columns or (-1, -1) when the matrix has more than 2 dimensions

int cv::Mat::cols
inherited
uchar* cv::Mat::data
inherited

pointer to the data

int* cv::Mat::refcount
inherited

pointer to the reference counter;

uchar* cv::Mat::datastart
inherited

helper fields used in locateROI and adjustROI

uchar* cv::Mat::dataend
inherited
uchar* cv::Mat::datalimit
inherited
MatAllocator* cv::Mat::allocator
inherited

custom allocator

MSize cv::Mat::size
inherited
MStep cv::Mat::step
inherited

The documentation for this class was generated from the following files: