bindings: backport generator from OpenCV 4.x
- better handling of enum arguments - less merge conflicts
This commit is contained in:
committed by
Alexander Alekhin
parent
d034ef6f27
commit
f5b58e5fc9
+127
-288
@@ -11,6 +11,20 @@
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
template<typename T, class TEnable = void> // TEnable is used for SFINAE checks
|
||||
struct PyOpenCV_Converter
|
||||
{
|
||||
//static inline bool to(PyObject* obj, T& p, const char* name);
|
||||
//static inline PyObject* from(const T& src);
|
||||
};
|
||||
|
||||
template<typename T> static
|
||||
bool pyopencv_to(PyObject* obj, T& p, const char* name = "<unknown>") { return PyOpenCV_Converter<T>::to(obj, p, name); }
|
||||
|
||||
template<typename T> static
|
||||
PyObject* pyopencv_from(const T& src) { return PyOpenCV_Converter<T>::from(src); }
|
||||
|
||||
|
||||
#define CV_PY_FN_WITH_KW_(fn, flags) (PyCFunction)(void*)(PyCFunctionWithKeywords)(fn), (flags) | METH_VARARGS | METH_KEYWORDS
|
||||
#define CV_PY_FN_NOARGS_(fn, flags) (PyCFunction)(fn), (flags) | METH_NOARGS
|
||||
|
||||
@@ -28,6 +42,68 @@
|
||||
# define CV_PYTHON_TYPE_HEAD_INIT() PyObject_HEAD_INIT(&PyType_Type) 0,
|
||||
#endif
|
||||
|
||||
#define CV_PY_TO_CLASS(TYPE) \
|
||||
template<> \
|
||||
bool pyopencv_to(PyObject* dst, TYPE& src, const char* name) \
|
||||
{ \
|
||||
if (!dst || dst == Py_None) \
|
||||
return true; \
|
||||
Ptr<TYPE> ptr; \
|
||||
\
|
||||
if (!pyopencv_to(dst, ptr, name)) return false; \
|
||||
src = *ptr; \
|
||||
return true; \
|
||||
}
|
||||
|
||||
#define CV_PY_FROM_CLASS(TYPE) \
|
||||
template<> \
|
||||
PyObject* pyopencv_from(const TYPE& src) \
|
||||
{ \
|
||||
Ptr<TYPE> ptr(new TYPE()); \
|
||||
\
|
||||
*ptr = src; \
|
||||
return pyopencv_from(ptr); \
|
||||
}
|
||||
|
||||
#define CV_PY_TO_CLASS_PTR(TYPE) \
|
||||
template<> \
|
||||
bool pyopencv_to(PyObject* dst, TYPE*& src, const char* name) \
|
||||
{ \
|
||||
if (!dst || dst == Py_None) \
|
||||
return true; \
|
||||
Ptr<TYPE> ptr; \
|
||||
\
|
||||
if (!pyopencv_to(dst, ptr, name)) return false; \
|
||||
src = ptr; \
|
||||
return true; \
|
||||
}
|
||||
|
||||
#define CV_PY_FROM_CLASS_PTR(TYPE) \
|
||||
static PyObject* pyopencv_from(TYPE*& src) \
|
||||
{ \
|
||||
return pyopencv_from(Ptr<TYPE>(src)); \
|
||||
}
|
||||
|
||||
#define CV_PY_TO_ENUM(TYPE) \
|
||||
template<> \
|
||||
bool pyopencv_to(PyObject* dst, TYPE& src, const char* name) \
|
||||
{ \
|
||||
if (!dst || dst == Py_None) \
|
||||
return true; \
|
||||
int underlying = 0; \
|
||||
\
|
||||
if (!pyopencv_to(dst, underlying, name)) return false; \
|
||||
src = static_cast<TYPE>(underlying); \
|
||||
return true; \
|
||||
}
|
||||
|
||||
#define CV_PY_FROM_ENUM(TYPE) \
|
||||
template<> \
|
||||
PyObject* pyopencv_from(const TYPE& src) \
|
||||
{ \
|
||||
return pyopencv_from(static_cast<int>(src)); \
|
||||
}
|
||||
|
||||
#include "pyopencv_generated_include.h"
|
||||
#include "opencv2/core/types_c.h"
|
||||
|
||||
@@ -37,7 +113,7 @@
|
||||
|
||||
#include <map>
|
||||
|
||||
static PyObject* opencv_error = 0;
|
||||
static PyObject* opencv_error = NULL;
|
||||
|
||||
static int failmsg(const char *fmt, ...)
|
||||
{
|
||||
@@ -98,6 +174,12 @@ try \
|
||||
} \
|
||||
catch (const cv::Exception &e) \
|
||||
{ \
|
||||
PyObject_SetAttrString(opencv_error, "file", PyString_FromString(e.file.c_str())); \
|
||||
PyObject_SetAttrString(opencv_error, "func", PyString_FromString(e.func.c_str())); \
|
||||
PyObject_SetAttrString(opencv_error, "line", PyInt_FromLong(e.line)); \
|
||||
PyObject_SetAttrString(opencv_error, "code", PyInt_FromLong(e.code)); \
|
||||
PyObject_SetAttrString(opencv_error, "msg", PyString_FromString(e.msg.c_str())); \
|
||||
PyObject_SetAttrString(opencv_error, "err", PyString_FromString(e.err.c_str())); \
|
||||
PyErr_SetString(opencv_error, e.what()); \
|
||||
return 0; \
|
||||
}
|
||||
@@ -113,6 +195,7 @@ typedef std::vector<size_t> vector_size_t;
|
||||
typedef std::vector<Point> vector_Point;
|
||||
typedef std::vector<Point2f> vector_Point2f;
|
||||
typedef std::vector<Point3f> vector_Point3f;
|
||||
typedef std::vector<Size> vector_Size;
|
||||
typedef std::vector<Vec2f> vector_Vec2f;
|
||||
typedef std::vector<Vec3f> vector_Vec3f;
|
||||
typedef std::vector<Vec4f> vector_Vec4f;
|
||||
@@ -223,12 +306,6 @@ public:
|
||||
NumpyAllocator g_numpyAllocator;
|
||||
|
||||
|
||||
template<typename T> static
|
||||
bool pyopencv_to(PyObject* obj, T& p, const char* name = "<unknown>");
|
||||
|
||||
template<typename T> static
|
||||
PyObject* pyopencv_from(const T& src);
|
||||
|
||||
enum { ARG_NONE = 0, ARG_MAT = 1, ARG_SCALAR = 2 };
|
||||
|
||||
// special case, when the converter needs full ArgInfo structure
|
||||
@@ -435,15 +512,6 @@ bool pyopencv_to(PyObject* o, Matx<_Tp, m, n>& mx, const char* name)
|
||||
return pyopencv_to(o, mx, ArgInfo(name, 0));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool pyopencv_to(PyObject *o, Ptr<T>& p, const char *name)
|
||||
{
|
||||
if (!o || o == Py_None)
|
||||
return true;
|
||||
p = makePtr<T>();
|
||||
return pyopencv_to(o, *p, name);
|
||||
}
|
||||
|
||||
template<>
|
||||
PyObject* pyopencv_from(const Mat& m)
|
||||
{
|
||||
@@ -468,279 +536,39 @@ PyObject* pyopencv_from(const Matx<_Tp, m, n>& matx)
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
PyObject* pyopencv_from(const cv::Ptr<T>& p)
|
||||
struct PyOpenCV_Converter< cv::Ptr<T> >
|
||||
{
|
||||
if (!p)
|
||||
Py_RETURN_NONE;
|
||||
return pyopencv_from(*p);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
UMat* um;
|
||||
} cv2_UMatWrapperObject;
|
||||
|
||||
static bool PyObject_IsUMat(PyObject *o);
|
||||
|
||||
// UMatWrapper init - try to map arguments from python to UMat constructors
|
||||
static int UMatWrapper_init(PyObject* self_, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
cv2_UMatWrapperObject* self = (cv2_UMatWrapperObject*)self_;
|
||||
if (self == NULL)
|
||||
static PyObject* from(const cv::Ptr<T>& p)
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "Internal error");
|
||||
return -1;
|
||||
if (!p)
|
||||
Py_RETURN_NONE;
|
||||
return pyopencv_from(*p);
|
||||
}
|
||||
self->um = NULL;
|
||||
static bool to(PyObject *o, Ptr<T>& p, const char *name)
|
||||
{
|
||||
// constructor ()
|
||||
const char *kwlist[] = {NULL};
|
||||
if (PyArg_ParseTupleAndKeywords(args, kwds, "", (char**) kwlist)) {
|
||||
self->um = new UMat();
|
||||
return 0;
|
||||
}
|
||||
PyErr_Clear();
|
||||
if (!o || o == Py_None)
|
||||
return true;
|
||||
p = makePtr<T>();
|
||||
return pyopencv_to(o, *p, name);
|
||||
}
|
||||
{
|
||||
// constructor (rows, cols, type)
|
||||
const char *kwlist[] = {"rows", "cols", "type", NULL};
|
||||
int rows, cols, type;
|
||||
if (PyArg_ParseTupleAndKeywords(args, kwds, "iii", (char**) kwlist, &rows, &cols, &type)) {
|
||||
self->um = new UMat(rows, cols, type);
|
||||
return 0;
|
||||
}
|
||||
PyErr_Clear();
|
||||
}
|
||||
{
|
||||
// constructor (m, rowRange, colRange)
|
||||
const char *kwlist[] = {"m", "rowRange", "colRange", NULL};
|
||||
PyObject *obj = NULL;
|
||||
int y0 = -1, y1 = -1, x0 = -1, x1 = -1;
|
||||
if (PyArg_ParseTupleAndKeywords(args, kwds, "O(ii)|(ii)", (char**) kwlist, &obj, &y0, &y1, &x0, &x1) && PyObject_IsUMat(obj)) {
|
||||
UMat *um_other = ((cv2_UMatWrapperObject *) obj)->um;
|
||||
Range rowRange(y0, y1);
|
||||
Range colRange = (x0 >= 0 && x1 >= 0) ? Range(x0, x1) : Range::all();
|
||||
self->um = new UMat(*um_other, rowRange, colRange);
|
||||
return 0;
|
||||
}
|
||||
PyErr_Clear();
|
||||
}
|
||||
{
|
||||
// constructor (m)
|
||||
const char *kwlist[] = {"m", NULL};
|
||||
PyObject *obj = NULL;
|
||||
if (PyArg_ParseTupleAndKeywords(args, kwds, "O", (char**) kwlist, &obj)) {
|
||||
// constructor (UMat m)
|
||||
if (PyObject_IsUMat(obj)) {
|
||||
UMat *um_other = ((cv2_UMatWrapperObject *) obj)->um;
|
||||
self->um = new UMat(*um_other);
|
||||
return 0;
|
||||
}
|
||||
// python specific constructor from array like object
|
||||
Mat m;
|
||||
if (pyopencv_to(obj, m, ArgInfo("UMatWrapper.np_mat", 0))) {
|
||||
self->um = new UMat();
|
||||
m.copyTo(*self->um);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
PyErr_Clear();
|
||||
}
|
||||
PyErr_SetString(PyExc_TypeError, "no matching UMat constructor found/supported");
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void UMatWrapper_dealloc(cv2_UMatWrapperObject* self)
|
||||
{
|
||||
if (self->um)
|
||||
delete self->um;
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
#else
|
||||
self->ob_type->tp_free((PyObject*)self);
|
||||
#endif
|
||||
}
|
||||
|
||||
// UMatWrapper.get() - returns numpy array by transferring UMat data to Mat and than wrapping it to numpy array
|
||||
// (using numpy allocator - and so without unnecessary copy)
|
||||
static PyObject * UMatWrapper_get(PyObject* self_, PyObject * /*args*/)
|
||||
{
|
||||
cv2_UMatWrapperObject* self = (cv2_UMatWrapperObject*)self_;
|
||||
if (self == NULL)
|
||||
return failmsgp("Incorrect type of self (must be 'cv2_UMatWrapperObject')");
|
||||
Mat m;
|
||||
m.allocator = &g_numpyAllocator;
|
||||
self->um->copyTo(m);
|
||||
|
||||
return pyopencv_from(m);
|
||||
}
|
||||
|
||||
// UMatWrapper.handle() - returns the OpenCL handle of the UMat object
|
||||
static PyObject * UMatWrapper_handle(PyObject* self_, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
cv2_UMatWrapperObject* self = (cv2_UMatWrapperObject*)self_;
|
||||
if (self == NULL)
|
||||
return failmsgp("Incorrect type of self (must be 'cv2_UMatWrapperObject')");
|
||||
const char *kwlist[] = {"accessFlags", NULL};
|
||||
int accessFlags;
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char**) kwlist, &accessFlags))
|
||||
return 0;
|
||||
return PyLong_FromVoidPtr(self->um->handle(accessFlags));
|
||||
}
|
||||
|
||||
// UMatWrapper.isContinuous() - returns true if the matrix data is continuous
|
||||
static PyObject * UMatWrapper_isContinuous(PyObject* self_, PyObject * /*args*/)
|
||||
{
|
||||
cv2_UMatWrapperObject* self = (cv2_UMatWrapperObject*)self_;
|
||||
if (self == NULL)
|
||||
return failmsgp("Incorrect type of self (must be 'cv2_UMatWrapperObject')");
|
||||
return PyBool_FromLong(self->um->isContinuous());
|
||||
}
|
||||
|
||||
// UMatWrapper.isContinuous() - returns true if the matrix is a submatrix of another matrix
|
||||
static PyObject * UMatWrapper_isSubmatrix(PyObject* self_, PyObject * /*args*/)
|
||||
{
|
||||
cv2_UMatWrapperObject* self = (cv2_UMatWrapperObject*)self_;
|
||||
if (self == NULL)
|
||||
return failmsgp("Incorrect type of self (must be 'cv2_UMatWrapperObject')");
|
||||
return PyBool_FromLong(self->um->isSubmatrix());
|
||||
}
|
||||
|
||||
// UMatWrapper.context() - returns the OpenCL context used by OpenCV UMat
|
||||
static PyObject * UMatWrapper_context(PyObject* /*self_*/, PyObject * /*args*/)
|
||||
{
|
||||
return PyLong_FromVoidPtr(cv::ocl::Context::getDefault().ptr());
|
||||
}
|
||||
|
||||
// UMatWrapper.context() - returns the OpenCL queue used by OpenCV UMat
|
||||
static PyObject * UMatWrapper_queue(PyObject* /*self_*/, PyObject * /*args*/)
|
||||
{
|
||||
return PyLong_FromVoidPtr(cv::ocl::Queue::getDefault().ptr());
|
||||
}
|
||||
|
||||
static PyObject * UMatWrapper_offset_getter(PyObject* self_, void*)
|
||||
{
|
||||
cv2_UMatWrapperObject* self = (cv2_UMatWrapperObject*)self_;
|
||||
if (self == NULL)
|
||||
return failmsgp("Incorrect type of self (must be 'cv2_UMatWrapperObject')");
|
||||
return PyLong_FromSsize_t(self->um->offset);
|
||||
}
|
||||
|
||||
static PyMethodDef UMatWrapper_methods[] = {
|
||||
{"get", CV_PY_FN_NOARGS(UMatWrapper_get),
|
||||
"Returns numpy array"
|
||||
},
|
||||
{"handle", CV_PY_FN_WITH_KW(UMatWrapper_handle),
|
||||
"Returns UMat native handle"
|
||||
},
|
||||
{"isContinuous", CV_PY_FN_NOARGS(UMatWrapper_isContinuous),
|
||||
"Returns true if the matrix data is continuous"
|
||||
},
|
||||
{"isSubmatrix", CV_PY_FN_NOARGS(UMatWrapper_isSubmatrix),
|
||||
"Returns true if the matrix is a submatrix of another matrix"
|
||||
},
|
||||
{"context", CV_PY_FN_NOARGS_(UMatWrapper_context, METH_STATIC),
|
||||
"Returns OpenCL context handle"
|
||||
},
|
||||
{"queue", CV_PY_FN_NOARGS_(UMatWrapper_queue, METH_STATIC),
|
||||
"Returns OpenCL queue handle"
|
||||
},
|
||||
{NULL, NULL, 0, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
static PyGetSetDef UMatWrapper_getset[] = {
|
||||
{(char*) "offset", (getter) UMatWrapper_offset_getter, NULL, NULL, NULL},
|
||||
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
static PyTypeObject cv2_UMatWrapperType = {
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
#else
|
||||
PyObject_HEAD_INIT(NULL)
|
||||
0, /*ob_size*/
|
||||
#endif
|
||||
"cv2.UMat", /* tp_name */
|
||||
sizeof(cv2_UMatWrapperObject), /* tp_basicsize */
|
||||
0, /* tp_itemsize */
|
||||
(destructor)UMatWrapper_dealloc, /* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_reserved */
|
||||
0, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
0, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT, /* tp_flags */
|
||||
"OpenCV 3 UMat wrapper. Used for T-API support.", /* tp_doc */
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
UMatWrapper_methods, /* tp_methods */
|
||||
0, /* tp_members */
|
||||
UMatWrapper_getset, /* tp_getset */
|
||||
0, /* tp_base */
|
||||
0, /* tp_dict */
|
||||
0, /* tp_descr_get */
|
||||
0, /* tp_descr_set */
|
||||
0, /* tp_dictoffset */
|
||||
(initproc)UMatWrapper_init, /* tp_init */
|
||||
0, /* tp_alloc */
|
||||
PyType_GenericNew, /* tp_new */
|
||||
0, /* tp_free */
|
||||
0, /* tp_is_gc */
|
||||
0, /* tp_bases */
|
||||
0, /* tp_mro */
|
||||
0, /* tp_cache */
|
||||
0, /* tp_subclasses */
|
||||
0, /* tp_weaklist */
|
||||
0, /* tp_del */
|
||||
0, /* tp_version_tag */
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
0, /* tp_finalize */
|
||||
#endif
|
||||
};
|
||||
|
||||
static bool PyObject_IsUMat(PyObject *o) {
|
||||
return (o != NULL) && PyObject_TypeCheck(o, &cv2_UMatWrapperType);
|
||||
}
|
||||
|
||||
static bool pyopencv_to(PyObject* o, UMat& um, const ArgInfo info) {
|
||||
if (PyObject_IsUMat(o)) {
|
||||
um = *((cv2_UMatWrapperObject *) o)->um;
|
||||
template<>
|
||||
bool pyopencv_to(PyObject* obj, void*& ptr, const char* name)
|
||||
{
|
||||
CV_UNUSED(name);
|
||||
if (!obj || obj == Py_None)
|
||||
return true;
|
||||
}
|
||||
|
||||
Mat m;
|
||||
if (!pyopencv_to(o, m, info)) {
|
||||
if (!PyLong_Check(obj))
|
||||
return false;
|
||||
}
|
||||
|
||||
m.copyTo(um);
|
||||
return true;
|
||||
ptr = PyLong_AsVoidPtr(obj);
|
||||
return ptr != NULL && !PyErr_Occurred();
|
||||
}
|
||||
|
||||
template<>
|
||||
bool pyopencv_to(PyObject* o, UMat& um, const char* name)
|
||||
static PyObject* pyopencv_from(void*& ptr)
|
||||
{
|
||||
return pyopencv_to(o, um, ArgInfo(name, 0));
|
||||
}
|
||||
|
||||
template<>
|
||||
PyObject* pyopencv_from(const UMat& m) {
|
||||
PyObject *o = PyObject_CallObject((PyObject *) &cv2_UMatWrapperType, NULL);
|
||||
*((cv2_UMatWrapperObject *) o)->um = m;
|
||||
return o;
|
||||
return PyLong_FromVoidPtr(ptr);
|
||||
}
|
||||
|
||||
static bool pyopencv_to(PyObject *o, Scalar& s, const ArgInfo info)
|
||||
@@ -1483,6 +1311,19 @@ template<> struct pyopencvVecConverter<Mat>
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct pyopencvVecConverter<UMat>
|
||||
{
|
||||
static bool to(PyObject* obj, std::vector<UMat>& value, const ArgInfo info)
|
||||
{
|
||||
return pyopencv_to_generic_vec(obj, value, info);
|
||||
}
|
||||
|
||||
static PyObject* from(const std::vector<UMat>& value)
|
||||
{
|
||||
return pyopencv_from_generic_vec(value);
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct pyopencvVecConverter<KeyPoint>
|
||||
{
|
||||
static bool to(PyObject* obj, std::vector<KeyPoint>& value, const ArgInfo info)
|
||||
@@ -1814,6 +1655,7 @@ static int convert_to_char(PyObject *o, char *dst, const char *name = "no_name")
|
||||
# pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
#endif
|
||||
|
||||
#include "pyopencv_generated_enums.h"
|
||||
#include "pyopencv_custom_headers.h"
|
||||
#include "pyopencv_generated_types.h"
|
||||
#include "pyopencv_generated_funcs.h"
|
||||
@@ -1927,18 +1769,17 @@ void initcv2()
|
||||
|
||||
PyDict_SetItemString(d, "__version__", PyString_FromString(CV_VERSION));
|
||||
|
||||
opencv_error = PyErr_NewException((char*)MODULESTR".error", NULL, NULL);
|
||||
PyObject *opencv_error_dict = PyDict_New();
|
||||
PyDict_SetItemString(opencv_error_dict, "file", Py_None);
|
||||
PyDict_SetItemString(opencv_error_dict, "func", Py_None);
|
||||
PyDict_SetItemString(opencv_error_dict, "line", Py_None);
|
||||
PyDict_SetItemString(opencv_error_dict, "code", Py_None);
|
||||
PyDict_SetItemString(opencv_error_dict, "msg", Py_None);
|
||||
PyDict_SetItemString(opencv_error_dict, "err", Py_None);
|
||||
opencv_error = PyErr_NewException((char*)MODULESTR".error", NULL, opencv_error_dict);
|
||||
Py_DECREF(opencv_error_dict);
|
||||
PyDict_SetItemString(d, "error", opencv_error);
|
||||
|
||||
//Registering UMatWrapper python class in cv2 module:
|
||||
if (PyType_Ready(&cv2_UMatWrapperType) < 0)
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
return NULL;
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
#define PUBLISH_OBJECT(name, type) Py_INCREF(&type);\
|
||||
PyModule_AddObject(m, name, (PyObject *)&type);
|
||||
@@ -1949,8 +1790,6 @@ void initcv2()
|
||||
PyModule_AddObject(m, name, (PyObject *)&type);
|
||||
#endif
|
||||
|
||||
PUBLISH_OBJECT("UMat", cv2_UMatWrapperType);
|
||||
|
||||
#include "pyopencv_generated_type_publish.h"
|
||||
|
||||
#define PUBLISH(I) PyDict_SetItemString(d, #I, PyInt_FromLong(I))
|
||||
|
||||
Reference in New Issue
Block a user