OpenCV  5.0.0-pre
Open Source Computer Vision
Loading...
Searching...
No Matches
Public Member Functions | List of all members
cv::gapi::own::Mat Class Reference

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

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

Public Member Functions

 Mat ()=default
 
 Mat (const std::vector< int > &_dims, int _type, void *_data)
 
 Mat (int _rows, int _cols, int _type, void *_data, size_t _step=AUTO_STEP)
 
 Mat (Mat &&)=default
 
 Mat (Mat const &)=default
 
 Mat (Mat const &src, const Rect &roi)
 
 Mat (std::vector< int > &&_dims, int _type, void *_data)
 
int channels () const
 Returns the number of matrix channels.
 
Mat clone () const
 Creates a full copy of the matrix and the underlying data.
 
void copyTo (Mat &dst) const
 Copies the matrix to another one.
 
void create (const std::vector< int > &_dims, int _type)
 
void create (int _rows, int _cols, int _type)
 
void create (Size _size, int _type)
 
int depth () const
 Returns the depth of a matrix element.
 
size_t elemSize () const
 Returns the matrix element size in bytes.
 
bool empty () const
 Returns true if the array has no elements.
 
Mat operator() (const Rect &roi) const
 
Matoperator= (const Scalar &s)
 Sets all or some of the array elements to the specified value.
 
Matoperator= (Mat &&)=default
 
Matoperator= (Mat const &)=default
 
ucharptr (int row, int col=0)
 Returns a pointer to the specified matrix row.
 
const ucharptr (int row, int col=0) const
 
size_t total () const
 Returns the total number of array elements.
 
int type () const
 Returns the type of a matrix element.
 
- Public Member Functions inherited from cv::gapi::own::detail::MatHeader
 MatHeader ()=default
 
 MatHeader (const MatHeader &)=default
 
 MatHeader (const std::vector< int > &_dims, int type, void *_data)
 
 MatHeader (int _rows, int _cols, int type, void *_data, size_t _step)
 
 MatHeader (MatHeader &&src)
 
MatHeaderoperator= (const MatHeader &)=default
 
MatHeaderoperator= (MatHeader &&src)
 

Additional Inherited Members

- Public Types inherited from cv::gapi::own::detail::MatHeader
enum  { AUTO_STEP = 0 }
 
enum  { TYPE_MASK = 0x00000FFF }
 
- Public Attributes inherited from cv::gapi::own::detail::MatHeader
int cols = 0
 
uchardata = nullptr
 pointer to the data
 
std::vector< int > dims
 dimensions (ND-case)
 
int flags = 0
 
int rows = 0
 the number of rows and columns or (-1, -1) when the matrix has more than 2 dimensions
 
size_t step = 0
 

Constructor & Destructor Documentation

◆ Mat() [1/7]

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

◆ Mat() [2/7]

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/7]

cv::gapi::own::Mat::Mat ( const std::vector< int > &  _dims,
int  _type,
void *  _data 
)
inline

◆ Mat() [4/7]

cv::gapi::own::Mat::Mat ( std::vector< int > &&  _dims,
int  _type,
void *  _data 
)
inline

◆ Mat() [5/7]

cv::gapi::own::Mat::Mat ( Mat const &  src,
const Rect roi 
)
inline
Here is the call graph for this function:

◆ Mat() [6/7]

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

◆ Mat() [7/7]

cv::gapi::own::Mat::Mat ( Mat &&  )
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. If matrix is N-dimensional, -1 is returned.

◆ clone()

Mat cv::gapi::own::Mat::clone ( ) const
inline

Creates a full copy of the matrix and the underlying data.

The method creates a full copy of the matrix. The original step[] is not taken into account. So, the copy has a continuous buffer occupying total() * elemSize() bytes.

Here is the call graph for this function:

◆ 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());
int type() const
Returns the type of a matrix element.
Definition mat.hpp:195

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.

Here is the call graph for this function:

◆ create() [1/3]

void cv::gapi::own::Mat::create ( const std::vector< int > &  _dims,
int  _type 
)
inline

◆ create() [2/3]

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.
Here is the call graph for this function:

◆ create() [3/3]

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.

◆ 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 )

◆ 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.

Here is the call graph for this function:

◆ empty()

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

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.

Here is the call graph for this function:

◆ 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= ( 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.
Here is the call graph for this function:

◆ operator=() [2/3]

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

◆ operator=() [3/3]

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

◆ 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
Here is the call 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.

Here is the call graph for this function:

◆ 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).

◆ 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.


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