Point Cloud Library (PCL) wait/delay/sleep function in C++ -
Point Cloud Library (PCL) wait/delay/sleep function in C++ -
is there way can create pcl library wait while when visualizing point clouds? have series of point clouds , want "animate" these in pclvisualizer (by either updating single point cloud or showing+removing new point cloud in loop).
i using c++ , have set cloudviewer example. far can reach grade of delay cross-compiling opencv , using waitkey(milliseconds) function. on ubuntu 14.04 lts. made illustration work opencv:
#include <opencv2/opencv.hpp> using namespace cv;
however waitkey works within simple utilize in end of viewerpsycho function delays counter in function:
void viewerpsycho (pcl::visualization::pclvisualizer& viewer) { static unsigned count = 0; std::stringstream ss; ss << "once per viewer loop: " << count++; viewer.removeshape ("text", 0); viewer.addtext (ss.str(), 200, 300, "text", 0); // delay counter shows nil waitkey(1000); viewer.addpointcloud(point_cloud_ptr, "first"); waitkey(1000); viewer.removepointcloud("first"); }
my code richer original illustration , method addpointcloud works when not trying delay. method removepointcloud works since nil displayed (waitkey ignored?).
the waitkey seems ignored in vieweroneoff function when used same way addpointcloud , removepointcloud (in end of function):
works (only shows):
viewer.addpointcloud(point_cloud_ptr, "first");
does not work (shows nothing):
viewer.addpointcloud(point_cloud_ptr, "first"); waitkey(5000); viewer.removepointcloud("first");
my cmakelists.txt:
cmake_minimum_required(version 2.8 fatal_error) project(opencv_pcl) find_package(pcl 1.2 required) find_package(opencv required) include_directories(${pcl_include_dirs}) include_directories(${opencv_include_dirs}) link_directories(${pcl_library_dirs}) add_definitions(${pcl_definitions}) add_executable (opencv_pcl opencv_pcl.cpp) target_link_libraries (opencv_pcl ${pcl_libraries} ${opencv_libs})
i appreciate help.
do have spin() or spinonce() method anywhere in code?
viewer->spinonce (100);
this updates renderer , processes interactions (http://docs.pointclouds.org/trunk/classpcl_1_1visualization_1_1_p_c_l_visualizer.html#a896556f91ba6b45b12a9543a2b397193).
c++ delay sleep wait point-cloud-library
Comments
Post a Comment