From cb1c0ab6e0b9e1f64ab60cc8187f73a4588c2d0f Mon Sep 17 00:00:00 2001 From: jamesb Date: Thu, 25 Mar 2010 23:42:41 +0000 Subject: [PATCH] fromarray allowND is a keyword arg git-svn-id: https://code.ros.org/svn/opencv/trunk@2913 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08 --- opencv/interfaces/python/cv.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/opencv/interfaces/python/cv.cpp b/opencv/interfaces/python/cv.cpp index 970a04b9..ba8d41d6 100644 --- a/opencv/interfaces/python/cv.cpp +++ b/opencv/interfaces/python/cv.cpp @@ -2713,13 +2713,14 @@ static PyObject *pycvCreateMatND(PyObject *self, PyObject *args) } #if PYTHON_USE_NUMPY -static PyObject *pycvfromarray(PyObject *self, PyObject *args) +static PyObject *pycvfromarray(PyObject *self, PyObject *args, PyObject *kw) { + const char *keywords[] = { "arr", "allowND", NULL }; PyObject *o; int allowND = 0; - if (!PyArg_ParseTuple(args, "O|i", &o, &allowND)) { + + if (!PyArg_ParseTupleAndKeywords(args, kw, "O|i", (char**)keywords, &o, &allowND)) return NULL; - } return fromarray(o, allowND); } @@ -3003,9 +3004,9 @@ static int cvarr_SetItem(PyObject *o, PyObject *key, PyObject *v) static PyObject *pycvSetData(PyObject *self, PyObject *args) { PyObject *o, *s; - int step = -1; + int step = CV_AUTO_STEP; - if (!PyArg_ParseTuple(args, "OOi", &o, &s, &step)) + if (!PyArg_ParseTuple(args, "OO|i", &o, &s, &step)) return NULL; if (is_iplimage(o)) { iplimage_t *ipl = (iplimage_t*)o; @@ -3756,7 +3757,7 @@ static int zero = 0; static PyMethodDef methods[] = { #if PYTHON_USE_NUMPY - {"fromarray", pycvfromarray, METH_VARARGS, "fromarray(array) -> cvmatnd"}, + {"fromarray", (PyCFunction)pycvfromarray, METH_KEYWORDS, "fromarray(array) -> cvmatnd"}, #endif {"ApproxPoly", (PyCFunction)pycvApproxPoly, METH_KEYWORDS, "ApproxPoly(src_seq, storage, method, parameter=0, parameter2=0) -> None"}, -- 2.39.2