-
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
Saving point cloud as ply including normals #6979
Comments
The link below has a C++ script submitted by a RealSense user that they said exports a ply with mesh and faces: That RealSense user and another one also took the alternative approach of computing a point cloud with voxels instead of normals: If using C++ is not an absolute requirement, the link below has a guide for exporting a ply from the RealSense Viewer and then importing it into a program called MeshLab and computing the normals: https://www.andreasjakl.com/capturing-3d-point-cloud-intel-realsense-converting-mesh-meshlab/ |
Thanks @MartyG-RealSense!
But I don`t see the ply saved in the directory - any idea what could be the problem? |
It looks as though your script is on the right track. Compared to the C++ script in the link below that is suggested by Dorodnic the RealSense SDK Manager though, your version does not have an exporter.export_to_ply statement at the end of it after the exporter.set_option statements. |
after adding that too:
I have this error: Any clues how to avoid this? |
In the rs2::save_to_ply exporter line, I'm not sure that "Test " is a valid path for a location and filename to save the ply file to. Try this please: rs2::save_to_ply exporter('test.ply', filtered_pc); |
Comparing your script to the earlier case with Dorodnic's advice that I linked to, it looks as though you should include this in your rs2:: list: rs2::pointcloud pc; And then set the pc definition in save_to_ply: rs2::save_to_ply exporter('test.ply', pc); I also suspect that by having more than one type of the same rs2:: reference (two rs2::frame and rs2::points) instead of one rs2:: for each type, it may be confusing the program. |
Even though I would include |
Hi @philianeles Do you still require assistance with this case, please? Thanks! |
@MartyG-RealSense yes please, the latest state I am at is here: #6979 (comment) |
Hi @philianeles I completely re-researched the case and turned up one new C++ lead, in which it is suggested that export_to_ply be called from rs2::points in a way that is a bit different from yours: |
@MartyG-RealSense thank you! the issue that I had before (#6979 (comment)) seems to be gone with this new lead however I see this error now: would you have an idea why this error is thrown? I have this structure now:
|
Assuming that the program got past the switch instruction okay, I would guess that it is failing at the CrtDbgBreak() instruction. It looks as though this is a call to check the contents of a function called CrtDbgBreak(). Do you actually have a function in the project with that exact name CrtDbgBreak() ? |
I am actually trying in an existing example project (
|
At the bottom of the script, most of the point cloud saving code is commented out, preventing it from running. This includes the definitions for the format that the data will be saved in. If the ply file was successfully saved, I suspect that it would be saved in the same folder as the script since there is not a path defined for "test.ply". |
I am not sure how the settings would effect the actual export action (would it not take default settings if custom ones are not provided?) but just in case I have included them back. Still I do not know why I cannot see the ply in the same folder. As you pointed out, it should save it in the same folder if no path is given - or am I missing something? |
Does it still error if you do this: points_to_save.export_to_ply(points_to_save, colored_filtered); |
Yes then it throws this error: "no suitable user-defined conversion from "rs2::points" to "const std::string" exists" |
Hi @philianeles I apologise that you have not received further comment about your ply export problem. I have highlighted the case with Intel internally to draw attention to it. |
The point cloud is calculated based on the depth frame. The rs-post-processing has an example of how to properly generate the point cloud from the depth frame, colorized the depth and merge it with the point could. Please check: Replacing the colored_depth with the actual depth frame would make your code work.
|
sorry it works now (somehow not in debugging mode from VS but only running the .exe)! Anyhow, thanks for the help! |
@RealSenseSupport and one more question how can I use options like |
I have built the librealsense sdk from source - I am looking for a C++ example for saving point cloud as ply, including normals, would there be one?
The text was updated successfully, but these errors were encountered: