1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Enabled VAS OT in G-API Python interface

This commit is contained in:
Anastasiya Pronina
2023-09-04 17:10:46 +01:00
parent 850ebec135
commit d20727a5be
13 changed files with 176 additions and 58 deletions
+27
View File
@@ -156,6 +156,33 @@ struct PyOpenCV_Converter
}
};
// There is conflict between "uint64_t" and "size_t".
// They are the same type on some 32-bit platforms.
template<typename T>
struct PyOpenCV_Converter
< T, typename std::enable_if< std::is_same<uint64_t, T>::value && !std::is_same<uint64_t, size_t>::value >::type >
{
static inline PyObject* from(const uint64_t& value)
{
return PyLong_FromUnsignedLongLong(value);
}
static inline bool to(PyObject* obj, uint64_t& value, const ArgInfo& info)
{
CV_UNUSED(info);
if(!obj || obj == Py_None)
return true;
if(PyInt_Check(obj))
value = (uint64_t)PyInt_AsUnsignedLongLongMask(obj);
else if(PyLong_Check(obj))
value = (uint64_t)PyLong_AsUnsignedLongLong(obj);
else
return false;
return value != (uint64_t)-1 || !PyErr_Occurred();
}
};
// --- uchar
template<> bool pyopencv_to(PyObject* obj, uchar& value, const ArgInfo& info);
template<> PyObject* pyopencv_from(const uchar& value);