OpenCV  4.1.1-pre
Open Source Computer Vision
Looking for a C++ dev who knows OpenCV?
I'm looking for work. Hire me!
cv::gapi::own::Mat Class Reference

#include <opencv2/gapi/own/mat.hpp>

Inheritance diagram for cv::gapi::own::Mat:
Collaboration diagram for cv::gapi::own::Mat:

Public Types

enum  { AUTO_STEP = 0 }
 
enum  { TYPE_MASK = 0x00000FFF }
 

Public Member Functions

 Mat ()=default
 
 Mat (int _rows, int _cols, int _type, void *_data, size_t _step=AUTO_STEP)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
 Mat (Mat const &src, const Rect &roi)
 
 Mat (Mat const &src)=default
 
 Mat (Mat &&src)=default
 
int channels () const
 Returns the number of matrix channels. More...
 
void copyTo (Mat &dst) const
 Copies the matrix to another one. More...
 
void create (int _rows, int _cols, int _type)
 
void create (Size _size, int _type)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
int depth () const
 Returns the depth of a matrix element. More...
 
size_t elemSize () const
 Returns the matrix element size in bytes. More...
 
bool empty () const
 Returns true if the array has no elements. More...
 
Mat operator() (const Rect &roi) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
Matoperator= (Mat const &src)=default
 
Matoperator= (Mat &&src)=default
 
Matoperator= (const Scalar &s)
 Sets all or some of the array elements to the specified value. More...
 
ucharptr (int row, int col=0)
 Returns a pointer to the specified matrix row. More...
 
const ucharptr (int row, int col=0) const
 
size_t total () const
 Returns the total number of array elements. More...
 
int type () const
 Returns the type of a matrix element. More...
 

Public Attributes

int cols = 0
 
uchardata = nullptr
 pointer to the data More...
 
int flags = 0
 includes several bit-fields: More...
 
int rows = 0
 the number of rows and columns or (-1, -1) when the matrix has more than 2 dimensions More...
 
size_t step = 0
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
Enumerator
AUTO_STEP 

◆ anonymous enum

anonymous enum
inherited
Enumerator
TYPE_MASK 

Constructor & Destructor Documentation

◆ Mat() [1/5]

cv::gapi::own::Mat::Mat ( )
default

◆ Mat() [2/5]

cv::gapi::own::Mat::Mat ( int  _rows,
int  _cols,
int  _type,
void *  _data,
size_t  _step = AUTO_STEP 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
_rowsNumber of rows in a 2D array.
_colsNumber of columns in a 2D array.
_typeArray type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
_dataPointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. This operation is very efficient and can be used to process external data using OpenCV functions. The external data is not automatically deallocated, so you should take care of it.
_stepNumber of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize(). See Mat::elemSize.

◆ Mat() [3/5]

◆ Mat() [4/5]

cv::gapi::own::Mat::Mat ( Mat const &  src)
default

◆ Mat() [5/5]

cv::gapi::own::Mat::Mat ( Mat &&  src)
default

Member Function Documentation

◆ channels()

int cv::gapi::own::Mat::channels ( ) const
inline

Returns the number of matrix channels.

The method returns the number of matrix channels.

References CV_MAT_CN, and cv::gapi::own::detail::MatHeader::flags.

◆ copyTo()

void cv::gapi::own::Mat::copyTo ( Mat dst) const
inline

Copies the matrix to another one.

The method copies the matrix data to another matrix. Before copying the data, the method invokes :

m.create(this->size(), this->type());

so that the destination matrix is reallocated if needed. While m.copyTo(m); works flawlessly, the function does not handle the case of a partial overlap between the source and the destination matrices.

References cv::gapi::own::detail::MatHeader::cols, create(), cv::gapi::own::detail::default_step(), ptr(), and cv::gapi::own::detail::MatHeader::rows.

Here is the call graph for this function:

◆ create() [1/2]

void cv::gapi::own::Mat::create ( int  _rows,
int  _cols,
int  _type 
)
inline
Parameters
_rowsNew number of rows.
_colsNew number of columns.
_typeNew matrix type.

Referenced by copyTo().

Here is the caller graph for this function:

◆ create() [2/2]

void cv::gapi::own::Mat::create ( Size  _size,
int  _type 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
_sizeAlternative new matrix size specification: Size(cols, rows)
_typeNew matrix type.

References cv::gapi::own::detail::MatHeader::cols, cv::gapi::own::Size::height, cv::gapi::own::detail::MatHeader::rows, and cv::gapi::own::Size::width.

◆ depth()

int cv::gapi::own::Mat::depth ( ) const
inline

Returns the depth of a matrix element.

The method returns the identifier of the matrix element depth (the type of each individual channel). For example, for a 16-bit signed element array, the method returns CV_16S . A complete list of matrix types contains the following values:

  • CV_8U - 8-bit unsigned integers ( 0..255 )
  • CV_8S - 8-bit signed integers ( -128..127 )
  • CV_16U - 16-bit unsigned integers ( 0..65535 )
  • CV_16S - 16-bit signed integers ( -32768..32767 )
  • CV_32S - 32-bit signed integers ( -2147483648..2147483647 )
  • CV_32F - 32-bit floating-point numbers ( -FLT_MAX..FLT_MAX, INF, NAN )
  • CV_64F - 64-bit floating-point numbers ( -DBL_MAX..DBL_MAX, INF, NAN )

References CV_MAT_DEPTH, and cv::gapi::own::detail::MatHeader::flags.

◆ elemSize()

size_t cv::gapi::own::Mat::elemSize ( ) const
inline

Returns the matrix element size in bytes.

The method returns the matrix element size in bytes. For example, if the matrix type is CV_16SC3 , the method returns 3*sizeof(short) or 6.

References CV_ELEM_SIZE.

◆ empty()

bool cv::gapi::own::Mat::empty ( ) const

Returns true if the array has no elements.

The method returns true if Mat::total() is 0 or if Mat::data is NULL. Because of pop_back() and resize() methods M.total() == 0 does not imply that M.data == NULL.

◆ operator()()

Mat cv::gapi::own::Mat::operator() ( const Rect roi) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
roiExtracted submatrix specified as a rectangle.

◆ operator=() [1/3]

Mat& cv::gapi::own::Mat::operator= ( Mat const &  src)
default

◆ operator=() [2/3]

Mat& cv::gapi::own::Mat::operator= ( Mat &&  src)
default

◆ operator=() [3/3]

Mat& cv::gapi::own::Mat::operator= ( const Scalar s)
inline

Sets all or some of the array elements to the specified value.

Parameters
sAssigned scalar converted to the actual array type.

References cv::gapi::own::detail::assign_row(), cv::gapi::own::detail::MatHeader::cols, CV_16S, CV_16U, CV_32F, CV_32S, CV_64F, CV_8S, CV_8U, and cv::gapi::own::detail::MatHeader::rows.

Here is the call graph for this function:

◆ ptr() [1/2]

uchar* cv::gapi::own::Mat::ptr ( int  row,
int  col = 0 
)
inline

Returns a pointer to the specified matrix row.

The methods return uchar* or typed pointer to the specified matrix row. See the sample in Mat::isContinuous to know how to use these methods.

Parameters
rowIndex along the dimension 0
colIndex along the dimension 1

Referenced by copyTo().

Here is the caller graph for this function:

◆ ptr() [2/2]

const uchar* cv::gapi::own::Mat::ptr ( int  row,
int  col = 0 
) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References CV_ELEM_SIZE, cv::gapi::own::detail::MatHeader::data, and cv::gapi::own::detail::MatHeader::step.

◆ total()

size_t cv::gapi::own::Mat::total ( ) const
inline

Returns the total number of array elements.

The method returns the number of array elements (a number of pixels if the array represents an image).

References cv::gapi::own::detail::MatHeader::cols, and cv::gapi::own::detail::MatHeader::rows.

◆ type()

int cv::gapi::own::Mat::type ( ) const
inline

Returns the type of a matrix element.

The method returns a matrix element type. This is an identifier compatible with the CvMat type system, like CV_16SC3 or 16-bit signed 3-channel array, and so on.

References CV_MAT_TYPE, and cv::gapi::own::detail::MatHeader::flags.

Referenced by cv::gapi::own::to_ocv().

Here is the caller graph for this function:

Member Data Documentation

◆ cols

int cv::gapi::own::detail::MatHeader::cols = 0
inherited

◆ data

uchar* cv::gapi::own::detail::MatHeader::data = nullptr
inherited

pointer to the data

Referenced by Mat(), ptr(), and cv::gapi::own::to_ocv().

◆ flags

int cv::gapi::own::detail::MatHeader::flags = 0
inherited

includes several bit-fields:

  • depth
  • number of channels

Referenced by channels(), depth(), and type().

◆ rows

int cv::gapi::own::detail::MatHeader::rows = 0
inherited

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

Referenced by copyTo(), create(), Mat(), operator=(), cv::gapi::own::to_ocv(), and total().

◆ step

size_t cv::gapi::own::detail::MatHeader::step = 0
inherited

Referenced by ptr(), and cv::gapi::own::to_ocv().


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