virtual int kind() const;
virtual int dims(int i=-1) const;
+ virtual int cols(int i=-1) const;
+ virtual int rows(int i=-1) const;
virtual Size size(int i=-1) const;
virtual int sizend(int* sz, int i=-1) const;
virtual bool sameSize(const _InputArray& arr) const;
bool isUMat() const;
bool isMatVector() const;
bool isUMatVector() const;
- bool isMatx();
+ bool isMatx() const;
virtual ~_InputArray();
/////////////////////////////////// MatAllocator //////////////////////////////////////
+//! Usage flags for allocator
+enum UMatUsageFlags
+{
+ USAGE_DEFAULT = 0,
+
+ // default allocation policy is platform and usage specific
+ USAGE_ALLOCATE_HOST_MEMORY = 1 << 0,
+ USAGE_ALLOCATE_DEVICE_MEMORY = 1 << 1,
+
+ __UMAT_USAGE_FLAGS_32BIT = 0x7fffffff // Binary compatibility hint
+};
+
struct CV_EXPORTS UMatData;
/*!
// uchar*& datastart, uchar*& data, size_t* step) = 0;
//virtual void deallocate(int* refcount, uchar* datastart, uchar* data) = 0;
virtual UMatData* allocate(int dims, const int* sizes, int type,
- void* data, size_t* step, int flags) const = 0;
- virtual bool allocate(UMatData* data, int accessflags) const = 0;
+ void* data, size_t* step, int flags, UMatUsageFlags usageFlags) const = 0;
+ virtual bool allocate(UMatData* data, int accessflags, UMatUsageFlags usageFlags) const = 0;
virtual void deallocate(UMatData* data) const = 0;
virtual void map(UMatData* data, int accessflags) const;
virtual void unmap(UMatData* data) const;
int flags;
void* handle;
void* userdata;
+ int allocatorFlags_;
};
Mat& operator = (const MatExpr& expr);
//! retrieve UMat from Mat
- UMat getUMat(int accessFlags) const;
+ UMat getUMat(int accessFlags, UMatUsageFlags usageFlags = USAGE_DEFAULT) const;
//! returns a new matrix header for the specified row
Mat row(int y) const;
{
public:
//! default constructor
- UMat();
+ UMat(UMatUsageFlags usageFlags = USAGE_DEFAULT);
//! constructs 2D matrix of the specified size and type
// (_type is CV_8UC1, CV_64FC3, CV_32SC(12) etc.)
- UMat(int rows, int cols, int type);
- UMat(Size size, int type);
+ UMat(int rows, int cols, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+ UMat(Size size, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
//! constucts 2D matrix and fills it with the specified value _s.
- UMat(int rows, int cols, int type, const Scalar& s);
- UMat(Size size, int type, const Scalar& s);
+ UMat(int rows, int cols, int type, const Scalar& s, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+ UMat(Size size, int type, const Scalar& s, UMatUsageFlags usageFlags = USAGE_DEFAULT);
//! constructs n-dimensional matrix
- UMat(int ndims, const int* sizes, int type);
- UMat(int ndims, const int* sizes, int type, const Scalar& s);
+ UMat(int ndims, const int* sizes, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+ UMat(int ndims, const int* sizes, int type, const Scalar& s, UMatUsageFlags usageFlags = USAGE_DEFAULT);
//! copy constructor
UMat(const UMat& m);
//! allocates new matrix data unless the matrix already has specified size and type.
// previous data is unreferenced if needed.
- void create(int rows, int cols, int type);
- void create(Size size, int type);
- void create(int ndims, const int* sizes, int type);
+ void create(int rows, int cols, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+ void create(Size size, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+ void create(int ndims, const int* sizes, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
//! increases the reference counter; use with care to avoid memleaks
void addref();
//! custom allocator
MatAllocator* allocator;
+ UMatUsageFlags usageFlags; // usage flags for allocator
//! and the standard allocator
static MatAllocator* getStdAllocator();