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

Creating an Image in python from a numpy array doesn't work #1963

Open
icaven opened this issue Dec 15, 2023 · 0 comments · May be fixed by #1964
Open

Creating an Image in python from a numpy array doesn't work #1963

icaven opened this issue Dec 15, 2023 · 0 comments · May be fixed by #1964

Comments

@icaven
Copy link

icaven commented Dec 15, 2023

The function create_from_ndarray() in src/python/k4a/src/k4a/_bindings/image.py has a number of errors:

  • the naming of the modules used (_nd instead of _np, and ctypes instead of _ctypes)

  • when the defaults for the size of the image are used (all set to 0), the correct values are not fetched from the array.

  • None is not permitted as the callback in k4a_image_create_from_buffer(), it leads to the following error:

    ctypes.ArgumentError: argument 7: <class 'TypeError'>: expected CFunctionType instance instead of NoneType

  • the reference count on the numpy array passed in should have its reference count incremented so that the array will not be
    deallocated when the caller deletes it

Related to the callback, in src/python/k4a/src/k4a/_bindings/k4a.py:

  • the declaration of the k4a_image_create_from_buffer has the incorrect callback function type (_memory_allocate_cb instead of the correct _memory_destroy_cb).
@icaven icaven linked a pull request Dec 15, 2023 that will close this issue
7 tasks
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

Successfully merging a pull request may close this issue.

1 participant