-
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
Export pointcloud info without mesh and with RGB info and only of a certain region #11241
Comments
I am trying to export point cloud information of a region without mesh information. The image below is what I am looking to export. Point cloud with RGB and without mesh information. And I am looking to be able to specify the domain (x,y,z distance from the camera and then a square bounding box domain) and be able to export the point cloud domain with RGB and without mesh. Any help will be appreciated. |
Hi @Ankush1909IIT Let's begin by tackling the pointcloud export part of your question first. The Python and C++ script references for .ply export at #6411 (comment) may be helpful to you. The Python script uses the export_to_ply instruction to export a color .ply file without vertex normals. The C++ script uses the save_to_ply instruction and supports .ply export configuration options similar to those of the RealSense Viewer's .ply export interface that you quoted in the image above. |
Hi @MartyG-RealSense , I am using python. |
If you would prefer to use save_to_ply to achieve configuration options similar to the Viewer, there is a Python save_to_ply example script at #7747 (comment) which exports depth but did not export color for the script's creator even though it was intended to. The export_to_ply script that exports with color but without vertex normals is the only confirmed successful way to export a color .ply in Python. As it has been a couple of years since the Python save_to_ply script was last reported to have been tried though, you are welcome to try it yourself to see whether you get different results now. |
Hi @MartyG-RealSense can you share the python code for export to ply option. I tried changing it in orignal code for export given as example and it return the error module 'pyrealsense2' has no attribute 'export_to_ply'. |
The RealSense SDK has a complete example Python program called export_ply_example.py for saving a .ply with save_to_ply though without color included, so you would have to use it as a reference to work out how to add color export with the help of the code in #7747 (comment) In regard to export_to_ply, the SDK example pyglet_pointcloud_viewer.py uses this instruction for .ply export, though the overall program may be more complex than you need. |
The subject of color ply export with Python has been extensively researched several times with multiple references examined, and each time the conclusion has been that the only known working method to export a color ply from Python is with the export_to_ply script at #6194 (comment) unfortunately. |
import numpy as np print("Environment Ready") pc = rs.pointcloud() #Create a config and configure the pipeline to stream config = rs.config() #Start streaming for x in range(10): frames = []
print("Done") This code is working but is returning the mesh information as well. Any idea on how to remove it? |
Do we have options to only export a region? |
You could implement a post-processing threshold filter in Python to exclude Z-depth data outside of a certain range. References for doing so in Python can be found at #5964 (comment) XY can have detail removed using a bounding box to remove all XY detail outside of the bounding box, though it is a complicated procedure. I will be happy to continue this discussion with you tomorrow. Good luck! |
yes, we can continue tomorrow. |
Hi @Ankush1909IIT Do you require further assistance with this case, please? Thanks! |
Hi @MartyG-RealSense , can you please keep it open? I am still working on it by looking at other question but yet to reach a solution. |
Okay, it's no problem to keep it open. Thanks very much for the update! |
Hi @MartyG-RealSense , can you let me know if we have a solution to exporting without mesh. The code that I shared is exporting with color but as a mesh and not as point cloud? I looked at some of the answers but without any success yet. |
If using the Python script at #6411 (comment) to export a ply with color but without vertex normals is not suitable for you then there is not an alternative solution for Python that is known to work, unfortunately. |
Hi @Ankush1909IIT Bearing in mind the above comment, do you require further assistance with this case please? Thanks! |
import numpy as np print("Environment Ready") pc = rs.pointcloud() #Create a config and configure the pipeline to stream config = rs.config() Start streamingprofile = pipe.start(config) threshold_filter = rs.threshold_filter() for x in range(10): frames = []
print("Done") Hi, @MartyG-RealSense , I am using this code to remove the background. I am not sure why it is not working? Do you have any idea? |
I carefully checked your code and cannot find any obvious problems with your approach, and you are using the code at #6194 (comment) which is the only known working method of exporting color to ply. So it should work. What happens if you comment out these two lines:
|
Hi @Ankush1909IIT Do you have an update about this case that you can provide, please? Thanks! |
Hi @MartyG-RealSense - thanks for your help, the problem was not solved. However, I wrote my own code which reads the info line by line and removes the background. Thank you for your help. I will close this. |
Thanks very much @Ankush1909IIT for the update! I'm pleased to hear that you achieved a solution. |
Before opening a new issue, we wanted to provide you with some useful suggestions (Click "Preview" above for a better view):
All users are welcomed to report bugs, ask questions, suggest or request enhancements and generally feel free to open new issue, even if they haven't followed any of the suggestions above :)
Issue Description
<Describe your issue / question / feature request / etc..>
The text was updated successfully, but these errors were encountered: