|
|
@@ -79,8 +79,7 @@ static PyObject* failmsgp(const char *fmt, ...) |
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-#define OPENCV_3 0
|
|
|
-#if OPENCV_3
|
|
|
+#if CV_MAJOR_VERSION == 3
|
|
|
class NumpyAllocator : public MatAllocator
|
|
|
{
|
|
|
public:
|
|
|
@@ -100,13 +99,13 @@ class NumpyAllocator : public MatAllocator |
|
|
return u;
|
|
|
}
|
|
|
|
|
|
- UMatData* allocate(int dims0, const int* sizes, int type, void* data, size_t* step, int flags) const
|
|
|
+ UMatData* allocate(int dims0, const int* sizes, int type, void* data, size_t* step, int flags, UMatUsageFlags usageFlags=USAGE_DEFAULT) const
|
|
|
{
|
|
|
if( data != 0 )
|
|
|
{
|
|
|
CV_Error(Error::StsAssert, "The data should normally be NULL!");
|
|
|
// probably this is safe to do in such extreme case
|
|
|
- return stdAllocator->allocate(dims0, sizes, type, data, step, flags);
|
|
|
+ return stdAllocator->allocate(dims0, sizes, type, data, step, flags, usageFlags);
|
|
|
}
|
|
|
PyEnsureGIL gil;
|
|
|
|
|
|
@@ -129,9 +128,9 @@ class NumpyAllocator : public MatAllocator |
|
|
return allocate(o, dims0, sizes, type, step);
|
|
|
}
|
|
|
|
|
|
- bool allocate(UMatData* u, int accessFlags) const
|
|
|
+ bool allocate(UMatData* u, int accessFlags, UMatUsageFlags usageFlags=USAGE_DEFAULT) const
|
|
|
{
|
|
|
- return stdAllocator->allocate(u, accessFlags);
|
|
|
+ return stdAllocator->allocate(u, accessFlags, usageFlags);
|
|
|
}
|
|
|
|
|
|
void deallocate(UMatData* u) const
|
|
|
@@ -294,7 +293,7 @@ cv::Mat NDArrayConverter::toMat(const PyObject *o) |
|
|
|
|
|
if( m.data )
|
|
|
{
|
|
|
-#if OPENCV_3
|
|
|
+#if CV_MAJOR_VERSION == 3
|
|
|
m.addref();
|
|
|
Py_INCREF(o);
|
|
|
#else
|
|
|
@@ -317,7 +316,7 @@ cv::Mat NDArrayConverter::toMat(const PyObject *o) |
|
|
|
|
|
PyObject* NDArrayConverter::toNDArray(const cv::Mat& m)
|
|
|
{
|
|
|
-#if OPENCV_3
|
|
|
+#if CV_MAJOR_VERSION == 3
|
|
|
if( !m.data )
|
|
|
Py_RETURN_NONE;
|
|
|
Mat temp, *p = (Mat*)&m;
|
|
|
|
0 comments on commit
4590f74