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

How can I get point cloud only with color and depth map? #11101

Closed
DHR0703 opened this issue Nov 14, 2022 · 3 comments
Closed

How can I get point cloud only with color and depth map? #11101

DHR0703 opened this issue Nov 14, 2022 · 3 comments

Comments

@DHR0703
Copy link

DHR0703 commented Nov 14, 2022

Required Info
Camera Model { D435i }
Operating System & Version {Win 11}
Platform PC
Language {python }
Segment {Robot }

Issue Description

I used this method before to get point cloud -> pyrealsense2.pointcloud.calculate(depth)
but now, I need to get point cloud by depth map, can this be done, is there any method to do it?
or can I save the frame as a file? so that I can continue to use the method to get a point cloud.
thanks!

@MartyG-RealSense
Copy link
Collaborator

Hi @qq996235826 An alternative method to pc.calculate for obtaining a point cloud is to use depth-to-color alignment first and then use the instruction rs2_deproject_pixel_to_point secondly, as demonstrated in the Python script at #10438

Using pc.calculate and then retrieving the XYZ coordinates from its vertices is more accurate than obtaining XYZ via rs2_deproject_pixel_to_point though as it is the depth-color alignment process that can introduce inaccuracy.

It is possible to export a color pointcloud to a .ply pointcloud file in Python, though the only method for doing so that is confirmed to work is the script at #6194 (comment) that uses pc.calculate.

There is another method of exporting to a ply file called save_to_ply that gives greater control over configuration of the file (such as color / no color and binary / ASCII). There is a Python export script at #7747 (comment) (again, it uses pc.calculate) though it did not export color successfully when last tested in 2020. You are welcome to test it to see whether it works for you now.

@DHR0703
Copy link
Author

DHR0703 commented Nov 14, 2022

Hi @qq996235826 An alternative method to pc.calculate for obtaining a point cloud is to use depth-to-color alignment first and then use the instruction rs2_deproject_pixel_to_point secondly, as demonstrated in the Python script at #10438

Using pc.calculate and then retrieving the XYZ coordinates from its vertices is more accurate than obtaining XYZ via rs2_deproject_pixel_to_point though as it is the depth-color alignment process that can introduce inaccuracy.

It is possible to export a color pointcloud to a .ply pointcloud file in Python, though the only method for doing so that is confirmed to work is the script at #6194 (comment) that uses pc.calculate.

There is another method of exporting to a ply file called save_to_ply that gives greater control over configuration of the file (such as color / no color and binary / ASCII). There is a Python export script at #7747 (comment) (again, it uses pc.calculate) though it did not export color successfully when last tested in 2020. You are welcome to test it to see whether it works for you now.

Thank you for your answer. My problem has been solved

@DHR0703 DHR0703 closed this as completed Nov 14, 2022
@MartyG-RealSense
Copy link
Collaborator

I'm pleased that I could help. Thanks very much for the update!

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

No branches or pull requests

2 participants