Adding of user-defined type conversions for python bindings inside module directories

Adding of destructor and placement new constructors for classes wrapped with CV_EXPORTS_W_SIMPLE macro
This commit is contained in:
Vitaliy Lyudvichenko
2016-08-06 19:46:17 +03:00
parent 35d0a45df6
commit ab8de8f506
8 changed files with 132 additions and 136 deletions
+22
View File
@@ -0,0 +1,22 @@
template<>
bool pyopencv_to(PyObject *obj, CvTermCriteria& dst, const char *name)
{
(void)name;
if(!obj)
return true;
return PyArg_ParseTuple(obj, "iid", &dst.type, &dst.max_iter, &dst.epsilon) > 0;
}
template<>
bool pyopencv_to(PyObject* obj, CvSlice& r, const char* name)
{
(void)name;
if(!obj || obj == Py_None)
return true;
if(PyObject_Size(obj) == 0)
{
r = CV_WHOLE_SEQ;
return true;
}
return PyArg_ParseTuple(obj, "ii", &r.start_index, &r.end_index) > 0;
}