-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Python bindings: Constructor for BufData missing #8394
Comments
@nalt, the librealsense/wrappers/python/python.hpp Lines 206 to 210 in bc0910f
|
@ev-mp These are C++ constructors. If there was a Python binding for these, Python should say, e.g.:
But the Python error says there is really no |
@nalt , thanks for clarification on that it is a different UC. The |
The use case here is to call I agree, there is no need to modify BufData, but there is a need to create it from a numpy array. |
This would be an initialiser for the buffer protocol: It would allow to create BufData from numpy and others as follows:
However, this would still allow in-place modification. Maybe data must be copied. |
@nalt, thanks for the proposal. |
BufData is a Librealsense class. Anyway, where should the (Python) constructor be implemented instead? On rs.frame maybe? |
Hi @nalt Do you require further assistance with this case, please? Thanks! |
For the completeness and usability of the librealsense Python bindings, I think there should be a way to construct all objects exposed to Python from the Python side. For frame or BufData, this is currently not the case. There is already a partial buffer protocol for BufData, so why not implement it fully? I removed librealsense from my code now due to this problem, so I do not need further assistance. |
Thanks very much @nalt for the update. |
Hi, I am currently having this problem. I don't have the camera so I have to use the camera data through ROS. When transforming the pixels to 3d with rs2_project_color_pixel_to_depth_pixel() I have to convert a numpy.ndarray type data to BufData(). I don't understand how to implement the constructor in python. I would appreciate some help on this issue |
Issue Description
It is apparently not possible to create a BufData object in Python, since there is no constructor:
BufData is used for instance in the frame class. For generated or modified data, it may be needed to create a BufData object in Python. Since BufData uses the buffer protocol, it would be straight-forward to create it from numpy and other matrix classes.
Code references
librealsense/wrappers/python/python.hpp
Line 197 in bc0910f
librealsense/wrappers/python/pyrs_frame.cpp
Line 8 in 4f37f2e
The text was updated successfully, but these errors were encountered: