mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
Wraps smart pointers properly
This commit is contained in:
parent
e4377e7c51
commit
c75b589f89
@ -1271,9 +1271,17 @@ PyObject* pyopencv_from(const Moments& m)
|
||||
"nu30", m.nu30, "nu21", m.nu21, "nu12", m.nu12, "nu03", m.nu03);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
PyObject* pyopencv_from(const cv::Ptr<T>& p)
|
||||
{
|
||||
if (!p) return Py_None;
|
||||
return pyopencv_from(*p);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user