| OpenCV 5.0.0alpha Open Source Computer Vision

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
cv::UMat Class Reference
Core functionality » Basic structures

`#include <opencv2/core/mat.hpp>`

Collaboration diagram for cv::UMat:

## 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 (const UMat &m)
| copy constructor
| UMat (const UMat &m, const Range &rowRange, const Range &colRange=Range::all())
| creates a matrix header for a part of the bigger matrix
| UMat (const UMat &m, const Range *ranges)
| UMat (const UMat &m, const Rect &roi)
| UMat (const UMat &m, const std::vector< Range > &ranges)
| UMat (int ndims, const int *sizes, 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
| UMat (int rows, int cols, int type, const Scalar &s, UMatUsageFlags usageFlags=USAGE_DEFAULT)
| constructs 2D matrix and fills it with the specified value _s.
| UMat (int rows, int cols, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
| constructs 2D matrix of the specified size and type
| UMat (Size size, int type, const Scalar &s, UMatUsageFlags usageFlags=USAGE_DEFAULT)
| UMat (Size size, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
| UMat (UMat &&m)
| UMat (UMatUsageFlags usageFlags=USAGE_DEFAULT) CV_NOEXCEPT
| default constructor
| ~UMat ()
| destructor - calls release()
void | addref ()
| increases the reference counter; use with care to avoid memleaks
UMat & | adjustROI (int dtop, int dbottom, int dleft, int dright)
| moves/resizes the current matrix ROI inside the parent matrix.
void | assignTo (UMat &m, int type=-1) const
int | channels () const
| returns element type, similar to CV_MAT_CN(cvmat->type)
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
CV_NODISCARD_STD UMat | clone () const
| returns deep copy of the matrix, i.e. the data is copied
UMat | col (int x) const
| returns a new matrix header for the specified column
UMat | colRange (const Range &r) const
UMat | colRange (int startcol, int endcol) const
| ... for the specified column span
void | convertTo (OutputArray m, int rtype, double alpha=1, double beta=0) const
| converts matrix to another datatype with optional scaling. See cvConvertScale.
void | copySize (const UMat &m)
| internal use function; properly re-allocates _size, _step arrays
void | copyTo (OutputArray m) const
| copies the matrix content to "m".
void | copyTo (OutputArray m, InputArray mask) const
| copies those matrix elements to "m" that are marked with non-zero mask elements.
void | create (const MatShape &shape, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
void | create (const std::vector< int > &sizes, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
void | create (int ndims, const int *sizes, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
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.
void | create (Size size, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
void | createSameSize (InputArray arr, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
| allocates new matrix data unless the matrix already has specified size and type.
void | deallocate ()
| deallocates the matrix data
int | depth () const
| returns element type, similar to CV_MAT_DEPTH(cvmat->type)
UMat | diag (int d=0) const
double | dot (InputArray m) const
| computes dot-product
size_t | elemSize () const
| returns element size in bytes,
size_t | elemSize1 () const
| returns the size of element channel in bytes.
bool | empty () const
| returns true if matrix data is NULL
void | fit (const MatShape &shape, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
void | fit (const std::vector< int > &sizes, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
void | fit (int ndims, const int *sizes, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
void | fit (int rows, int cols, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
| fits the new shape into existing data buffer if possible, otherwise reallocates data.
void | fit (Size size, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
void | fitSameSize (InputArray arr, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
Mat | getMat (AccessFlag flags) const
void * | handle (AccessFlag accessFlags) const
UMat | inv (int method=DECOMP_LU) const
| matrix inversion by means of matrix expressions
bool | isContinuous () const
| returns true iff the matrix data is continuous
bool | isSubmatrix () const
| returns true if the matrix is a submatrix of another matrix
void | locateROI (Size &wholeSize, Point &ofs) const
| locates matrix header within a parent matrix. See below
UMat | mul (InputArray m, double scale=1) const
| per-element matrix multiplication by means of matrix expressions
void | ndoffset (size_t *ofs) const
UMat | operator() (const Range *ranges) const
UMat | operator() (const Rect &roi) const
UMat | operator() (const std::vector< Range > &ranges) const
UMat | operator() (Range rowRange, Range colRange) const
| extracts a rectangular sub-matrix
UMat & | operator= (const Scalar &s)
| sets every matrix element to s
UMat & | operator= (const UMat &m)
| assignment operators
UMat & | operator= (UMat &&m)
void | release ()
| decreases reference counter;
UMat | reshape (int cn, const MatShape &shape) const
UMat | reshape (int cn, int newndims, const int *newsz) const
UMat | reshape (int cn, int rows=0) const
| creates alternative matrix header for the same data, with different
UMat | row (int y) const
| returns a new matrix header for the specified row
UMat | rowRange (const Range &r) const
UMat | rowRange (int startrow, int endrow) const
| ... for the specified row span
UMat & | setTo (InputArray value, InputArray mask=noArray())
| sets some of the matrix elements to s, according to the mask
MatShape | shape () const
| Returns the shape.
size_t | step1 (int i=0) const
| returns step/elemSize1()
UMat | t () const
| matrix transposition by means of matrix expressions
size_t | total () const
| returns the total number of matrix elements
int | type () const
| returns element type, similar to CV_MAT_TYPE(cvmat->type)
void | updateContinuityFlag ()
| internal use method: updates the continuity flag

## Static Public Member Functions
static CV_NODISCARD_STD UMat | diag (const UMat &d, UMatUsageFlags usageFlags=USAGE_DEFAULT)
| constructs a square diagonal matrix which main diagonal is vector "d"
static CV_NODISCARD_STD UMat | eye (int rows, int cols, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
static CV_NODISCARD_STD UMat | eye (Size size, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
static MatAllocator * | getStdAllocator ()
| and the standard allocator
static CV_NODISCARD_STD UMat | ones (int ndims, const int *sz, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
static CV_NODISCARD_STD UMat | ones (int rows, int cols, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
static CV_NODISCARD_STD UMat | ones (Size size, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
static CV_NODISCARD_STD UMat | zeros (int ndims, const int *sz, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
static CV_NODISCARD_STD UMat | zeros (int rows, int cols, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
| Matlab-style matrix initialization.
static CV_NODISCARD_STD UMat | zeros (Size size, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)

## Public Attributes
MatAllocator * | allocator
| custom allocator
int | cols
| number of columns in the matrix; -1 when the matrix has more than 2 dimensions
int | dims
| the matrix dimensionality, >= 2
int | flags
size_t | offset
| offset of the submatrix (or 0)
int | rows
| number of rows in the matrix; -1 when the matrix has more than 2 dimensions
MatSize | size
| dimensional size of the matrix; accessible in various formats
MatStep | step
| number of bytes each matrix element/row/plane/dimension occupies
UMatData * | u
| black-box container of UMat data
UMatUsageFlags | usageFlags
| usage flags for allocator; recommend do not set directly, instead set during construct/create/getUMat

## Detailed Description

Todo
  document

Examples
  samples/hog_tapi.cpp.

## Member Enumeration Documentation

## ◆ anonymous enum

anonymous enum

Enumerator
MAGIC_VAL |
AUTO_STEP |
CONTINUOUS_FLAG |
SUBMATRIX_FLAG |

## ◆ anonymous enum

anonymous enum

Enumerator
MAGIC_MASK |
TYPE_MASK |
DEPTH_MASK |

## Constructor & Destructor Documentation

## ◆ UMat() [1/13]

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

Python:
| cv.UMat( | [, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | m | ) -> | <UMat object>
| cv.UMat( | m, rowRange[, colRange] | ) -> | <UMat object>
| cv.UMat( | m, roi | ) -> | <UMat object>
| cv.UMat( | m, ranges | ) -> | <UMat object>

default constructor

## ◆ UMat() [2/13]

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

Python:
| cv.UMat( | [, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | m | ) -> | <UMat object>
| cv.UMat( | m, rowRange[, colRange] | ) -> | <UMat object>
| cv.UMat( | m, roi | ) -> | <UMat object>
| cv.UMat( | m, ranges | ) -> | <UMat object>

constructs 2D matrix of the specified size and type

## ◆ UMat() [3/13]

cv::UMat::UMat | ( | Size | size,
|  | int | type,
|  | UMatUsageFlags | usageFlags = USAGE_DEFAULT )

Python:
| cv.UMat( | [, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | m | ) -> | <UMat object>
| cv.UMat( | m, rowRange[, colRange] | ) -> | <UMat object>
| cv.UMat( | m, roi | ) -> | <UMat object>
| cv.UMat( | m, ranges | ) -> | <UMat object>

## ◆ UMat() [4/13]

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

Python:
| cv.UMat( | [, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | m | ) -> | <UMat object>
| cv.UMat( | m, rowRange[, colRange] | ) -> | <UMat object>
| cv.UMat( | m, roi | ) -> | <UMat object>
| cv.UMat( | m, ranges | ) -> | <UMat object>

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

## ◆ UMat() [5/13]

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

Python:
| cv.UMat( | [, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | m | ) -> | <UMat object>
| cv.UMat( | m, rowRange[, colRange] | ) -> | <UMat object>
| cv.UMat( | m, roi | ) -> | <UMat object>
| cv.UMat( | m, ranges | ) -> | <UMat object>

## ◆ UMat() [6/13]

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

Python:
| cv.UMat( | [, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | m | ) -> | <UMat object>
| cv.UMat( | m, rowRange[, colRange] | ) -> | <UMat object>
| cv.UMat( | m, roi | ) -> | <UMat object>
| cv.UMat( | m, ranges | ) -> | <UMat object>

constructs n-dimensional matrix

## ◆ UMat() [7/13]

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

Python:
| cv.UMat( | [, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | m | ) -> | <UMat object>
| cv.UMat( | m, rowRange[, colRange] | ) -> | <UMat object>
| cv.UMat( | m, roi | ) -> | <UMat object>
| cv.UMat( | m, ranges | ) -> | <UMat object>

## ◆ UMat() [8/13]

cv::UMat::UMat | ( | const UMat & | m | ) |

Python:
| cv.UMat( | [, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | m | ) -> | <UMat object>
| cv.UMat( | m, rowRange[, colRange] | ) -> | <UMat object>
| cv.UMat( | m, roi | ) -> | <UMat object>
| cv.UMat( | m, ranges | ) -> | <UMat object>

copy constructor

## ◆ UMat() [9/13]

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

Python:
| cv.UMat( | [, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | m | ) -> | <UMat object>
| cv.UMat( | m, rowRange[, colRange] | ) -> | <UMat object>
| cv.UMat( | m, roi | ) -> | <UMat object>
| cv.UMat( | m, ranges | ) -> | <UMat object>

creates a matrix header for a part of the bigger matrix

## ◆ UMat() [10/13]

cv::UMat::UMat | ( | const UMat & | m,
|  | const Rect & | roi )

Python:
| cv.UMat( | [, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | m | ) -> | <UMat object>
| cv.UMat( | m, rowRange[, colRange] | ) -> | <UMat object>
| cv.UMat( | m, roi | ) -> | <UMat object>
| cv.UMat( | m, ranges | ) -> | <UMat object>

## ◆ UMat() [11/13]

cv::UMat::UMat | ( | const UMat & | m,
|  | const Range * | ranges )

Python:
| cv.UMat( | [, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | m | ) -> | <UMat object>
| cv.UMat( | m, rowRange[, colRange] | ) -> | <UMat object>
| cv.UMat( | m, roi | ) -> | <UMat object>
| cv.UMat( | m, ranges | ) -> | <UMat object>

## ◆ UMat() [12/13]

cv::UMat::UMat | ( | const UMat & | m,
|  | const std::vector< Range > & | ranges )

Python:
| cv.UMat( | [, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | m | ) -> | <UMat object>
| cv.UMat( | m, rowRange[, colRange] | ) -> | <UMat object>
| cv.UMat( | m, roi | ) -> | <UMat object>
| cv.UMat( | m, ranges | ) -> | <UMat object>

## ◆ ~UMat()

cv::UMat::~UMat | ( |  | ) |

destructor - calls release()

## ◆ UMat() [13/13]

cv::UMat::UMat | ( | UMat && | m | ) |

Python:
| cv.UMat( | [, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | rows, cols, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | size, type, s[, usageFlags] | ) -> | <UMat object>
| cv.UMat( | m | ) -> | <UMat object>
| cv.UMat( | m, rowRange[, colRange] | ) -> | <UMat object>
| cv.UMat( | m, roi | ) -> | <UMat object>
| cv.UMat( | m, ranges | ) -> | <UMat object>

## Member Function Documentation

## ◆ addref()

void cv::UMat::addref | ( |  | ) |

increases the reference counter; use with care to avoid memleaks

## ◆ adjustROI()

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

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

## ◆ assignTo()

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

## ◆ channels()

int cv::UMat::channels | ( |  | ) | const

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

## ◆ checkVector()

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

## ◆ clone()

CV_NODISCARD_STD UMat cv::UMat::clone | ( |  | ) | const

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

## ◆ col()

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

returns a new matrix header for the specified column

## ◆ colRange() [1/2]

UMat cv::UMat::colRange | ( | const Range & | r | ) | const

## ◆ colRange() [2/2]

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

... for the specified column span

## ◆ convertTo()

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

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

## ◆ copySize()

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

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

## ◆ copyTo() [1/2]

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

copies the matrix content to "m".

Examples
  samples/hog_tapi.cpp.

## ◆ copyTo() [2/2]

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

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

## ◆ create() [1/5]

void cv::UMat::create | ( | const MatShape & | shape,
|  | int | type,
|  | UMatUsageFlags | usageFlags = USAGE_DEFAULT )

## ◆ create() [2/5]

void cv::UMat::create | ( | const std::vector< int > & | sizes,
|  | int | type,
|  | UMatUsageFlags | usageFlags = USAGE_DEFAULT )

## ◆ create() [3/5]

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

## ◆ create() [4/5]

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.

## ◆ create() [5/5]

void cv::UMat::create | ( | Size | size,
|  | int | type,
|  | UMatUsageFlags | usageFlags = USAGE_DEFAULT )

## ◆ createSameSize()

void cv::UMat::createSameSize | ( | InputArray | arr,
|  | int | type,
|  | UMatUsageFlags | usageFlags = USAGE_DEFAULT )

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

## ◆ deallocate()

void cv::UMat::deallocate | ( |  | ) |

deallocates the matrix data

## ◆ depth()

int cv::UMat::depth | ( |  | ) | const

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

## ◆ diag() [1/2]

static CV_NODISCARD_STD UMat cv::UMat::diag | ( | const UMat & | d,
|  | UMatUsageFlags | usageFlags = USAGE_DEFAULT )
| static

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

## ◆ diag() [2/2]

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

... for the specified diagonal (d=0 - the main diagonal, >0 - a diagonal from the upper half, <0 - a diagonal from the lower half)

## ◆ dot()

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

computes dot-product

## ◆ elemSize()

size_t cv::UMat::elemSize | ( |  | ) | const

returns element size in bytes,

## ◆ elemSize1()

size_t cv::UMat::elemSize1 | ( |  | ) | const

returns the size of element channel in bytes.

## ◆ empty()

bool cv::UMat::empty | ( |  | ) | const

returns true if matrix data is NULL

Examples
  samples/hog_tapi.cpp.

## ◆ eye() [1/2]

static CV_NODISCARD_STD UMat cv::UMat::eye | ( | int | rows,
|  | int | cols,
|  | int | type,
|  | UMatUsageFlags | usageFlags = USAGE_DEFAULT )
| static

## ◆ eye() [2/2]

static CV_NODISCARD_STD UMat cv::UMat::eye | ( | Size | size,
|  | int | type,
|  | UMatUsageFlags | usageFlags = USAGE_DEFAULT )
| static

## ◆ fit() [1/5]

void cv::UMat::fit | ( | const MatShape & | shape,
|  | int | type,
|  | UMatUsageFlags | usageFlags = USAGE_DEFAULT )

## ◆ fit() [2/5]

void cv::UMat::fit | ( | const std::vector< int > & | sizes,
|  | int | type,
|  | UMatUsageFlags | usageFlags = USAGE_DEFAULT )

## ◆ fit() [3/5]

void cv::UMat::fit | ( | int | ndims,
|  | const int * | sizes,
|  | int | type,
|  | UMatUsageFlags | usageFlags = USAGE_DEFAULT )

## ◆ fit() [4/5]

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

fits the new shape into existing data buffer if possible, otherwise reallocates data.

## ◆ fit() [5/5]

void cv::UMat::fit | ( | Size | size,
|  | int | type,
|  | UMatUsageFlags | usageFlags = USAGE_DEFAULT )

## ◆ fitSameSize()

void cv::UMat::fitSameSize | ( | InputArray | arr,
|  | int | type,
|  | UMatUsageFlags | usageFlags = USAGE_DEFAULT )

## ◆ getMat()

Mat cv::UMat::getMat | ( | AccessFlag | flags | ) | const

## ◆ getStdAllocator()

static MatAllocator * cv::UMat::getStdAllocator | ( |  | ) |
| static

and the standard allocator

## ◆ handle()

void * cv::UMat::handle | ( | AccessFlag | accessFlags | ) | const

Python:
| cv.UMat.handle( | accessFlags | ) -> | retval

Returns the OpenCL buffer handle on which UMat operates on. The UMat instance should be kept alive during the use of the handle to prevent the buffer to be returned to the OpenCV buffer pool.

## ◆ inv()

UMat cv::UMat::inv | ( | int | method = DECOMP_LU | ) | const

matrix inversion by means of matrix expressions

## ◆ isContinuous()

bool cv::UMat::isContinuous | ( |  | ) | const

Python:
| cv.UMat.isContinuous( |  | ) -> | retval

returns true iff the matrix data is continuous

## ◆ isSubmatrix()

bool cv::UMat::isSubmatrix | ( |  | ) | const

Python:
| cv.UMat.isSubmatrix( |  | ) -> | retval

returns true if the matrix is a submatrix of another matrix

## ◆ locateROI()

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

locates matrix header within a parent matrix. See below

## ◆ mul()

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

per-element matrix multiplication by means of matrix expressions

## ◆ ndoffset()

void cv::UMat::ndoffset | ( | size_t * | ofs | ) | const

## ◆ ones() [1/3]

static CV_NODISCARD_STD UMat cv::UMat::ones | ( | int | ndims,
|  | const int * | sz,
|  | int | type,
|  | UMatUsageFlags | usageFlags = USAGE_DEFAULT )
| static

## ◆ ones() [2/3]

static CV_NODISCARD_STD UMat cv::UMat::ones | ( | int | rows,
|  | int | cols,
|  | int | type,
|  | UMatUsageFlags | usageFlags = USAGE_DEFAULT )
| static

## ◆ ones() [3/3]

static CV_NODISCARD_STD UMat cv::UMat::ones | ( | Size | size,
|  | int | type,
|  | UMatUsageFlags | usageFlags = USAGE_DEFAULT )
| static

## ◆ operator()() [1/4]

UMat cv::UMat::operator() | ( | const Range * | ranges | ) | const

## ◆ operator()() [2/4]

UMat cv::UMat::operator() | ( | const Rect & | roi | ) | const

## ◆ operator()() [3/4]

UMat cv::UMat::operator() | ( | const std::vector< Range > & | ranges | ) | const

## ◆ operator()() [4/4]

UMat cv::UMat::operator() | ( | Range | rowRange,
|  | Range | colRange ) const

extracts a rectangular sub-matrix

## ◆ operator=() [1/3]

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

sets every matrix element to s

## ◆ operator=() [2/3]

UMat & cv::UMat::operator= | ( | const UMat & | m | ) |

assignment operators

## ◆ operator=() [3/3]

UMat & cv::UMat::operator= | ( | UMat && | m | ) |

## ◆ release()

void cv::UMat::release | ( |  | ) |

decreases reference counter;

## ◆ reshape() [1/3]

UMat cv::UMat::reshape | ( | int | cn,
|  | const MatShape & | shape ) const

## ◆ reshape() [2/3]

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

## ◆ reshape() [3/3]

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

creates alternative matrix header for the same data, with different

## ◆ row()

UMat cv::UMat::row | ( | int | y | ) | const

returns a new matrix header for the specified row

## ◆ rowRange() [1/2]

UMat cv::UMat::rowRange | ( | const Range & | r | ) | const

## ◆ rowRange() [2/2]

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

... for the specified row span

## ◆ setTo()

UMat & cv::UMat::setTo | ( | InputArray | value,
|  | InputArray | mask = noArray() )

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

## ◆ shape()

MatShape cv::UMat::shape | ( |  | ) | const

Returns the shape.

## ◆ step1()

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

returns step/elemSize1()

## ◆ t()

UMat cv::UMat::t | ( |  | ) | const

matrix transposition by means of matrix expressions

## ◆ total()

size_t cv::UMat::total | ( |  | ) | const

returns the total number of matrix elements

## ◆ type()

int cv::UMat::type | ( |  | ) | const

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

## ◆ updateContinuityFlag()

void cv::UMat::updateContinuityFlag | ( |  | ) |

internal use method: updates the continuity flag

## ◆ zeros() [1/3]

static CV_NODISCARD_STD UMat cv::UMat::zeros | ( | int | ndims,
|  | const int * | sz,
|  | int | type,
|  | UMatUsageFlags | usageFlags = USAGE_DEFAULT )
| static

## ◆ zeros() [2/3]

static CV_NODISCARD_STD UMat cv::UMat::zeros | ( | int | rows,
|  | int | cols,
|  | int | type,
|  | UMatUsageFlags | usageFlags = USAGE_DEFAULT )
| static

Matlab-style matrix initialization.

## ◆ zeros() [3/3]

static CV_NODISCARD_STD UMat cv::UMat::zeros | ( | Size | size,
|  | int | type,
|  | UMatUsageFlags | usageFlags = USAGE_DEFAULT )
| static

## Member Data Documentation

## ◆ allocator

MatAllocator* cv::UMat::allocator

custom allocator

## ◆ cols

int cv::UMat::cols

number of columns in the matrix; -1 when the matrix has more than 2 dimensions

Examples
  samples/hog_tapi.cpp.

## ◆ dims

int cv::UMat::dims

the matrix dimensionality, >= 2

## ◆ flags

int cv::UMat::flags

includes several bit-fields:

- the magic signature
- continuity flag
- depth
- number of channels

## ◆ offset

size_t cv::UMat::offset

offset of the submatrix (or 0)

## ◆ rows

int cv::UMat::rows

number of rows in the matrix; -1 when the matrix has more than 2 dimensions

Examples
  samples/hog_tapi.cpp.

## ◆ size

MatSize cv::UMat::size

dimensional size of the matrix; accessible in various formats

Examples
  samples/hog_tapi.cpp.

## ◆ step

MatStep cv::UMat::step

number of bytes each matrix element/row/plane/dimension occupies

## ◆ u

UMatData* cv::UMat::u

black-box container of UMat data

## ◆ usageFlags

UMatUsageFlags cv::UMat::usageFlags

usage flags for allocator; recommend do not set directly, instead set during construct/create/getUMat

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

- opencv2/core/mat.hpp