Merge pull request #18493 from TolyaTalamanov:at/wrap-streaming
[G-API Wrap streaming * Wrap streaming * Fix build * Add comments * Remove comment * Fix comments to review * Add test for python pull overload
This commit is contained in:
committed by
GitHub
parent
06a09d5991
commit
0d3e05f9b3
@@ -3,7 +3,14 @@
|
||||
|
||||
#ifdef HAVE_OPENCV_GAPI
|
||||
|
||||
// NB: Python wrapper replaces :: with _ for classes
|
||||
using gapi_GKernelPackage = cv::gapi::GKernelPackage;
|
||||
using gapi_wip_IStreamSource_Ptr = cv::Ptr<cv::gapi::wip::IStreamSource>;
|
||||
|
||||
// FIXME: Python wrapper generate code without namespace std,
|
||||
// so it cause error: "string wasn't declared"
|
||||
// WA: Create using
|
||||
using std::string;
|
||||
|
||||
template<>
|
||||
bool pyopencv_to(PyObject* obj, std::vector<GCompileArg>& value, const ArgInfo& info)
|
||||
@@ -78,6 +85,18 @@ PyObject* pyopencv_from(const GRunArgs& value)
|
||||
return list;
|
||||
}
|
||||
|
||||
template<>
|
||||
bool pyopencv_to(PyObject* obj, GMetaArgs& value, const ArgInfo& info)
|
||||
{
|
||||
return pyopencv_to_generic_vec(obj, value, info);
|
||||
}
|
||||
|
||||
template<>
|
||||
PyObject* pyopencv_from(const GMetaArgs& value)
|
||||
{
|
||||
return pyopencv_from_generic_vec(value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static PyObject* extract_proto_args(PyObject* py_args, PyObject* kw)
|
||||
{
|
||||
@@ -151,6 +170,19 @@ static PyObject* pyopencv_cv_gin(PyObject* , PyObject* py_args, PyObject* kw)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else if (PyObject_TypeCheck(item,
|
||||
reinterpret_cast<PyTypeObject*>(pyopencv_gapi_wip_IStreamSource_TypePtr)))
|
||||
{
|
||||
cv::gapi::wip::IStreamSource::Ptr source =
|
||||
reinterpret_cast<pyopencv_gapi_wip_IStreamSource_t*>(item)->v;
|
||||
args.emplace_back(source);
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "cv.gin can works only with cv::Mat,"
|
||||
"cv::Scalar, cv::gapi::wip::IStreamSource::Ptr");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return pyopencv_from_generic_vec(args);
|
||||
|
||||
Reference in New Issue
Block a user