Tl;Dr:
OpenCV obey the readonly tag in Numpy. As a result, this line:
|
image = np.asarray(image) |
will fail if ran with OpenCV 4.9+
Workaround:
Add image = np.copy(image) after the infringing line
Longer story:
I am running the nanoowl using Jetson Containers. In Nov 2024 the nanoowl dustynv/nanoowl:r36.4.0 container has OpenCV 4.10.0 and numpy 1.26.4
In OpenCV 4.9 release, functions that change the output image are observing the readonly flag from numpy arrays: opencv/opencv-python#859 As a result, if the array is readonly, this error will surface: opencv/opencv#24522 .
Numpy version is important because there is a copy parameter to asarray but only in ver 2+ https://numpy.org/doc/stable/reference/generated/numpy.asarray.html
Question:
To make a more "permanent" fix:
- Create a PR with
image = np.asarray(image).copy() or other suggested method to return a r/w array
- Create issue in Jetson Containers to work there a solution (openCV build version pinning, etc)
Tl;Dr:
OpenCV obey the readonly tag in Numpy. As a result, this line:
nanoowl/nanoowl/owl_drawing.py
Line 39 in cfef75a
Workaround:
Add
image = np.copy(image)after the infringing lineLonger story:
I am running the nanoowl using Jetson Containers. In Nov 2024 the nanoowl dustynv/nanoowl:r36.4.0 container has OpenCV 4.10.0 and numpy 1.26.4
In OpenCV 4.9 release, functions that change the output image are observing the readonly flag from numpy arrays: opencv/opencv-python#859 As a result, if the array is readonly, this error will surface: opencv/opencv#24522 .
Numpy version is important because there is a
copyparameter toasarraybut only in ver 2+ https://numpy.org/doc/stable/reference/generated/numpy.asarray.htmlQuestion:
To make a more "permanent" fix:
image = np.asarray(image).copy()or other suggested method to return a r/w array