mirror of
https://github.com/opencv/opencv.git
synced 2026-10-04 04:03:29 +03:00
fix: preserve NumPY writeable flag in output arguments
This commit is contained in:
1 parent
0519e05432
commit
4c568e6ed3
2 files changed
+13
No files matched your search
@@ -101,6 +101,13 @@ bool pyopencv_to(PyObject* o, Mat& m, const ArgInfo& info)
|
||||
|
||||
PyArrayObject* oarr = (PyArrayObject*) o;
|
||||
|
||||
if (info.outputarg && !PyArray_ISWRITEABLE(oarr))
|
||||
{
|
||||
failmsg("%s marked as output argument, but provided NumPy array "
|
||||
"marked as readonly", info.name);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool needcopy = false, needcast = false;
|
||||
int typenum = PyArray_TYPE(oarr), new_typenum = typenum;
|
||||
int type = typenum == NPY_UBYTE ? CV_8U :
|
||||
|
||||
Reference in new issue
Block a user