Search code examples
c++point-cloud-librarypoint-cloudslidar

Save a PCL specific view as image


I am new to C++ and the use of the Pointcloud Library PCL (https://pointclouds.org/). At the moment I am able to generate a viewer of the point cloud by using the <pcl::visualization::PCLVisualizer> and I was wondering if it would be possible to save an image of the current viewer "view".

Imagine I have a picture like the following: enter image description here At the moment I just take a screenshot manually of what it looks like. However, since I will be processing many point clouds, I would like to have a way to convert this "viewer view" to an image.


Solution

  • Of course I posted the question after researching online. However, I could not find the super easy solution available already in PCL.

    You just need to use the function:

    void pcl::visualization::PCLVisualizer::saveScreenshot ( const std::string & file )

    Documentation here

    I hope this will be helpful for someone else in the same situation.