I'm trying to create MEDIANFLOW tracker with OpenCV3.3 using opencv-python with Python3.6. I need to pass some arguments into the constructor according to this page of OpenCV docs.
The problem is I don't know how to pass available arguments into this function correctly? I wasn't able to find any information about it.
What I do (and it works):
tracker = cv2.TrackerMedianFlow_create()
What I want to do:
tracker = cv2.TrackerMedianFlow_create(maxLevel=3)
But it doesn't work and gives me an error:
SystemError: <built-in function TrackerMedianFlow_create> returned NULL without setting an error
Could you help?
I search the intermediate code generated by cmake/make when compiling the OpenCV 3.3 for Python 3.5, just cannot find the methods to set the parameters for cv2.TrackerXXX
.
In modules/python3/pyopencv_generated_funcs.h
, I find this function:
static PyObject* pyopencv_cv_TrackerMedianFlow_create(PyObject* , PyObject* args, PyObject* kw)
{
using namespace cv;
Ptr<TrackerMedianFlow> retval;
if(PyObject_Size(args) == 0 && (kw == NULL || PyObject_Size(kw) == 0))
{
ERRWRAP2(retval = cv::TrackerMedianFlow::create());
return pyopencv_from(retval);
}
return NULL;
}
This is to say, you cann't pass any parameter to cv::TrackerMedianFlow_create()
.
In modules/python3/pyopencv_generated_types.h
, I find this one:
static PyGetSetDef pyopencv_TrackerMedianFlow_getseters[] =
{
{NULL} /* Sentinel */
};
This to say, you have no way to change the parameters for Python wrapper by default, Unless you modified the source code and recompile it.