fix(python): handle byte-swapped NumPy inputs on 5.x

This commit is contained in:
Vladimir Iglovikov
2026-10-29 21:39:48 +05:45
parent 2f5613fd94
commit 47ca334d41
2 changed files with 45 additions and 1 deletions

View File

@@ -148,7 +148,7 @@ bool pyopencv_to(PyObject* o, Mat& m, const ArgInfo& info)
return false;
}
bool needcopy = false, needcast = false;
bool needcopy = !PyArray_ISNOTSWAPPED(oarr), needcast = needcopy;
int typenum = PyArray_TYPE(oarr), new_typenum = typenum;
int type = numpyTypeToCvDepth(typenum);