Convert sl::Mat to pcd file

Hi, I would like convert and save my point cloud zed.retrieveMeasure(point_cloud, MEASURE::XYZRGBA) to .pcd file. Do you have an idea ?
Thanks

Hello and thank you for reaching us out,

To achieve that, you’ll probably have to do the export yourself by reading the value in the sl.Mat. There is an example on the internet : https://pcl.readthedocs.io/projects/tutorials/en/latest/writing_pcd.html

Regards

Antoine Lassagne
Senior Developer - ZED SDK
Stereolabs Support

Hello, to convert the point cloud, i need to know the point cloud resolution.
So i print the different resolution, image resolution : 1280720, point_cloud resolution : 1280720.
But finally, i have a point cloud with 600 000 points. So, the number of points and the resolution (Zed::Mat) is not the same.
Can you explain why? And how can i obtain the right number of points?
Thank you !

Hello, can you send me some sample of code, so I can see what’s going on ? Especially, how do you obtain these 600 000 points ?
When you get a point cloud matrix, it’s filled with height x with points, but some of them are considered not valid (NAN). So in the end, you’ll get less points than the full matrix if you only keep the valid ones.

Apart from that, you can take inspiration in this repo : https://github.com/stereolabs/zed-pcl
Where they manipulate point cloud with the PCL library. If I’m not wrong, the .pcd format is the one from the PCL library?

Regards

Antoine Lassagne
Senior Developer - ZED SDK
Stereolabs Support

Hello, So this is my code :

When i print the mat::point_cloud size, i obtain 1280x720. Then, in my .pcd file, the number of point is around 600 000. It’s never the same number of points. But the size of array never changes. It’s still 1280x720.

And yes pcd format is on PCL Library.

Thank you