OpenCV  4.5.4
Open Source Computer Vision
Public Types | Public Member Functions | Public Attributes | List of all members
cv::cuda::GpuMatND Class Reference

#include <opencv2/core/cuda.hpp>

Public Types

using IndexArray = std::vector< int >
 
using SizeArray = std::vector< int >
 
using StepArray = std::vector< size_t >
 

Public Member Functions

 GpuMatND ()
 default constructor More...
 
 GpuMatND (SizeArray size, int type)
 
 GpuMatND (SizeArray size, int type, void *data, StepArray step=StepArray())
 
 GpuMatND (const GpuMatND &)=default
 
 GpuMatND (GpuMatND &&) noexcept=default
 
 ~GpuMatND ()
 destructor More...
 
GpuMatND clone () const
 Creates a full copy of the array and the underlying data. The method creates a full copy of the array. It mimics the behavior of Mat::clone(), i.e. the original step is not taken into account. So, the array copy is a continuous array occupying total()*elemSize() bytes. More...
 
GpuMatND clone (Stream &stream) const
 
void create (SizeArray size, int type)
 Allocates GPU memory. Suppose there is some GPU memory already allocated. In that case, this method may choose to reuse that GPU memory under the specific condition: it must be of the same size and type, not externally allocated, the GPU memory is continuous(i.e., isContinuous() is true), and is not a sub-matrix of another GpuMatND (i.e., isSubmatrix() is false). In other words, this method guarantees that the GPU memory allocated by this method is always continuous and is not a sub-region of another GpuMatND. More...
 
GpuMat createGpuMatHeader (IndexArray idx, Range rowRange, Range colRange) const
 Creates a GpuMat header for a 2D plane part of an n-dim matrix. More...
 
GpuMat createGpuMatHeader () const
 
void download (OutputArray dst) const
 
void download (OutputArray dst, Stream &stream) const
 
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 data is null More...
 
bool external () const
 returns true if not empty and points to external(user-allocated) gpu memory More...
 
uchargetDevicePtr () const
 returns pointer to the first byte of the GPU memory More...
 
bool isContinuous () const
 
bool isSubmatrix () const
 returns true if the matrix is a sub-matrix of another matrix More...
 
 operator GpuMat () const
 Extracts a 2D plane part of an n-dim matrix if this GpuMatND is effectively 2D. It differs from createGpuMatHeader() in that it clones a part of this GpuMatND. More...
 
GpuMatND operator() (const std::vector< Range > &ranges) const
 Extracts a sub-matrix. The operator makes a new header for the specified sub-array of *this. The operator is an O(1) operation, that is, no matrix data is copied. More...
 
GpuMat operator() (IndexArray idx, Range rowRange, Range colRange) const
 Extracts a 2D plane part of an n-dim matrix. It differs from createGpuMatHeader(IndexArray, Range, Range) in that it clones a part of this GpuMatND to the returned GpuMat. More...
 
GpuMatNDoperator= (const GpuMatND &)=default
 
GpuMatNDoperator= (GpuMatND &&) noexcept=default
 
void release ()
 
void swap (GpuMatND &m) noexcept
 
size_t total () const
 returns the total number of array elements More...
 
size_t totalMemSize () const
 returns the size of underlying memory in bytes More...
 
int type () const
 returns element type More...
 
void upload (InputArray src)
 
void upload (InputArray src, Stream &stream)
 

Public Attributes

int dims
 matrix dimensionality More...
 
int flags
 
SizeArray size
 shape of this array More...
 
StepArray step
 

Member Typedef Documentation

◆ IndexArray

using cv::cuda::GpuMatND::IndexArray = std::vector<int>

◆ SizeArray

using cv::cuda::GpuMatND::SizeArray = std::vector<int>

◆ StepArray

using cv::cuda::GpuMatND::StepArray = std::vector<size_t>

Constructor & Destructor Documentation

◆ ~GpuMatND()

cv::cuda::GpuMatND::~GpuMatND ( )

destructor

◆ GpuMatND() [1/5]

cv::cuda::GpuMatND::GpuMatND ( )

default constructor

◆ GpuMatND() [2/5]

cv::cuda::GpuMatND::GpuMatND ( SizeArray  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.

Parameters
sizeArray of integers specifying an n-dimensional array shape.
typeArray type. Use CV_8UC1, ..., CV_16FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.

◆ GpuMatND() [3/5]

cv::cuda::GpuMatND::GpuMatND ( SizeArray  size,
int  type,
void *  data,
StepArray  step = StepArray() 
)

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

Parameters
sizeArray of integers specifying an n-dimensional array shape.
typeArray type. Use CV_8UC1, ..., CV_16FC4 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.
stepArray of _size.size()-1 steps in case of a multi-dimensional array (the last step is always set to the element size). If not specified, the matrix is assumed to be continuous.

◆ GpuMatND() [4/5]

cv::cuda::GpuMatND::GpuMatND ( const GpuMatND )
default

◆ GpuMatND() [5/5]

cv::cuda::GpuMatND::GpuMatND ( GpuMatND &&  )
defaultnoexcept

Member Function Documentation

◆ clone() [1/2]

GpuMatND cv::cuda::GpuMatND::clone ( ) const

Creates a full copy of the array and the underlying data. The method creates a full copy of the array. It mimics the behavior of Mat::clone(), i.e. the original step is not taken into account. So, the array copy is a continuous array occupying total()*elemSize() bytes.

◆ clone() [2/2]

GpuMatND cv::cuda::GpuMatND::clone ( Stream stream) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This overload is non-blocking, so it may return even if the copy operation is not finished.

◆ create()

void cv::cuda::GpuMatND::create ( SizeArray  size,
int  type 
)

Allocates GPU memory. Suppose there is some GPU memory already allocated. In that case, this method may choose to reuse that GPU memory under the specific condition: it must be of the same size and type, not externally allocated, the GPU memory is continuous(i.e., isContinuous() is true), and is not a sub-matrix of another GpuMatND (i.e., isSubmatrix() is false). In other words, this method guarantees that the GPU memory allocated by this method is always continuous and is not a sub-region of another GpuMatND.

◆ createGpuMatHeader() [1/2]

GpuMat cv::cuda::GpuMatND::createGpuMatHeader ( IndexArray  idx,
Range  rowRange,
Range  colRange 
) const

Creates a GpuMat header for a 2D plane part of an n-dim matrix.

Note
The returned GpuMat is constructed with the constructor for user-allocated data. That is, It does not perform reference counting.
This function does not increment this GpuMatND's reference counter.

◆ createGpuMatHeader() [2/2]

GpuMat cv::cuda::GpuMatND::createGpuMatHeader ( ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Creates a GpuMat header if this GpuMatND is effectively 2D.

Note
The returned GpuMat is constructed with the constructor for user-allocated data. That is, It does not perform reference counting.
This function does not increment this GpuMatND's reference counter.

◆ download() [1/2]

void cv::cuda::GpuMatND::download ( OutputArray  dst) const

◆ download() [2/2]

void cv::cuda::GpuMatND::download ( OutputArray  dst,
Stream stream 
) const

◆ elemSize()

size_t cv::cuda::GpuMatND::elemSize ( ) const

returns element size in bytes

◆ elemSize1()

size_t cv::cuda::GpuMatND::elemSize1 ( ) const

returns the size of element channel in bytes

◆ empty()

bool cv::cuda::GpuMatND::empty ( ) const

returns true if data is null

◆ external()

bool cv::cuda::GpuMatND::external ( ) const

returns true if not empty and points to external(user-allocated) gpu memory

◆ getDevicePtr()

uchar* cv::cuda::GpuMatND::getDevicePtr ( ) const

returns pointer to the first byte of the GPU memory

◆ isContinuous()

bool cv::cuda::GpuMatND::isContinuous ( ) const

returns true iff the GpuMatND data is continuous (i.e. when there are no gaps between successive rows)

◆ isSubmatrix()

bool cv::cuda::GpuMatND::isSubmatrix ( ) const

returns true if the matrix is a sub-matrix of another matrix

◆ operator GpuMat()

cv::cuda::GpuMatND::operator GpuMat ( ) const

Extracts a 2D plane part of an n-dim matrix if this GpuMatND is effectively 2D. It differs from createGpuMatHeader() in that it clones a part of this GpuMatND.

Note
This operator does not increment this GpuMatND's reference counter;

◆ operator()() [1/2]

GpuMatND cv::cuda::GpuMatND::operator() ( const std::vector< Range > &  ranges) const

Extracts a sub-matrix. The operator makes a new header for the specified sub-array of *this. The operator is an O(1) operation, that is, no matrix data is copied.

Parameters
rangesArray of selected ranges along each dimension.

◆ operator()() [2/2]

GpuMat cv::cuda::GpuMatND::operator() ( IndexArray  idx,
Range  rowRange,
Range  colRange 
) const

Extracts a 2D plane part of an n-dim matrix. It differs from createGpuMatHeader(IndexArray, Range, Range) in that it clones a part of this GpuMatND to the returned GpuMat.

Note
This operator does not increment this GpuMatND's reference counter;

◆ operator=() [1/2]

GpuMatND& cv::cuda::GpuMatND::operator= ( const GpuMatND )
default

◆ operator=() [2/2]

GpuMatND& cv::cuda::GpuMatND::operator= ( GpuMatND &&  )
defaultnoexcept

◆ release()

void cv::cuda::GpuMatND::release ( )

◆ swap()

void cv::cuda::GpuMatND::swap ( GpuMatND m)
noexcept

◆ total()

size_t cv::cuda::GpuMatND::total ( ) const

returns the total number of array elements

◆ totalMemSize()

size_t cv::cuda::GpuMatND::totalMemSize ( ) const

returns the size of underlying memory in bytes

◆ type()

int cv::cuda::GpuMatND::type ( ) const

returns element type

◆ upload() [1/2]

void cv::cuda::GpuMatND::upload ( InputArray  src)

◆ upload() [2/2]

void cv::cuda::GpuMatND::upload ( InputArray  src,
Stream stream 
)

Member Data Documentation

◆ dims

int cv::cuda::GpuMatND::dims

matrix dimensionality

◆ flags

int cv::cuda::GpuMatND::flags

includes several bit-fields:

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

◆ size

SizeArray cv::cuda::GpuMatND::size

shape of this array

◆ step

StepArray cv::cuda::GpuMatND::step

step values Their semantics is identical to the semantics of step for Mat.


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