OpenCV  2.4.13.4
Open Source Computer Vision
cv::gpu::GpuMat Class Reference

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

#include <gpumat.hpp>

Public Member Functions

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

Public Attributes

int flags
 
int rows
 the number of rows and columns More...
 
int cols
 
size_t step
 a distance between successive rows in bytes; includes the gap if any More...
 
uchardata
 pointer to the data More...
 
intrefcount
 pointer to the reference counter; More...
 
uchardatastart
 helper fields used in locateROI and adjustROI More...
 
uchardataend
 

Detailed Description

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

Constructor & Destructor Documentation

§ GpuMat() [1/11]

cv::gpu::GpuMat::GpuMat ( )
inline

default constructor

§ GpuMat() [2/11]

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

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

§ GpuMat() [3/11]

cv::gpu::GpuMat::GpuMat ( Size  size,
int  type 
)
inline

§ GpuMat() [4/11]

cv::gpu::GpuMat::GpuMat ( int  rows,
int  cols,
int  type,
Scalar  s 
)
inline

constucts GpuMatrix and fills it with the specified value _s.

§ GpuMat() [5/11]

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

§ GpuMat() [6/11]

cv::gpu::GpuMat::GpuMat ( const GpuMat m)

copy constructor

§ GpuMat() [7/11]

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

§ GpuMat() [8/11]

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

§ GpuMat() [9/11]

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

creates a matrix header for a part of the bigger matrix

§ GpuMat() [10/11]

cv::gpu::GpuMat::GpuMat ( const GpuMat m,
Rect  roi 
)

§ GpuMat() [11/11]

cv::gpu::GpuMat::GpuMat ( const Mat m)
explicit

builds GpuMat from Mat. Perfom blocking upload to device.

§ ~GpuMat()

cv::gpu::GpuMat::~GpuMat ( )
inline

destructor - calls release()

Member Function Documentation

§ adjustROI()

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

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

§ assignTo()

void cv::gpu::GpuMat::assignTo ( GpuMat m,
int  type = -1 
) const
inline

§ channels()

int cv::gpu::GpuMat::channels ( ) const
inline

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

§ clone()

GpuMat cv::gpu::GpuMat::clone ( ) const
inline

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

§ col()

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

returns a new GpuMatrix header for the specified column

§ colRange() [1/2]

GpuMat cv::gpu::GpuMat::colRange ( int  startcol,
int  endcol 
) const
inline

... for the specified column span

§ colRange() [2/2]

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

§ convertTo()

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.

§ copyTo() [1/2]

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

copies the GpuMatrix content to "m".

§ copyTo() [2/2]

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.

§ create() [1/2]

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

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

§ create() [2/2]

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

§ depth()

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

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

§ download()

void cv::gpu::GpuMat::download ( Mat m) const

downloads data from device to host memory. Blocking calls.

§ elemSize()

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

returns element size in bytes,

§ elemSize1()

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

returns the size of element channel in bytes.

§ empty()

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

returns true if GpuMatrix data is NULL

§ isContinuous()

bool cv::gpu::GpuMat::isContinuous ( ) const
inline

returns true iff the GpuMatrix data is continuous

§ locateROI()

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

locates GpuMatrix header within a parent GpuMatrix. See below

§ operator DevMem2D_< _Tp >()

template<typename _Tp >
CV_GPU_DEPRECATED cv::gpu::GpuMat::operator DevMem2D_< _Tp > ( ) const

§ operator PtrStep< _Tp >()

template<typename _Tp >
cv::gpu::GpuMat::operator PtrStep< _Tp > ( ) const

§ operator PtrStep_< _Tp >()

template<typename _Tp >
CV_GPU_DEPRECATED cv::gpu::GpuMat::operator PtrStep_< _Tp > ( ) const

§ operator PtrStepSz< _Tp >()

template<typename _Tp >
cv::gpu::GpuMat::operator PtrStepSz< _Tp > ( ) const

§ operator()() [1/2]

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

extracts a rectangular sub-GpuMatrix

§ operator()() [2/2]

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

§ operator=() [1/2]

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

assignment operators

§ operator=() [2/2]

GpuMat & cv::gpu::GpuMat::operator= ( Scalar  s)
inline

sets every GpuMatrix element to s

§ ptr() [1/4]

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

returns pointer to y-th row

§ ptr() [2/4]

const uchar * cv::gpu::GpuMat::ptr ( int  y = 0) const
inline

§ ptr() [3/4]

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

template version of the above method

§ ptr() [4/4]

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

§ release()

void cv::gpu::GpuMat::release ( )

decreases reference counter;

§ reshape()

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

creates alternative GpuMatrix header for the same data, with different

§ row()

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

returns a new GpuMatrix header for the specified row

§ rowRange() [1/2]

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

... for the specified row span

§ rowRange() [2/2]

GpuMat cv::gpu::GpuMat::rowRange ( Range  r) const
inline

§ setTo()

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

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

§ size()

Size cv::gpu::GpuMat::size ( ) const
inline

returns GpuMatrix size:

§ step1()

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

returns step/elemSize1()

§ swap()

void cv::gpu::GpuMat::swap ( GpuMat mat)

swaps with other smart pointer

§ type()

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

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

§ upload()

void cv::gpu::GpuMat::upload ( const Mat m)

pefroms blocking upload data to GpuMat.

Member Data Documentation

§ cols

int cv::gpu::GpuMat::cols

§ data

uchar* cv::gpu::GpuMat::data

pointer to the data

§ dataend

uchar* cv::gpu::GpuMat::dataend

§ datastart

uchar* cv::gpu::GpuMat::datastart

helper fields used in locateROI and adjustROI

§ flags

int cv::gpu::GpuMat::flags

includes several bit-fields:

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

§ refcount

int* cv::gpu::GpuMat::refcount

pointer to the reference counter;

§ rows

int cv::gpu::GpuMat::rows

the number of rows and columns

§ step

size_t cv::gpu::GpuMat::step

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


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