>>> import cv2
>>> help(cv2.findContours)
Help on built-in function findContours in module cv2:
findContours(...)
findContours(image, mode, method[, contours[, hierarchy[, offset]]]) -> contours, hierarchy
as you may have guessed, C ++ β python wrapper code is generated from C ++ headers, look at modules / python / src / gen2.py.
generated code, for example. for findContours looks like this (pyopencv_generated_funcs.h):
static PyObject* pyopencv_findContours(PyObject* , PyObject* args, PyObject* kw)
{
PyObject* pyobj_image = NULL;
Mat image;
PyObject* pyobj_contours = NULL;
vector_Mat contours;
PyObject* pyobj_hierarchy = NULL;
Mat hierarchy;
int mode=0;
int method=0;
PyObject* pyobj_offset = NULL;
Point offset;
const char* keywords[] = { "image", "mode", "method", "contours", "hierarchy", "offset", NULL };
if( PyArg_ParseTupleAndKeywords(args, kw, "Oii|OOO:findContours", (char**)keywords, &pyobj_image, &mode, &method, &pyobj_contours, &pyobj_hierarchy, &pyobj_offset) &&
pyopencv_to(pyobj_image, image, ArgInfo("image", 1)) &&
pyopencv_to(pyobj_contours, contours, ArgInfo("contours", 1)) &&
pyopencv_to(pyobj_hierarchy, hierarchy, ArgInfo("hierarchy", 1)) &&
pyopencv_to(pyobj_offset, offset, ArgInfo("offset", 0)) )
{
ERRWRAP2( cv::findContours(image, contours, hierarchy, mode, method, offset));
return Py_BuildValue("(NN)", pyopencv_from(contours), pyopencv_from(hierarchy));
}
return NULL;
}