diff --git a/modules/python/src2/cv2.cv.hpp b/modules/python/src2/cv2.cv.hpp index 03a09f3588..cdd698f5a7 100644 --- a/modules/python/src2/cv2.cv.hpp +++ b/modules/python/src2/cv2.cv.hpp @@ -1600,15 +1600,15 @@ static int convert_to_CvMat(PyObject *o, CvMat **dst, const char *name) Py_ssize_t buffer_len; if (!is_cvmat(o)) { -#if !PYTHON_USE_NUMPY - return failmsg("Argument '%s' must be CvMat", name); -#else +//#if !PYTHON_USE_NUMPY + return failmsg("Argument '%s' must be CvMat. Use fromarray() to convert numpy arrays to CvMat", name); +/*#else PyObject *asmat = fromarray(o, 0); if (asmat == NULL) return failmsg("Argument '%s' must be CvMat", name); // now have the array obect as a cvmat, can use regular conversion return convert_to_CvMat(asmat, dst, name); -#endif +#endif*/ } else { m->a->refcount = NULL; if (m->data && PyString_Check(m->data)) { @@ -1666,15 +1666,15 @@ static int convert_to_CvArr(PyObject *o, CvArr **dst, const char *name) } else if (is_cvmatnd(o)) { return convert_to_CvMatND(o, (CvMatND**)dst, name); } else { -#if !PYTHON_USE_NUMPY - return failmsg("CvArr argument '%s' must be IplImage, CvMat or CvMatND", name); -#else +//#if !PYTHON_USE_NUMPY + return failmsg("CvArr argument '%s' must be IplImage, CvMat or CvMatND. Use fromarray() to convert numpy arrays to CvMat or cvMatND", name); +/*#else PyObject *asmat = fromarray(o, 0); if (asmat == NULL) return failmsg("CvArr argument '%s' must be IplImage, CvMat, CvMatND, or support the array interface", name); // now have the array obect as a cvmat, can use regular conversion return convert_to_CvArr(asmat, dst, name); -#endif +#endif*/ } } diff --git a/modules/python/test/test.py b/modules/python/test/test.py index 9b5ddafff7..92d2dae64a 100644 --- a/modules/python/test/test.py +++ b/modules/python/test/test.py @@ -940,8 +940,8 @@ class AreaTests(OpenCVTests): # Using an array object for a CvArr parameter ones = numpy.ones((640, 480)) - r = numpy.ones((640, 480)) - cv.AddS(ones, 7, r) + r = cv.fromarray(numpy.ones((640, 480))) + cv.AddS(cv.fromarray(ones), 7, r) self.assert_(numpy.alltrue(r == (8 * ones))) # create arrays, use them in OpenCV and replace the the array @@ -958,11 +958,12 @@ class AreaTests(OpenCVTests): # m = numpy.identity(4, dtype = numpy.float32) + m = cv.fromarray(m[:3, :3]) rvec = cv.CreateMat(3, 1, cv.CV_32FC1) rvec[0,0] = 1 rvec[1,0] = 1 rvec[2,0] = 1 - cv.Rodrigues2(rvec, m[:3,:3]) + cv.Rodrigues2(rvec, m) #print m else: