44 #ifndef __OPENCV_OCL_MATRIX_OPERATIONS_HPP__
45 #define __OPENCV_OCL_MATRIX_OPERATIONS_HPP__
72 :
a(_a),
b(_b), op(_op) {}
84 inline oclMat::oclMat() :
flags(0),
rows(0),
cols(0),
step(0),
data(0), refcount(0), datastart(0), dataend(0),
offset(0), wholerows(0), wholecols(0) {}
86 inline oclMat::oclMat(
int _rows,
int _cols,
int _type) :
flags(0),
rows(0),
cols(0),
step(0),
data(0), refcount(0), datastart(0), dataend(0),
offset(0), wholerows(0), wholecols(0)
88 if( _rows > 0 && _cols > 0 )
89 create( _rows, _cols, _type );
92 inline oclMat::oclMat(
Size _size,
int _type) :
flags(0),
rows(0),
cols(0),
step(0),
data(0), refcount(0), datastart(0), dataend(0),
offset(0), wholerows(0), wholecols(0)
99 :
flags(0),
rows(0),
cols(0),
step(0),
data(0), refcount(0), datastart(0), dataend(0),
offset(0), wholerows(0), wholecols(0)
101 if(_rows > 0 && _cols > 0)
103 create(_rows, _cols, _type);
109 :
flags(0),
rows(0),
cols(0),
step(0),
data(0), refcount(0), datastart(0), dataend(0),
offset(0), wholerows(0), wholecols(0)
120 refcount(m.refcount), datastart(m.datastart), dataend(m.dataend), clCxt(m.clCxt),
offset(m.
offset), wholerows(m.wholerows), wholecols(m.wholecols)
126 inline oclMat::oclMat(
int _rows,
int _cols,
int _type,
void *_data,
size_t _step)
128 datastart(0), dataend(0),
offset(0), wholerows(0), wholecols(0)
130 cv::Mat m(_rows, _cols, _type, _data, _step);
150 datastart(0), dataend(0),
offset(0), wholerows(0), wholecols(0)
152 cv::Mat m(_size, _type, _data, _step);
213 datastart(m.datastart), dataend(m.dataend), clCxt(m.clCxt),
offset(m.
offset), wholerows(m.wholerows), wholecols(m.wholecols)
226 :
flags(0),
rows(0),
cols(0),
step(0),
data(0), refcount(0), datastart(0), dataend(0) ,
offset(0), wholerows(0), wholecols(0)
275 template <
class T>
inline oclMat::operator DevMem2D_<T>()
const
279 template <
class T>
inline oclMat::operator PtrStep_<T>()
const
281 return PtrStep_<T>(
static_cast< DevMem2D_<T>
>(*this));
287 inline oclMat::operator
Mat()
const
370 CV_DbgAssert(
step > 0 );
394 int row1 = std::max(ofs.
y - dtop, 0), row2 =
std::min(ofs.
y +
rows + dbottom, wholeSize.
height);
395 int col1 = std::max(ofs.
x - dleft, 0), col2 =
std::min(ofs.
x +
cols + dright, wholeSize.
width);
408 return oclMat(*
this, rRange, cRange);
412 return oclMat(*
this, roi);
425 return CV_ELEM_SIZE1(
flags);
429 return CV_MAT_TYPE(
flags);
437 return CV_MAT_DEPTH(
flags);
441 return CV_MAT_CN(
flags);
445 return (CV_MAT_CN(
flags)) == 3 ? 4 : (CV_MAT_CN(
flags));
475 m = m(
Rect(0, 0, cols, rows));
477 m.
create(rows, cols, type);
GLdouble GLdouble GLdouble r
Definition: core.hpp:1950
GLenum GLint GLint y
Definition: core_c.h:613
IplImage CvRect * roi
Definition: legacy.hpp:234
CV_EXPORTS void transpose(const oclMat &src, oclMat &dst)
transposes the matrix
void assignTo(oclMat &m, int type=-1) const
Definition: matrix_operations.hpp:332
Definition: matrix_operations.hpp:60
int type() const
returns element type, similar to CV_MAT_TYPE(cvMat->type)
Definition: matrix_operations.hpp:427
int start
Definition: core.hpp:990
int rows
the number of rows and columns
Definition: ocl.hpp:399
Definition: matrix_operations.hpp:62
Size2i Size
Definition: core.hpp:896
Definition: matrix_operations.hpp:58
int end
Definition: core.hpp:990
oclMat b
Definition: matrix_operations.hpp:77
void create(int rows, int cols, int type)
allocates new oclMatrix data unless the oclMatrix already has specified size and type.
static Range all()
Definition: operations.hpp:2219
The 2D range class.
Definition: core.hpp:979
void convertTo(oclMat &m, int rtype, double alpha=1, double beta=0) const
converts oclMatrix to another datatype with optional scalng. See cvConvertScale.
bool isContinuous() const
returns true if the oclMatrix data is continuous
Definition: matrix_operations.hpp:415
int int int flags
Definition: highgui_c.h:186
int wholerows
Definition: ocl.hpp:419
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: core_c.h:403
_Tp x
Definition: core.hpp:766
const CvMat const CvMat const CvMat CvMat CvMat CvMat CvMat CvSize CvMat CvMat * T
Definition: calib3d.hpp:270
void release()
decreases reference counter;
oclMatExpr()
Definition: matrix_operations.hpp:70
internal::ParamGenerator< T > Range(T start, T end, IncrementT step)
Definition: ts_gtest.h:15869
_Tp height
Definition: core.hpp:883
void int step
Definition: core_c.h:403
void upload(const cv::Mat &m)
pefroms blocking upload data to oclMat.
The 2D size class.
Definition: core.hpp:81
int depth() const
returns element type, similar to CV_MAT_DEPTH(cvMat->type)
Definition: matrix_operations.hpp:435
size_t step
a distance between successive rows in bytes; includes the gap if any
Definition: ocl.hpp:401
oclMat clone() const
returns deep copy of the oclMatrix, i.e. the data is copied
Definition: matrix_operations.hpp:321
void locateROI(Size &wholeSize, Point &ofs) const
locates oclMatrix header within a parent oclMatrix. See below
Definition: matrix_operations.hpp:366
int oclchannels() const
Definition: matrix_operations.hpp:443
int ocltype() const
Definition: matrix_operations.hpp:431
int wholecols
Definition: ocl.hpp:420
oclMat col(int x) const
returns a new oclMatrix header for the specified column
Definition: matrix_operations.hpp:300
uchar * datastart
helper fields used in locateROI and adjustROI
Definition: ocl.hpp:411
Definition: matrix_operations.hpp:59
bool empty() const
returns true if oclMatrix data is NULL
Definition: matrix_operations.hpp:455
int cols
Definition: ocl.hpp:399
_Tp y
Definition: core.hpp:883
GLenum GLsizei GLsizei height
int flags
includes several bit-fields:
Definition: ocl.hpp:397
CV_EXPORTS_W void min(InputArray src1, InputArray src2, OutputArray dst)
computes per-element minimum of two arrays (dst = min(src1, src2))
Size size() const
returns oclMatrix size:
Definition: matrix_operations.hpp:451
Definition: matrix_operations.hpp:64
GLenum GLint x
Definition: core_c.h:632
oclMat rowRange(int startrow, int endrow) const
... for the specified row span
Definition: matrix_operations.hpp:304
_Tp x
Definition: core.hpp:883
Definition: matrix_operations.hpp:61
~oclMat()
destructor - calls release()
Definition: matrix_operations.hpp:232
size_t elemSize() const
returns element size in bytes,
Definition: matrix_operations.hpp:419
uchar * dataend
Definition: ocl.hpp:412
int op
Definition: matrix_operations.hpp:78
oclMat & adjustROI(int dtop, int dbottom, int dleft, int dright)
moves/resizes the current oclMatrix ROI inside the parent oclMatrix.
Definition: matrix_operations.hpp:388
Definition: matrix_operations.hpp:63
GLboolean GLboolean GLboolean b
Definition: legacy.hpp:633
The n-dimensional matrix class.
Definition: core.hpp:1688
int rows
Definition: core_c.h:114
int channels() const
returns element type, similar to CV_MAT_CN(cvMat->type)
Definition: matrix_operations.hpp:439
int cols
Definition: core_c.h:109
GLuint GLuint GLsizei GLenum type
Definition: core_c.h:114
void swap(oclMat &mat)
swaps with other smart pointer
Definition: matrix_operations.hpp:350
Definition: matrix_operations.hpp:67
oclMat colRange(int startcol, int endcol) const
... for the specified column span
Definition: matrix_operations.hpp:312
oclMat row(int y) const
returns a new oclMatrix header for the specified row
Definition: matrix_operations.hpp:296
uchar * data
pointer to the data(OCL memory object)
Definition: ocl.hpp:403
template 2D point class.
Definition: core.hpp:82
oclMat & operator=(const oclMat &m)
assignment operators
Definition: matrix_operations.hpp:237
_Tp width
Definition: core.hpp:840
void assign(oclMat &m) const
oclMatExpr(const oclMat &_a, const oclMat &_b, int _op)
Definition: matrix_operations.hpp:71
oclMat operator()(Range rowRange, Range colRange) const
extracts a rectangular sub-oclMatrix
Definition: matrix_operations.hpp:406
GLboolean GLboolean GLboolean GLboolean a
Definition: legacy.hpp:633
oclMat()
default constructor
Definition: matrix_operations.hpp:84
size_t step1() const
returns step/elemSize1()
Definition: matrix_operations.hpp:447
size_t elemSize1() const
returns the size of element channel in bytes.
Definition: matrix_operations.hpp:423
_Tp y
Definition: core.hpp:766
void ensureSizeIsEnough(int rows, int cols, int type, oclMat &m)
Definition: matrix_operations.hpp:472
::max::max int
Definition: functional.hpp:324
CvPoint2D32f float a
Definition: legacy.hpp:578
CV_EXPORTS void swap(Mat &a, Mat &b)
swaps two matrices
oclMat t() const
matrix transposition
Definition: matrix_operations.hpp:460
_Tp height
Definition: core.hpp:840
Context * clCxt
OpenCL context associated with the oclMat object.
Definition: ocl.hpp:415
int size() const
Definition: operations.hpp:2217
GLsizeiptr size
Definition: core_c.h:939
Rect_< int > Rect
Definition: core.hpp:897
void copyTo(oclMat &m, const oclMat &mask=oclMat()) const
copies those oclMatrix elements to "m" that are marked with non-zero mask elements.
_Tp width
Definition: core.hpp:883
Definition: matrix_operations.hpp:57
int * refcount
pointer to the reference counter;
Definition: ocl.hpp:407
int offset
Definition: ocl.hpp:417