Public Member Functions | Public Attributes
cv::gpu::GpuMat Class Reference

Smart pointer for GPU memory with reference counting. Its interface is mostly similar with cv::Mat. More...

#include <gpu.hpp>

List of all members.

Public Member Functions

 GpuMat ()
 default constructor
 GpuMat (int rows, int cols, int type)
 constructs GpuMatrix of the specified size and type (_type is CV_8UC1, CV_64FC3, CV_32SC(12) etc.)
 GpuMat (Size size, int type)
 GpuMat (int rows, int cols, int type, const Scalar &s)
 constucts GpuMatrix and fills it with the specified value _s.
 GpuMat (Size size, int type, const Scalar &s)
 GpuMat (const GpuMat &m)
 copy constructor
 GpuMat (int rows, int cols, int type, void *data, size_t step=Mat::AUTO_STEP)
 constructor for GpuMatrix headers pointing to user-allocated data
 GpuMat (Size size, int type, void *data, size_t step=Mat::AUTO_STEP)
 GpuMat (const GpuMat &m, const Range &rowRange, const Range &colRange)
 creates a matrix header for a part of the bigger matrix
 GpuMat (const GpuMat &m, const Rect &roi)
 GpuMat (const Mat &m)
 builds GpuMat from Mat. Perfom blocking upload to device.
 ~GpuMat ()
 destructor - calls release()
GpuMatoperator= (const GpuMat &m)
 assignment operators
GpuMatoperator= (const Mat &m)
 assignment operator. Perfom blocking upload to device.
template<class T >
 operator DevMem2D_< T > () const
 returns lightweight DevMem2D_ structure for passing to nvcc-compiled code.
template<class T >
 operator PtrStep_< T > () const
void upload (const cv::Mat &m)
 pefroms blocking upload data to GpuMat.
void upload (const CudaMem &m, Stream &stream)
 upload async
 operator Mat () const
 downloads data from device to host memory. Blocking calls.
void download (cv::Mat &m) const
void download (CudaMem &m, Stream &stream) const
 download async
GpuMat row (int y) const
 returns a new GpuMatrix header for the specified row
GpuMat col (int x) const
 returns a new GpuMatrix header for the specified column
GpuMat rowRange (int startrow, int endrow) const
 ... for the specified row span
GpuMat rowRange (const Range &r) const
GpuMat colRange (int startcol, int endcol) const
 ... for the specified column span
GpuMat colRange (const Range &r) const
GpuMat clone () const
 returns deep copy of the GpuMatrix, i.e. the data is copied
void copyTo (GpuMat &m) const
 copies the GpuMatrix content to "m".
void copyTo (GpuMat &m, const GpuMat &mask) const
 copies those GpuMatrix elements to "m" that are marked with non-zero mask elements.
void convertTo (GpuMat &m, int rtype, double alpha=1, double beta=0) const
 converts GpuMatrix to another datatype with optional scalng. See cvConvertScale.
void assignTo (GpuMat &m, int type=-1) const
GpuMatoperator= (const Scalar &s)
 sets every GpuMatrix element to s
GpuMatsetTo (const Scalar &s, const GpuMat &mask=GpuMat())
 sets some of the GpuMatrix elements to s, according to the mask
GpuMat reshape (int cn, int rows=0) const
 creates alternative GpuMatrix header for the same data, with different
void create (int rows, int cols, int type)
 allocates new GpuMatrix data unless the GpuMatrix already has specified size and type.
void create (Size size, int type)
void release ()
 decreases reference counter;
void swap (GpuMat &mat)
 swaps with other smart pointer
void locateROI (Size &wholeSize, Point &ofs) const
 locates GpuMatrix header within a parent GpuMatrix. See below
GpuMatadjustROI (int dtop, int dbottom, int dleft, int dright)
 moves/resizes the current GpuMatrix ROI inside the parent GpuMatrix.
GpuMat operator() (Range rowRange, Range colRange) const
 extracts a rectangular sub-GpuMatrix
GpuMat operator() (const Rect &roi) const
bool isContinuous () const
 returns true iff the GpuMatrix data is continuous
size_t elemSize () const
 returns element size in bytes,
size_t elemSize1 () const
 returns the size of element channel in bytes.
int type () const
 returns element type, similar to CV_MAT_TYPE(cvMat->type)
int depth () const
 returns element type, similar to CV_MAT_DEPTH(cvMat->type)
int channels () const
 returns element type, similar to CV_MAT_CN(cvMat->type)
size_t step1 () const
 returns step/elemSize1()
Size size () const
 returns GpuMatrix size:
bool empty () const
 returns true if GpuMatrix data is NULL
ucharptr (int y=0)
 returns pointer to y-th row
const ucharptr (int y=0) const
template<typename _Tp >
_Tp * ptr (int y=0)
 template version of the above method
template<typename _Tp >
const _Tp * ptr (int y=0) const
GpuMat t () const
 matrix transposition

Public Attributes

int flags
 includes several bit-fields:
int rows
 the number of rows and columns
int cols
size_t step
 a distance between successive rows in bytes; includes the gap if any
uchardata
 pointer to the data
int * refcount
 pointer to the reference counter;
uchardatastart
 helper fields used in locateROI and adjustROI
uchardataend

Detailed Description

Smart pointer for GPU memory with reference counting. Its interface is mostly similar with cv::Mat.


Constructor & Destructor Documentation

default constructor

cv::gpu::GpuMat::GpuMat ( int  rows,
int  cols,
int  type 
)

constructs GpuMatrix of the specified size and type (_type is CV_8UC1, CV_64FC3, CV_32SC(12) etc.)

cv::gpu::GpuMat::GpuMat ( Size  size,
int  type 
)
cv::gpu::GpuMat::GpuMat ( int  rows,
int  cols,
int  type,
const Scalar s 
)

constucts GpuMatrix and fills it with the specified value _s.

cv::gpu::GpuMat::GpuMat ( Size  size,
int  type,
const Scalar s 
)

copy constructor

cv::gpu::GpuMat::GpuMat ( int  rows,
int  cols,
int  type,
void data,
size_t  step = Mat::AUTO_STEP 
)

constructor for GpuMatrix headers pointing to user-allocated data

cv::gpu::GpuMat::GpuMat ( Size  size,
int  type,
void data,
size_t  step = Mat::AUTO_STEP 
)
cv::gpu::GpuMat::GpuMat ( const GpuMat m,
const Range rowRange,
const Range colRange 
)

creates a matrix header for a part of the bigger matrix

cv::gpu::GpuMat::GpuMat ( const GpuMat m,
const Rect roi 
)
cv::gpu::GpuMat::GpuMat ( const Mat m) [explicit]

builds GpuMat from Mat. Perfom blocking upload to device.

destructor - calls release()


Member Function Documentation

GpuMat & cv::gpu::GpuMat::operator= ( const GpuMat m)

assignment operators

GpuMat & cv::gpu::GpuMat::operator= ( const Mat m)

assignment operator. Perfom blocking upload to device.

template<class T >
cv::gpu::GpuMat::operator DevMem2D_< T > ( ) const

returns lightweight DevMem2D_ structure for passing to nvcc-compiled code.

template<class T >
cv::gpu::GpuMat::operator PtrStep_< T > ( ) const

pefroms blocking upload data to GpuMat.

void cv::gpu::GpuMat::upload ( const CudaMem m,
Stream stream 
)

upload async

cv::gpu::GpuMat::operator Mat ( ) const

downloads data from device to host memory. Blocking calls.

void cv::gpu::GpuMat::download ( CudaMem m,
Stream stream 
) const

download async

GpuMat cv::gpu::GpuMat::row ( int  y) const

returns a new GpuMatrix header for the specified row

GpuMat cv::gpu::GpuMat::col ( int  x) const

returns a new GpuMatrix header for the specified column

GpuMat cv::gpu::GpuMat::rowRange ( int  startrow,
int  endrow 
) const

... for the specified row span

GpuMat cv::gpu::GpuMat::rowRange ( const Range r) const
GpuMat cv::gpu::GpuMat::colRange ( int  startcol,
int  endcol 
) const

... for the specified column span

GpuMat cv::gpu::GpuMat::colRange ( const Range r) const

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

copies the GpuMatrix content to "m".

void cv::gpu::GpuMat::copyTo ( GpuMat m,
const GpuMat mask 
) const

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

void cv::gpu::GpuMat::convertTo ( GpuMat m,
int  rtype,
double  alpha = 1,
double  beta = 0 
) const

converts GpuMatrix to another datatype with optional scalng. See cvConvertScale.

void cv::gpu::GpuMat::assignTo ( GpuMat m,
int  type = -1 
) const
GpuMat& cv::gpu::GpuMat::operator= ( const Scalar s)

sets every GpuMatrix element to s

GpuMat& cv::gpu::GpuMat::setTo ( const Scalar s,
const GpuMat mask = GpuMat() 
)

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

GpuMat cv::gpu::GpuMat::reshape ( int  cn,
int  rows = 0 
) const

creates alternative GpuMatrix header for the same data, with different

void cv::gpu::GpuMat::create ( int  rows,
int  cols,
int  type 
)

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

void cv::gpu::GpuMat::create ( Size  size,
int  type 
)

decreases reference counter;

swaps with other smart pointer

void cv::gpu::GpuMat::locateROI ( Size wholeSize,
Point ofs 
) const

locates GpuMatrix header within a parent GpuMatrix. See below

GpuMat & cv::gpu::GpuMat::adjustROI ( int  dtop,
int  dbottom,
int  dleft,
int  dright 
)

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

GpuMat cv::gpu::GpuMat::operator() ( Range  rowRange,
Range  colRange 
) const

extracts a rectangular sub-GpuMatrix

GpuMat cv::gpu::GpuMat::operator() ( const Rect roi) const

returns true iff the GpuMatrix data is continuous

size_t cv::gpu::GpuMat::elemSize ( ) const

returns element size in bytes,

size_t cv::gpu::GpuMat::elemSize1 ( ) const

returns the size of element channel in bytes.

int cv::gpu::GpuMat::type ( ) const

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

int cv::gpu::GpuMat::depth ( ) const

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

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

size_t cv::gpu::GpuMat::step1 ( ) const

returns step/elemSize1()

returns GpuMatrix size:

bool cv::gpu::GpuMat::empty ( ) const

returns true if GpuMatrix data is NULL

_Tp * cv::gpu::GpuMat::ptr ( int  y = 0)

returns pointer to y-th row

const _Tp * cv::gpu::GpuMat::ptr ( int  y = 0) const
template<typename _Tp >
_Tp* cv::gpu::GpuMat::ptr ( int  y = 0)

template version of the above method

template<typename _Tp >
const _Tp* cv::gpu::GpuMat::ptr ( int  y = 0) const

matrix transposition


Member Data Documentation

includes several bit-fields:

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

the number of rows and columns

a distance between successive rows in bytes; includes the gap if any

pointer to the data

pointer to the reference counter;

helper fields used in locateROI and adjustROI


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