OpenCV
4.0.0-pre
Open Source Computer Vision
|
Looking for a C++ dev who knows OpenCV?
I'm looking for work. Hire me! |
Base storage class for GPU memory with reference counting. More...
#include "cuda.hpp"
Classes | |
class | Allocator |
Public Member Functions | |
GpuMat (GpuMat::Allocator *allocator=GpuMat::defaultAllocator()) | |
default constructor More... | |
GpuMat (int rows, int cols, int type, GpuMat::Allocator *allocator=GpuMat::defaultAllocator()) | |
constructs GpuMat of the specified size and type More... | |
GpuMat (Size size, int type, GpuMat::Allocator *allocator=GpuMat::defaultAllocator()) | |
GpuMat (int rows, int cols, int type, Scalar s, GpuMat::Allocator *allocator=GpuMat::defaultAllocator()) | |
constucts GpuMat and fills it with the specified value _s More... | |
GpuMat (Size size, int type, Scalar s, GpuMat::Allocator *allocator=GpuMat::defaultAllocator()) | |
GpuMat (const GpuMat &m) | |
copy constructor More... | |
GpuMat (int rows, int cols, int type, void *data, size_t step=Mat::AUTO_STEP) | |
constructor for GpuMat headers pointing to user-allocated data More... | |
GpuMat (Size size, int type, void *data, size_t step=Mat::AUTO_STEP) | |
GpuMat (const GpuMat &m, Range rowRange, Range colRange) | |
creates a GpuMat header for a part of the bigger matrix More... | |
GpuMat (const GpuMat &m, Rect roi) | |
GpuMat (InputArray arr, GpuMat::Allocator *allocator=GpuMat::defaultAllocator()) | |
builds GpuMat from host memory (Blocking call) More... | |
~GpuMat () | |
destructor - calls release() More... | |
GpuMat & | adjustROI (int dtop, int dbottom, int dleft, int dright) |
moves/resizes the current GpuMat ROI inside the parent GpuMat More... | |
void | assignTo (GpuMat &m, int type=-1) const |
int | channels () const |
returns number of channels More... | |
GpuMat | clone () const |
returns deep copy of the GpuMat, i.e. the data is copied More... | |
GpuMat | col (int x) const |
returns a new GpuMat header for the specified column More... | |
GpuMat | colRange (int startcol, int endcol) const |
... for the specified column span More... | |
GpuMat | colRange (Range r) const |
void | convertTo (OutputArray dst, int rtype) const |
converts GpuMat to another datatype (Blocking call) More... | |
void | convertTo (OutputArray dst, int rtype, Stream &stream) const |
converts GpuMat to another datatype (Non-Blocking call) More... | |
void | convertTo (OutputArray dst, int rtype, double alpha, double beta=0.0) const |
converts GpuMat to another datatype with scaling (Blocking call) More... | |
void | convertTo (OutputArray dst, int rtype, double alpha, Stream &stream) const |
converts GpuMat to another datatype with scaling (Non-Blocking call) More... | |
void | convertTo (OutputArray dst, int rtype, double alpha, double beta, Stream &stream) const |
converts GpuMat to another datatype with scaling (Non-Blocking call) More... | |
void | copyTo (OutputArray dst) const |
copies the GpuMat content to device memory (Blocking call) More... | |
void | copyTo (OutputArray dst, Stream &stream) const |
copies the GpuMat content to device memory (Non-Blocking call) More... | |
void | copyTo (OutputArray dst, InputArray mask) const |
copies those GpuMat elements to "m" that are marked with non-zero mask elements (Blocking call) More... | |
void | copyTo (OutputArray dst, InputArray mask, Stream &stream) const |
copies those GpuMat elements to "m" that are marked with non-zero mask elements (Non-Blocking call) More... | |
void | create (int rows, int cols, int type) |
allocates new GpuMat data unless the GpuMat already has specified size and type More... | |
void | create (Size size, int type) |
int | depth () const |
returns element type More... | |
void | download (OutputArray dst) const |
Performs data download from GpuMat (Blocking call) More... | |
void | download (OutputArray dst, Stream &stream) const |
Performs data download from GpuMat (Non-Blocking call) 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 GpuMat data is NULL More... | |
bool | isContinuous () const |
returns true iff the GpuMat data is continuous (i.e. More... | |
void | locateROI (Size &wholeSize, Point &ofs) const |
locates GpuMat header within a parent GpuMat More... | |
template<typename _Tp > | |
operator PtrStep< _Tp > () const | |
template<typename _Tp > | |
operator PtrStepSz< _Tp > () const | |
GpuMat | operator() (Range rowRange, Range colRange) const |
extracts a rectangular sub-GpuMat (this is a generalized form of row, rowRange etc.) More... | |
GpuMat | operator() (Rect roi) const |
GpuMat & | operator= (const GpuMat &m) |
assignment operators More... | |
uchar * | ptr (int y=0) |
returns pointer to y-th row More... | |
const uchar * | ptr (int y=0) const |
template<typename _Tp > | |
_Tp * | ptr (int y=0) |
template version of the above method More... | |
template<typename _Tp > | |
const _Tp * | ptr (int y=0) const |
void | release () |
decreases reference counter, deallocate the data when reference counter reaches 0 More... | |
GpuMat | reshape (int cn, int rows=0) const |
creates alternative GpuMat header for the same data, with different number of channels and/or different number of rows More... | |
GpuMat | row (int y) const |
returns a new GpuMat header for the specified row More... | |
GpuMat | rowRange (int startrow, int endrow) const |
... for the specified row span More... | |
GpuMat | rowRange (Range r) const |
GpuMat & | setTo (Scalar s) |
sets some of the GpuMat elements to s (Blocking call) More... | |
GpuMat & | setTo (Scalar s, Stream &stream) |
sets some of the GpuMat elements to s (Non-Blocking call) More... | |
GpuMat & | setTo (Scalar s, InputArray mask) |
sets some of the GpuMat elements to s, according to the mask (Blocking call) More... | |
GpuMat & | setTo (Scalar s, InputArray mask, Stream &stream) |
sets some of the GpuMat elements to s, according to the mask (Non-Blocking call) More... | |
Size | size () const |
returns GpuMat size : width == number of columns, height == number of rows More... | |
size_t | step1 () const |
returns step/elemSize1() More... | |
void | swap (GpuMat &mat) |
swaps with other smart pointer More... | |
int | type () const |
returns element type More... | |
void | updateContinuityFlag () |
internal use method: updates the continuity flag More... | |
void | upload (InputArray arr) |
Performs data upload to GpuMat (Blocking call) More... | |
void | upload (InputArray arr, Stream &stream) |
Performs data upload to GpuMat (Non-Blocking call) More... | |
Static Public Member Functions | |
static GpuMat::Allocator * | defaultAllocator () |
default allocator More... | |
static void | setDefaultAllocator (GpuMat::Allocator *allocator) |
Public Attributes | |
Allocator * | allocator |
allocator More... | |
int | cols |
uchar * | data |
pointer to the data More... | |
const uchar * | dataend |
uchar * | datastart |
helper fields used in locateROI and adjustROI More... | |
int | flags |
includes several bit-fields: More... | |
int * | refcount |
pointer to the reference counter; when GpuMat points to user-allocated data, the pointer is NULL More... | |
int | rows |
the number of rows and columns More... | |
size_t | step |
a distance between successive rows in bytes; includes the gap if any More... | |
Base storage class for GPU memory with reference counting.
Its interface matches the Mat interface with the following limitations:
Beware that the latter limitation may lead to overloaded matrix operators that cause memory allocations. The GpuMat class is convertible to cuda::PtrStepSz and cuda::PtrStep so it can be passed directly to the kernel.
Some member functions are described as a "Blocking Call" while some are described as a "Non-Blocking Call". Blocking functions are synchronous to host. It is guaranteed that the GPU operation is finished when the function returns. However, non-blocking functions are asynchronous to host. Those functions may return even if the GPU operation is not finished.
Compared to their blocking counterpart, non-blocking functions accept Stream as an additional argument. If a non-default stream is passed, the GPU operation may overlap with operations in other streams.
|
explicit |
default constructor
cv::cuda::GpuMat::GpuMat | ( | int | rows, |
int | cols, | ||
int | type, | ||
GpuMat::Allocator * | allocator = GpuMat::defaultAllocator() |
||
) |
constructs GpuMat of the specified size and type
cv::cuda::GpuMat::GpuMat | ( | Size | size, |
int | type, | ||
GpuMat::Allocator * | allocator = GpuMat::defaultAllocator() |
||
) |
cv::cuda::GpuMat::GpuMat | ( | int | rows, |
int | cols, | ||
int | type, | ||
Scalar | s, | ||
GpuMat::Allocator * | allocator = GpuMat::defaultAllocator() |
||
) |
constucts GpuMat and fills it with the specified value _s
cv::cuda::GpuMat::GpuMat | ( | Size | size, |
int | type, | ||
Scalar | s, | ||
GpuMat::Allocator * | allocator = GpuMat::defaultAllocator() |
||
) |
cv::cuda::GpuMat::GpuMat | ( | const GpuMat & | m | ) |
copy constructor
cv::cuda::GpuMat::GpuMat | ( | int | rows, |
int | cols, | ||
int | type, | ||
void * | data, | ||
size_t | step = Mat::AUTO_STEP |
||
) |
constructor for GpuMat headers pointing to user-allocated data
cv::cuda::GpuMat::GpuMat | ( | Size | size, |
int | type, | ||
void * | data, | ||
size_t | step = Mat::AUTO_STEP |
||
) |
creates a GpuMat header for a part of the bigger matrix
|
explicit |
builds GpuMat from host memory (Blocking call)
cv::cuda::GpuMat::~GpuMat | ( | ) |
destructor - calls release()
GpuMat& cv::cuda::GpuMat::adjustROI | ( | int | dtop, |
int | dbottom, | ||
int | dleft, | ||
int | dright | ||
) |
void cv::cuda::GpuMat::assignTo | ( | GpuMat & | m, |
int | type = -1 |
||
) | const |
int cv::cuda::GpuMat::channels | ( | ) | const |
returns number of channels
GpuMat cv::cuda::GpuMat::colRange | ( | int | startcol, |
int | endcol | ||
) | const |
... for the specified column span
void cv::cuda::GpuMat::convertTo | ( | OutputArray | dst, |
int | rtype | ||
) | const |
converts GpuMat to another datatype (Blocking call)
void cv::cuda::GpuMat::convertTo | ( | OutputArray | dst, |
int | rtype, | ||
Stream & | stream | ||
) | const |
converts GpuMat to another datatype (Non-Blocking call)
void cv::cuda::GpuMat::convertTo | ( | OutputArray | dst, |
int | rtype, | ||
double | alpha, | ||
double | beta = 0.0 |
||
) | const |
converts GpuMat to another datatype with scaling (Blocking call)
void cv::cuda::GpuMat::convertTo | ( | OutputArray | dst, |
int | rtype, | ||
double | alpha, | ||
Stream & | stream | ||
) | const |
converts GpuMat to another datatype with scaling (Non-Blocking call)
void cv::cuda::GpuMat::convertTo | ( | OutputArray | dst, |
int | rtype, | ||
double | alpha, | ||
double | beta, | ||
Stream & | stream | ||
) | const |
converts GpuMat to another datatype with scaling (Non-Blocking call)
void cv::cuda::GpuMat::copyTo | ( | OutputArray | dst | ) | const |
copies the GpuMat content to device memory (Blocking call)
void cv::cuda::GpuMat::copyTo | ( | OutputArray | dst, |
Stream & | stream | ||
) | const |
copies the GpuMat content to device memory (Non-Blocking call)
void cv::cuda::GpuMat::copyTo | ( | OutputArray | dst, |
InputArray | mask | ||
) | const |
copies those GpuMat elements to "m" that are marked with non-zero mask elements (Blocking call)
void cv::cuda::GpuMat::copyTo | ( | OutputArray | dst, |
InputArray | mask, | ||
Stream & | stream | ||
) | const |
copies those GpuMat elements to "m" that are marked with non-zero mask elements (Non-Blocking call)
void cv::cuda::GpuMat::create | ( | int | rows, |
int | cols, | ||
int | type | ||
) |
void cv::cuda::GpuMat::create | ( | Size | size, |
int | type | ||
) |
|
static |
default allocator
Referenced by cv::cuda::GpuMat::Allocator::~Allocator().
int cv::cuda::GpuMat::depth | ( | ) | const |
returns element type
void cv::cuda::GpuMat::download | ( | OutputArray | dst | ) | const |
Performs data download from GpuMat (Blocking call)
This function copies data from device memory to host memory. As being a blocking call, it is guaranteed that the copy operation is finished when this function returns.
void cv::cuda::GpuMat::download | ( | OutputArray | dst, |
Stream & | stream | ||
) | const |
Performs data download from GpuMat (Non-Blocking call)
This function copies data from device memory to host memory. As being a non-blocking call, this function may return even if the copy operation is not finished.
The copy operation may be overlapped with operations in other non-default streams if stream
is not the default stream and dst
is HostMem allocated with HostMem::PAGE_LOCKED option.
size_t cv::cuda::GpuMat::elemSize | ( | ) | const |
returns element size in bytes
size_t cv::cuda::GpuMat::elemSize1 | ( | ) | const |
returns the size of element channel in bytes
bool cv::cuda::GpuMat::empty | ( | ) | const |
returns true if GpuMat data is NULL
bool cv::cuda::GpuMat::isContinuous | ( | ) | const |
returns true iff the GpuMat data is continuous (i.e.
when there are no gaps between successive rows)
cv::cuda::GpuMat::operator PtrStep< _Tp > | ( | ) | const |
cv::cuda::GpuMat::operator PtrStepSz< _Tp > | ( | ) | const |
extracts a rectangular sub-GpuMat (this is a generalized form of row, rowRange etc.)
uchar* cv::cuda::GpuMat::ptr | ( | int | y = 0 | ) |
returns pointer to y-th row
const uchar* cv::cuda::GpuMat::ptr | ( | int | y = 0 | ) | const |
_Tp* cv::cuda::GpuMat::ptr | ( | int | y = 0 | ) |
template version of the above method
const _Tp* cv::cuda::GpuMat::ptr | ( | int | y = 0 | ) | const |
void cv::cuda::GpuMat::release | ( | ) |
decreases reference counter, deallocate the data when reference counter reaches 0
GpuMat cv::cuda::GpuMat::reshape | ( | int | cn, |
int | rows = 0 |
||
) | const |
creates alternative GpuMat header for the same data, with different number of channels and/or different number of rows
GpuMat cv::cuda::GpuMat::rowRange | ( | int | startrow, |
int | endrow | ||
) | const |
... for the specified row span
|
static |
sets some of the GpuMat elements to s (Non-Blocking call)
GpuMat& cv::cuda::GpuMat::setTo | ( | Scalar | s, |
InputArray | mask | ||
) |
sets some of the GpuMat elements to s, according to the mask (Blocking call)
GpuMat& cv::cuda::GpuMat::setTo | ( | Scalar | s, |
InputArray | mask, | ||
Stream & | stream | ||
) |
sets some of the GpuMat elements to s, according to the mask (Non-Blocking call)
Size cv::cuda::GpuMat::size | ( | ) | const |
returns GpuMat size : width == number of columns, height == number of rows
size_t cv::cuda::GpuMat::step1 | ( | ) | const |
returns step/elemSize1()
void cv::cuda::GpuMat::swap | ( | GpuMat & | mat | ) |
swaps with other smart pointer
int cv::cuda::GpuMat::type | ( | ) | const |
returns element type
void cv::cuda::GpuMat::updateContinuityFlag | ( | ) |
internal use method: updates the continuity flag
void cv::cuda::GpuMat::upload | ( | InputArray | arr | ) |
Performs data upload to GpuMat (Blocking call)
This function copies data from host memory to device memory. As being a blocking call, it is guaranteed that the copy operation is finished when this function returns.
void cv::cuda::GpuMat::upload | ( | InputArray | arr, |
Stream & | stream | ||
) |
Performs data upload to GpuMat (Non-Blocking call)
This function copies data from host memory to device memory. As being a non-blocking call, this function may return even if the copy operation is not finished.
The copy operation may be overlapped with operations in other non-default streams if stream
is not the default stream and dst
is HostMem allocated with HostMem::PAGE_LOCKED option.
Allocator* cv::cuda::GpuMat::allocator |
allocator
int cv::cuda::GpuMat::cols |
uchar* cv::cuda::GpuMat::data |
pointer to the data
const uchar* cv::cuda::GpuMat::dataend |
uchar* cv::cuda::GpuMat::datastart |
helper fields used in locateROI and adjustROI
int cv::cuda::GpuMat::flags |
includes several bit-fields:
int* cv::cuda::GpuMat::refcount |
pointer to the reference counter; when GpuMat points to user-allocated data, the pointer is NULL
int cv::cuda::GpuMat::rows |
the number of rows and columns
size_t cv::cuda::GpuMat::step |
a distance between successive rows in bytes; includes the gap if any