Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: readonly array error for OpenCV 4.9+ in owl_drawing.py #41

Open
cristi-zz opened this issue Nov 27, 2024 · 0 comments
Open

Bug: readonly array error for OpenCV 4.9+ in owl_drawing.py #41

cristi-zz opened this issue Nov 27, 2024 · 0 comments

Comments

@cristi-zz
Copy link

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)
@cristi-zz cristi-zz changed the title bug:Readonly array for OpenCV 4.9+ in owl_drawing Bug: readonly array error for OpenCV 4.9+ in owl_drawing.py Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant