OpenCV  3.0.0-rc1
Open Source Computer Vision
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
cv::UMat Class Reference

#include "mat.hpp"

Public Types

enum  {
  MAGIC_VAL = 0x42FF0000,
  AUTO_STEP = 0,
  CONTINUOUS_FLAG = CV_MAT_CONT_FLAG,
  SUBMATRIX_FLAG = CV_SUBMAT_FLAG
}
 
enum  {
  MAGIC_MASK = 0xFFFF0000,
  TYPE_MASK = 0x00000FFF,
  DEPTH_MASK = 7
}
 

Public Member Functions

 UMat (UMatUsageFlags usageFlags=USAGE_DEFAULT)
 default constructor More...
 
 UMat (int rows, int cols, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
 constructs 2D matrix of the specified size and type More...
 
 UMat (Size size, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
 
 UMat (int rows, int cols, int type, const Scalar &s, UMatUsageFlags usageFlags=USAGE_DEFAULT)
 constucts 2D matrix and fills it with the specified value _s. More...
 
 UMat (Size size, int type, const Scalar &s, UMatUsageFlags usageFlags=USAGE_DEFAULT)
 
 UMat (int ndims, const int *sizes, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
 constructs n-dimensional matrix More...
 
 UMat (int ndims, const int *sizes, int type, const Scalar &s, UMatUsageFlags usageFlags=USAGE_DEFAULT)
 
 UMat (const UMat &m)
 copy constructor More...
 
 UMat (const UMat &m, const Range &rowRange, const Range &colRange=Range::all())
 creates a matrix header for a part of the bigger matrix More...
 
 UMat (const UMat &m, const Rect &roi)
 
 UMat (const UMat &m, const Range *ranges)
 
template<typename _Tp >
 UMat (const std::vector< _Tp > &vec, bool copyData=false)
 builds matrix from std::vector with or without copying the data More...
 
template<typename _Tp , int n>
 UMat (const Vec< _Tp, n > &vec, bool copyData=true)
 builds matrix from cv::Vec; the data is copied by default More...
 
template<typename _Tp , int m, int n>
 UMat (const Matx< _Tp, m, n > &mtx, bool copyData=true)
 builds matrix from cv::Matx; the data is copied by default More...
 
template<typename _Tp >
 UMat (const Point_< _Tp > &pt, bool copyData=true)
 builds matrix from a 2D point More...
 
template<typename _Tp >
 UMat (const Point3_< _Tp > &pt, bool copyData=true)
 builds matrix from a 3D point More...
 
template<typename _Tp >
 UMat (const MatCommaInitializer_< _Tp > &commaInitializer)
 builds matrix from comma initializer More...
 
 ~UMat ()
 destructor - calls release() More...
 
void addref ()
 increases the reference counter; use with care to avoid memleaks More...
 
UMatadjustROI (int dtop, int dbottom, int dleft, int dright)
 moves/resizes the current matrix ROI inside the parent matrix. More...
 
void assignTo (UMat &m, int type=-1) const
 
int channels () const
 returns element type, similar to CV_MAT_CN(cvmat->type) 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...
 
UMat clone () const
 returns deep copy of the matrix, i.e. the data is copied More...
 
UMat col (int x) const
 returns a new matrix header for the specified column More...
 
UMat colRange (int startcol, int endcol) const
 ... for the specified column span More...
 
UMat colRange (const Range &r) const
 
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 copySize (const UMat &m)
 internal use function; properly re-allocates _size, _step arrays More...
 
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 create (int rows, int cols, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
 allocates new matrix data unless the matrix already has specified size and type. More...
 
void create (Size size, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
 
void create (int ndims, const int *sizes, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
 
void deallocate ()
 deallocates the matrix data More...
 
int depth () const
 returns element type, similar to CV_MAT_DEPTH(cvmat->type) More...
 
UMat diag (int d=0) const
 ... for the specified diagonal More...
 
double dot (InputArray m) const
 computes dot-product More...
 
size_t elemSize () const
 returns element size in bytes, More...
 
size_t elemSize1 () const
 returns the size of element channel in bytes. More...
 
bool empty () const
 returns true if matrix data is NULL More...
 
Mat getMat (int flags) const
 
void * handle (int accessFlags) const
 
UMat inv (int method=DECOMP_LU) const
 matrix inversion by means of matrix expressions More...
 
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...
 
void locateROI (Size &wholeSize, Point &ofs) const
 locates matrix header within a parent matrix. See below More...
 
UMat mul (InputArray m, double scale=1) const
 per-element matrix multiplication by means of matrix expressions More...
 
void ndoffset (size_t *ofs) const
 
UMat operator() (Range rowRange, Range colRange) const
 extracts a rectangular sub-matrix More...
 
UMat operator() (const Rect &roi) const
 
UMat operator() (const Range *ranges) const
 
UMatoperator= (const UMat &m)
 assignment operators More...
 
UMatoperator= (const Scalar &s)
 sets every matrix element to s More...
 
void release ()
 decreases reference counter; More...
 
UMat reshape (int cn, int rows=0) const
 creates alternative matrix header for the same data, with different More...
 
UMat reshape (int cn, int newndims, const int *newsz) const
 
UMat row (int y) const
 returns a new matrix header for the specified row More...
 
UMat rowRange (int startrow, int endrow) const
 ... for the specified row span More...
 
UMat rowRange (const Range &r) const
 
UMatsetTo (InputArray value, InputArray mask=noArray())
 sets some of the matrix elements to s, according to the mask More...
 
size_t step1 (int i=0) const
 returns step/elemSize1() More...
 
UMat t () const
 matrix transposition by means of matrix expressions More...
 
size_t total () const
 returns the total number of matrix elements More...
 
int type () const
 returns element type, similar to CV_MAT_TYPE(cvmat->type) More...
 

Static Public Member Functions

static UMat diag (const UMat &d)
 constructs a square diagonal matrix which main diagonal is vector "d" More...
 
static UMat eye (int rows, int cols, int type)
 
static UMat eye (Size size, int type)
 
static MatAllocatorgetStdAllocator ()
 and the standard allocator More...
 
static UMat ones (int rows, int cols, int type)
 
static UMat ones (Size size, int type)
 
static UMat ones (int ndims, const int *sz, int type)
 
static UMat zeros (int rows, int cols, int type)
 Matlab-style matrix initialization. More...
 
static UMat zeros (Size size, int type)
 
static UMat zeros (int ndims, const int *sz, int type)
 

Public Attributes

MatAllocatorallocator
 custom allocator More...
 
int cols
 
int dims
 the matrix dimensionality, >= 2 More...
 
int flags
 
size_t offset
 
int rows
 the number of rows and columns or (-1, -1) when the matrix has more than 2 dimensions More...
 
MatSize size
 
MatStep step
 
UMatDatau
 
UMatUsageFlags usageFlags
 

Detailed Description

Todo:
document

Member Enumeration Documentation

anonymous enum
Enumerator
MAGIC_VAL 
AUTO_STEP 
CONTINUOUS_FLAG 
SUBMATRIX_FLAG 
anonymous enum
Enumerator
MAGIC_MASK 
TYPE_MASK 
DEPTH_MASK 

Constructor & Destructor Documentation

cv::UMat::UMat ( UMatUsageFlags  usageFlags = USAGE_DEFAULT)

default constructor

cv::UMat::UMat ( int  rows,
int  cols,
int  type,
UMatUsageFlags  usageFlags = USAGE_DEFAULT 
)

constructs 2D matrix of the specified size and type

cv::UMat::UMat ( Size  size,
int  type,
UMatUsageFlags  usageFlags = USAGE_DEFAULT 
)
cv::UMat::UMat ( int  rows,
int  cols,
int  type,
const Scalar s,
UMatUsageFlags  usageFlags = USAGE_DEFAULT 
)

constucts 2D matrix and fills it with the specified value _s.

cv::UMat::UMat ( Size  size,
int  type,
const Scalar s,
UMatUsageFlags  usageFlags = USAGE_DEFAULT 
)
cv::UMat::UMat ( int  ndims,
const int *  sizes,
int  type,
UMatUsageFlags  usageFlags = USAGE_DEFAULT 
)

constructs n-dimensional matrix

cv::UMat::UMat ( int  ndims,
const int *  sizes,
int  type,
const Scalar s,
UMatUsageFlags  usageFlags = USAGE_DEFAULT 
)
cv::UMat::UMat ( const UMat m)

copy constructor

cv::UMat::UMat ( const UMat m,
const Range rowRange,
const Range colRange = Range::all() 
)

creates a matrix header for a part of the bigger matrix

cv::UMat::UMat ( const UMat m,
const Rect roi 
)
cv::UMat::UMat ( const UMat m,
const Range ranges 
)
template<typename _Tp >
cv::UMat::UMat ( const std::vector< _Tp > &  vec,
bool  copyData = false 
)
explicit

builds matrix from std::vector with or without copying the data

template<typename _Tp , int n>
cv::UMat::UMat ( const Vec< _Tp, n > &  vec,
bool  copyData = true 
)
explicit

builds matrix from cv::Vec; the data is copied by default

template<typename _Tp , int m, int n>
cv::UMat::UMat ( const Matx< _Tp, m, n > &  mtx,
bool  copyData = true 
)
explicit

builds matrix from cv::Matx; the data is copied by default

template<typename _Tp >
cv::UMat::UMat ( const Point_< _Tp > &  pt,
bool  copyData = true 
)
explicit

builds matrix from a 2D point

template<typename _Tp >
cv::UMat::UMat ( const Point3_< _Tp > &  pt,
bool  copyData = true 
)
explicit

builds matrix from a 3D point

template<typename _Tp >
cv::UMat::UMat ( const MatCommaInitializer_< _Tp > &  commaInitializer)
explicit

builds matrix from comma initializer

cv::UMat::~UMat ( )

destructor - calls release()

Member Function Documentation

void cv::UMat::addref ( )

increases the reference counter; use with care to avoid memleaks

UMat& cv::UMat::adjustROI ( int  dtop,
int  dbottom,
int  dleft,
int  dright 
)

moves/resizes the current matrix ROI inside the parent matrix.

void cv::UMat::assignTo ( UMat m,
int  type = -1 
) const
int cv::UMat::channels ( ) const

returns element type, similar to CV_MAT_CN(cvmat->type)

int cv::UMat::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

UMat cv::UMat::clone ( ) const

returns deep copy of the matrix, i.e. the data is copied

UMat cv::UMat::col ( int  x) const

returns a new matrix header for the specified column

UMat cv::UMat::colRange ( int  startcol,
int  endcol 
) const

... for the specified column span

UMat cv::UMat::colRange ( const Range r) const
void cv::UMat::convertTo ( OutputArray  m,
int  rtype,
double  alpha = 1,
double  beta = 0 
) const

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

void cv::UMat::copySize ( const UMat m)

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

void cv::UMat::copyTo ( OutputArray  m) const

copies the matrix content to "m".

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

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

void cv::UMat::create ( int  rows,
int  cols,
int  type,
UMatUsageFlags  usageFlags = USAGE_DEFAULT 
)

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

void cv::UMat::create ( Size  size,
int  type,
UMatUsageFlags  usageFlags = USAGE_DEFAULT 
)
void cv::UMat::create ( int  ndims,
const int *  sizes,
int  type,
UMatUsageFlags  usageFlags = USAGE_DEFAULT 
)
void cv::UMat::deallocate ( )

deallocates the matrix data

int cv::UMat::depth ( ) const

returns element type, similar to CV_MAT_DEPTH(cvmat->type)

UMat cv::UMat::diag ( int  d = 0) const

... for the specified diagonal

static UMat cv::UMat::diag ( const UMat d)
static

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

double cv::UMat::dot ( InputArray  m) const

computes dot-product

size_t cv::UMat::elemSize ( ) const

returns element size in bytes,

size_t cv::UMat::elemSize1 ( ) const

returns the size of element channel in bytes.

bool cv::UMat::empty ( ) const

returns true if matrix data is NULL

static UMat cv::UMat::eye ( int  rows,
int  cols,
int  type 
)
static
static UMat cv::UMat::eye ( Size  size,
int  type 
)
static
Mat cv::UMat::getMat ( int  flags) const
static MatAllocator* cv::UMat::getStdAllocator ( )
static

and the standard allocator

void* cv::UMat::handle ( int  accessFlags) const
UMat cv::UMat::inv ( int  method = DECOMP_LU) const

matrix inversion by means of matrix expressions

bool cv::UMat::isContinuous ( ) const

returns true iff the matrix data is continuous

bool cv::UMat::isSubmatrix ( ) const

returns true if the matrix is a submatrix of another matrix

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

locates matrix header within a parent matrix. See below

UMat cv::UMat::mul ( InputArray  m,
double  scale = 1 
) const

per-element matrix multiplication by means of matrix expressions

void cv::UMat::ndoffset ( size_t ofs) const
static UMat cv::UMat::ones ( int  rows,
int  cols,
int  type 
)
static
static UMat cv::UMat::ones ( Size  size,
int  type 
)
static
static UMat cv::UMat::ones ( int  ndims,
const int *  sz,
int  type 
)
static
UMat cv::UMat::operator() ( Range  rowRange,
Range  colRange 
) const

extracts a rectangular sub-matrix

UMat cv::UMat::operator() ( const Rect roi) const
UMat cv::UMat::operator() ( const Range ranges) const
UMat& cv::UMat::operator= ( const UMat m)

assignment operators

UMat& cv::UMat::operator= ( const Scalar s)

sets every matrix element to s

void cv::UMat::release ( )

decreases reference counter;

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

creates alternative matrix header for the same data, with different

UMat cv::UMat::reshape ( int  cn,
int  newndims,
const int *  newsz 
) const
UMat cv::UMat::row ( int  y) const

returns a new matrix header for the specified row

UMat cv::UMat::rowRange ( int  startrow,
int  endrow 
) const

... for the specified row span

UMat cv::UMat::rowRange ( const Range r) const
UMat& cv::UMat::setTo ( InputArray  value,
InputArray  mask = noArray() 
)

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

size_t cv::UMat::step1 ( int  i = 0) const

returns step/elemSize1()

UMat cv::UMat::t ( ) const

matrix transposition by means of matrix expressions

size_t cv::UMat::total ( ) const

returns the total number of matrix elements

int cv::UMat::type ( ) const

returns element type, similar to CV_MAT_TYPE(cvmat->type)

static UMat cv::UMat::zeros ( int  rows,
int  cols,
int  type 
)
static

Matlab-style matrix initialization.

static UMat cv::UMat::zeros ( Size  size,
int  type 
)
static
static UMat cv::UMat::zeros ( int  ndims,
const int *  sz,
int  type 
)
static

Member Data Documentation

MatAllocator* cv::UMat::allocator

custom allocator

int cv::UMat::cols
int cv::UMat::dims

the matrix dimensionality, >= 2

int cv::UMat::flags

includes several bit-fields:

  • the magic signature
  • continuity flag
  • depth
  • number of channels
size_t cv::UMat::offset
int cv::UMat::rows

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

MatSize cv::UMat::size
MatStep cv::UMat::step
UMatData* cv::UMat::u
UMatUsageFlags cv::UMat::usageFlags

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