How to save raw point cloud as .ply file in code?

A mesh can be saved as image
A fused point cloud can be saved as image
A raw point cloud within Depth Viewer Tool can be saved by image
Now how do I save a raw point cloud like the Depth Viewer Tool, but from using code (C++) instead of the tool?

Hi @Flocker,

You can use sl.Mat().write() (API documentation : Mat Class Reference | API Reference | Stereolabs ) function on your point cloud mat to save it to a .ply file. You just need to call the function after retrieving your point cloud as such:

zed.retrieveMeasure(point_cloud, MEASURE::XYZRGBA);

Hope this helps

This is what I was looking for and has helped me greatly! Thank you very much!

Can I save it as . bin file in code?


We don’t support .bin export. What format do you expect behind this extension ?


Can you take an example?For example,I hava a pixel of the image like(100,200).How can i get its 3d coordinate from point cloud?I use the function
point_cloud = sl.Mat(res.width, res.height, sl.MAT_TYPE.F32_C4, sl.MEM.CPU)
But it is not correct.