Save screenshot using keyboard callback event

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Save screenshot using keyboard callback event

Ravi Joshi
This post has NOT been accepted by the mailing list yet.
This post was updated on .
I am trying to save screenshot inside PCL Visualizer window using keyboard callback event. Below is the code snippet:

#include <pcl/io/pcd_io.h>
#include <pcl/visualization/pcl_visualizer.h>

void keyboardEventOccurred (const pcl::visualization::KeyboardEvent &event, void* viewer)
  if (event.getKeySym () == "s" && event.keyDown ())

int main (int argc, char** argv)
    pcl::visualization::PCLVisualizer viewer("Cloud Viewer");

    pcl::PointCloud<pcl::PointXYZRGBA>::Ptr body (new pcl::PointCloud<pcl::PointXYZRGBA>);
    pcl::io::loadPCDFile ("body.pcd", *body);
    viewer.addPointCloud (body,"body");
    viewer.registerKeyboardCallback (keyboardEventOccurred, &viewer);
    return 0;

However, there is some mismatch between data fields and it is returning following error:

[100%] Building CXX object CMakeFiles/pcl_visualizer.dir/pcl_visualizer.cpp.o
/home/ravi/pcl_visualizer/pcl_visualizer.cpp: In function ‘void keyboardEventOccurred(const pcl::visualization::KeyboardEvent&, void*)’:
/home/ravi/pcl_visualizer/pcl_visualizer.cpp:8:11: error: ‘void*’ is not a pointer-to-object type
make[2]: *** [CMakeFiles/pcl_visualizer.dir/pcl_visualizer.cpp.o] Error 1

Any workaround, please?