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

Exporting Point Cloud in C# #7886

Closed
BJuraj opened this issue Nov 30, 2020 · 6 comments
Closed

Exporting Point Cloud in C# #7886

BJuraj opened this issue Nov 30, 2020 · 6 comments

Comments

@BJuraj
Copy link

BJuraj commented Nov 30, 2020


Required Info
Camera Model { D400 }
Firmware Version (Open RealSense Viewer --> Click info)
Operating System & Version { Win 10 }
Kernel Version (Linux Only) (e.g. 4.14.13)
Platform { PC }
SDK Version { 2.40.0 }
Language {C# }
Segment {Robot/Smartphone/VR/AR/others }

Issue Description

Hello I'm trying to export a point cloud in C#. I'm using the point cloud code from the cookbook and the exporttoply() method, but when I run the code nothing is exported.
Hopefully someone can tell me how to achieve this.
Thanks in advance.

`
var pipe = new Pipeline();
var pc = new PointCloud();
pipe.Start();

                using (var frames = pipe.WaitForFrames())
                using (var depth = frames.DepthFrame)
                using (var color = frames.ColorFrame)
                using (var points = pc.Process(depth).As<Points>())
                {


                    // CopyVertices is extensible, any of these will do:
                    var vertices = new float[points.Count * 3];
                    // var vertices = new Intel.RealSense.Math.Vertex[points.Count];
                    // var vertices = new UnityEngine.Vector3[points.Count];
                    // var vertices = new System.Numerics.Vector3[points.Count]; // SIMD
                    // var vertices = new GlmSharp.vec3[points.Count];
                    //  var vertices = new byte[points.Count * 3 * sizeof(float)];
                    points.CopyVertices(vertices);

                                                             
                   points.ExportToPLY("pointcloud.ply", color);


                }

`

@MartyG-RealSense
Copy link
Collaborator

Hi @BJuraj Have you seen the adaptation of the C# cookbook point cloud for points.ExportToPly that is in the link below, please?

#7362

@BJuraj
Copy link
Author

BJuraj commented Nov 30, 2020

@MartyG-RealSense Thanks for the fast reply. The code from your link solved my problem.

@BJuraj BJuraj closed this as completed Nov 30, 2020
@MartyG-RealSense
Copy link
Collaborator

Great to hear - thanks for the update :)

@BJuraj
Copy link
Author

BJuraj commented Nov 30, 2020

@MartyG-RealSense Sorry to reopen this issue again. Is it possible to get the point cloud without meshing?

@BJuraj BJuraj reopened this Nov 30, 2020
@MartyG-RealSense
Copy link
Collaborator

I researched your follow-up question deeply. In C++ and Python you can set ply configuration options wit the save_to_ply processing block but I could not find a C# method for accessing it.

#4906

@BJuraj
Copy link
Author

BJuraj commented Nov 30, 2020

Ok. Thanks for your help.

@BJuraj BJuraj closed this as completed Nov 30, 2020
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