mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 07:13:02 +04:00
Merge branch 4.x
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#define PyInt_CheckExact PyLong_CheckExact
|
||||
#define PyInt_AsLong PyLong_AsLong
|
||||
#define PyInt_AS_LONG PyLong_AS_LONG
|
||||
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
|
||||
#define PyInt_FromLong PyLong_FromLong
|
||||
#define PyNumber_Int PyNumber_Long
|
||||
|
||||
|
||||
Reference in New Issue
Block a user