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

Excuse me, is there an interface for converting world coordinate system to pixel coordinate system #13490

Open
linxizi opened this issue Nov 4, 2024 · 2 comments
Labels

Comments

@linxizi
Copy link

linxizi commented Nov 4, 2024

During the project process, we want to convert the world coordinate system of known points into a pixel coordinate system through an interface, But I can't find any interface in the python language

@MartyG-RealSense
Copy link
Collaborator

Hi @linxizi If you have converted 2D pixel coordinates into 3D world coordinates with the instruction rs2_deproject_pixel_to_point then you can convert the 3D points back to 2D pixel coordinates with the instruction rs2_project_point_to_pixel

The link below has an example of a RealSense Python script for deprojecting 2D to 3D, and then projecting 3D back to 2D.

https://stackoverflow.com/questions/50716249/mapping-depth-pixels-to-colour-pixels-using-pyrealsense2

depth_point = rs.rs2_deproject_pixel_to_point(depth_intrin, depth_pixel, depth_scale)
color_point = rs.rs2_transform_point_to_point(depth_to_color_extrin, depth_point)
color_pixel = rs.rs2_project_point_to_pixel(color_intrin, color_point)

In regard to an interface, do you mean that you would like to perform the 3D to 2D conversion through a graphical user interface (GUI) please? If so then there are only a limited number of available ways to do so.

One way would be to use pyglet, as demonstrated by the RealSense SDK's 'pyglet_pointcloud_viewer.py' example program:

https://github.com/IntelRealSense/librealsense/blob/master/wrappers/python/examples/pyglet_pointcloud_viewer.py

The other way would be to use Tkinter.

https://support.intelrealsense.com/hc/en-us/community/posts/4406041385875-TKinter-python-with-librealsense2

@MartyG-RealSense
Copy link
Collaborator

Hi @linxizi Do you require further assistance with this case, please? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants