44 #ifndef OPENCV_CORE_CUDAINL_HPP
45 #define OPENCV_CORE_CUDAINL_HPP
47 #include "opencv2/core/cuda.hpp"
51 namespace cv {
namespace cuda {
59 :
flags(0),
rows(0),
cols(0),
step(0),
data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_)
63 GpuMat::GpuMat(
int rows_,
int cols_,
int type_, Allocator* allocator_)
64 :
flags(0),
rows(0),
cols(0),
step(0),
data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_)
66 if (rows_ > 0 && cols_ > 0)
67 create(rows_, cols_, type_);
71 GpuMat::GpuMat(
Size size_,
int type_, Allocator* allocator_)
72 :
flags(0),
rows(0),
cols(0),
step(0),
data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_)
74 if (size_.height > 0 && size_.width > 0)
75 create(size_.height, size_.width, type_);
79 #if defined _MSC_VER && _MSC_VER >= 1920
81 #pragma warning(disable: 4702)
84 GpuMat::GpuMat(
int rows_,
int cols_,
int type_,
Scalar s_, Allocator* allocator_)
85 :
flags(0),
rows(0),
cols(0),
step(0),
data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_)
87 if (rows_ > 0 && cols_ > 0)
89 create(rows_, cols_, type_);
95 GpuMat::GpuMat(
Size size_,
int type_,
Scalar s_, Allocator* allocator_)
96 :
flags(0),
rows(0),
cols(0),
step(0),
data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_)
98 if (size_.height > 0 && size_.width > 0)
100 create(size_.height, size_.width, type_);
104 #if defined _MSC_VER && _MSC_VER >= 1920
109 GpuMat::GpuMat(
const GpuMat& m)
113 CV_XADD(refcount, 1);
118 flags(0),
rows(0),
cols(0),
step(0),
data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_)
130 GpuMat& GpuMat::operator =(
const GpuMat& m)
142 void GpuMat::create(
Size size_,
int type_)
144 create(size_.height, size_.width, type_);
162 GpuMat GpuMat::clone()
const
170 #if defined _MSC_VER && _MSC_VER >= 1920
171 #pragma warning(push)
172 #pragma warning(disable: 4702)
179 #if defined _MSC_VER && _MSC_VER >= 1920
184 GpuMat& GpuMat::setTo(
Scalar s)
186 return setTo(s, Stream::Null());
192 return setTo(s,
mask, Stream::Null());
196 #if defined _MSC_VER && _MSC_VER >= 1920
197 #pragma warning(push)
198 #pragma warning(disable: 4702)
203 convertTo(
dst, rtype, Stream::Null());
211 #if defined _MSC_VER && _MSC_VER >= 1920
218 convertTo(
dst, rtype,
alpha, 0.0, stream);
222 void GpuMat::assignTo(GpuMat& m,
int _type)
const
238 const uchar* GpuMat::ptr(
int y)
const
244 template<
typename _Tp>
inline
245 _Tp* GpuMat::ptr(
int y)
250 template<
typename _Tp>
inline
251 const _Tp* GpuMat::ptr(
int y)
const
253 return (
const _Tp*)ptr(
y);
256 template <
class T>
inline
257 GpuMat::operator PtrStepSz<T>()
const
262 template <
class T>
inline
263 GpuMat::operator PtrStep<T>()
const
269 GpuMat GpuMat::row(
int y)
const
271 return GpuMat(*
this, Range(
y,
y+1), Range::all());
275 GpuMat GpuMat::col(
int x)
const
277 return GpuMat(*
this, Range::all(), Range(
x,
x+1));
281 GpuMat GpuMat::rowRange(
int startrow,
int endrow)
const
283 return GpuMat(*
this, Range(startrow, endrow), Range::all());
287 GpuMat GpuMat::rowRange(Range
r)
const
289 return GpuMat(*
this,
r, Range::all());
293 GpuMat GpuMat::colRange(
int startcol,
int endcol)
const
295 return GpuMat(*
this, Range::all(), Range(startcol, endcol));
299 GpuMat GpuMat::colRange(Range
r)
const
301 return GpuMat(*
this, Range::all(),
r);
305 GpuMat GpuMat::operator ()(Range rowRange_, Range colRange_)
const
307 return GpuMat(*
this, rowRange_, colRange_);
311 GpuMat GpuMat::operator ()(
Rect roi)
const
313 return GpuMat(*
this, roi);
317 bool GpuMat::isContinuous()
const
319 return (
flags & Mat::CONTINUOUS_FLAG) != 0;
323 size_t GpuMat::elemSize()
const
329 size_t GpuMat::elemSize1()
const
353 size_t GpuMat::step1()
const
355 return step / elemSize1();
365 bool GpuMat::empty()
const
371 void* GpuMat::cudaPtr()
const
405 void swap(GpuMat& a, GpuMat& b)
415 GpuMatND::GpuMatND() :
421 GpuMatND::GpuMatND(SizeArray _size,
int _type) :
434 bool GpuMatND::isContinuous()
const
436 return (
flags & Mat::CONTINUOUS_FLAG) != 0;
440 bool GpuMatND::isSubmatrix()
const
442 return (
flags & Mat::SUBMATRIX_FLAG) != 0;
446 size_t GpuMatND::elemSize()
const
452 size_t GpuMatND::elemSize1()
const
458 bool GpuMatND::empty()
const
460 return data ==
nullptr;
464 bool GpuMatND::external()
const
466 return !empty() && data_.use_count() == 0;
470 uchar* GpuMatND::getDevicePtr()
const
485 size_t GpuMatND::totalMemSize()
const
501 HostMem::HostMem(AllocType alloc_type_)
502 :
flags(0),
rows(0),
cols(0),
step(0),
data(0), refcount(0), datastart(0), dataend(0), alloc_type(alloc_type_)
507 HostMem::HostMem(
const HostMem& m)
511 CV_XADD(refcount, 1);
515 HostMem::HostMem(
int rows_,
int cols_,
int type_, AllocType alloc_type_)
516 :
flags(0),
rows(0),
cols(0),
step(0),
data(0), refcount(0), datastart(0), dataend(0), alloc_type(alloc_type_)
518 if (rows_ > 0 && cols_ > 0)
519 create(rows_, cols_, type_);
523 HostMem::HostMem(
Size size_,
int type_, AllocType alloc_type_)
524 :
flags(0),
rows(0),
cols(0),
step(0),
data(0), refcount(0), datastart(0), dataend(0), alloc_type(alloc_type_)
526 if (size_.height > 0 && size_.width > 0)
527 create(size_.height, size_.width, type_);
532 :
flags(0),
rows(0),
cols(0),
step(0),
data(0), refcount(0), datastart(0), dataend(0), alloc_type(alloc_type_)
534 arr.getMat().copyTo(*
this);
544 HostMem& HostMem::operator =(
const HostMem& m)
570 HostMem HostMem::clone()
const
572 HostMem m(
size(),
type(), alloc_type);
573 createMatHeader().copyTo(m);
578 void HostMem::create(
Size size_,
int type_)
580 create(size_.height, size_.width, type_);
584 Mat HostMem::createMatHeader()
const
590 bool HostMem::isContinuous()
const
592 return (
flags & Mat::CONTINUOUS_FLAG) != 0;
596 size_t HostMem::elemSize()
const
602 size_t HostMem::elemSize1()
const
626 size_t HostMem::step1()
const
628 return step / elemSize1();
638 bool HostMem::empty()
const
644 void swap(HostMem& a, HostMem& b)
654 Stream::Stream(
const Ptr<Impl>& impl)
664 Event::Event(
const Ptr<Impl>& impl)
674 #if defined _MSC_VER && _MSC_VER >= 1920
675 #pragma warning(push)
676 #pragma warning(disable: 4702)
679 bool TargetArchs::has(
int major,
int minor)
681 return hasPtx(major, minor) || hasBin(major, minor);
685 bool TargetArchs::hasEqualOrGreater(
int major,
int minor)
687 return hasEqualOrGreaterPtx(major, minor) || hasEqualOrGreaterBin(major, minor);
691 DeviceInfo::DeviceInfo()
695 #if defined _MSC_VER && _MSC_VER >= 1920
700 DeviceInfo::DeviceInfo(
int device_id)
703 device_id_ = device_id;
707 #if defined _MSC_VER && _MSC_VER >= 1920
708 #pragma warning(push)
709 #pragma warning(disable: 4702)
712 int DeviceInfo::deviceID()
const
718 size_t DeviceInfo::freeMemory()
const
720 size_t _totalMemory = 0, _freeMemory = 0;
721 queryMemory(_totalMemory, _freeMemory);
726 size_t DeviceInfo::totalMemory()
const
728 size_t _totalMemory = 0, _freeMemory = 0;
729 queryMemory(_totalMemory, _freeMemory);
734 bool DeviceInfo::supports(
FeatureSet feature_set)
const
736 int version = majorVersion() * 10 + minorVersion();
737 return version >= feature_set;
739 #if defined _MSC_VER && _MSC_VER >= 1920
754 :
flags(0),
dims(0),
rows(0),
cols(0),
data(0), datastart(0), dataend(0), datalimit(0), allocator(0), u(0),
size(&
rows)
CV_WRAP GpuMat(GpuMat::Allocator *allocator=GpuMat::defaultAllocator())
default constructor
InputArrayOfArrays InputArrayOfArrays InputOutputArray InputOutputArray InputOutputArray InputOutputArray Size InputOutputArray InputOutputArray T
Definition: calib3d.hpp:1867
InputArrayOfArrays Size InputOutputArray InputOutputArray OutputArrayOfArrays OutputArrayOfArrays OutputArray OutputArray OutputArray int flags
Definition: calib3d.hpp:1617
void CV_EXPORTS_W copyTo(InputArray src, OutputArray dst, InputArray mask)
This is an overloaded member function, provided for convenience (python) Copies the matrix to another...
Rect2i Rect
Definition: types.hpp:489
Size2i Size
Definition: types.hpp:370
Scalar_< double > Scalar
Definition: types.hpp:702
const _OutputArray & OutputArray
Definition: mat.hpp:444
CV__DEBUG_NS_END typedef const _InputArray & InputArray
Definition: mat.hpp:442
int rows
Definition: core_c.h:257
int int void int total
Definition: core_c.h:1689
const CvArr const CvArr const CvArr CvArr int flags
Definition: core_c.h:1342
int int channels
Definition: core_c.h:100
CvArr * dst
Definition: core_c.h:875
int cols
Definition: core_c.h:221
double const CvArr double beta
Definition: core_c.h:1094
CvSize size
Definition: core_c.h:112
int int type
Definition: core_c.h:221
void int step
Definition: core_c.h:905
CvArr const CvArr * mask
Definition: core_c.h:589
CvArr * arr
Definition: core_c.h:1247
int depth
Definition: core_c.h:100
void * data
Definition: core_c.h:427
const CvArr CvArr * x
Definition: core_c.h:1195
double alpha
Definition: core_c.h:1093
int dims
Definition: core_c.h:464
const CvArr * y
Definition: core_c.h:1187
#define CV_MAT_DEPTH(flags)
Definition: interface.h:83
unsigned char uchar
Definition: interface.h:51
#define CV_ELEM_SIZE1(type)
Definition: cvdef.h:508
#define CV_MAT_CN(flags)
Definition: cvdef.h:495
#define CV_MAT_TYPE(flags)
Definition: cvdef.h:497
#define CV_Assert(expr)
Checks a condition at runtime and throws exception if it fails.
Definition: base.hpp:342
#define CV_DbgAssert(expr)
Definition: base.hpp:375
#define CV_ELEM_SIZE(type)
Definition: cvdef.h:510
CV_EXPORTS void swap(Mat &a, Mat &b)
Swaps two matrices.
FeatureSet
Enumeration providing CUDA computing features.
Definition: cuda.hpp:1056
CV_EXPORTS_W int getDevice()
Returns the current device index set by cuda::setDevice or initialized by default.
CV_EXPORTS_W int getCudaEnabledDeviceCount()
Returns the number of installed CUDA-enabled devices.
CV_EXPORTS_W void createContinuous(int rows, int cols, int type, OutputArray arr)
Creates a continuous matrix.
CV_EXPORTS_W void ensureSizeIsEnough(int rows, int cols, int type, OutputArray arr)
Ensures that the size of a matrix is big enough and the matrix has a proper type.
CvRect r
Definition: imgproc_c.h:984
CvArr CvPoint offset
Definition: imgproc_c.h:88
CvArr CvArr * temp
Definition: imgproc_c.h:329
"black box" representation of the file storage associated with a file on disk.
Definition: calib3d.hpp:441
int width
Definition: types_c.h:1159
int height
Definition: types_c.h:1160