有沒有一種方法可以使PCL庫在等待一段時間後可視化點雲?我有一系列的點雲,並希望在PCLVisualizer中「通過更新單點雲或在循環中顯示+刪除新的點雲」來對它們進行「動畫處理」。C++中的點雲庫(PCL)等待/延遲/休眠功能
我使用C++並已設置CloudViewer example。到目前爲止,我只能通過與OpenCV交叉編譯並使用其waitKey(毫秒)函數來達到某種程度的延遲。我在Ubuntu 14.04 LTS上。與OpenCV的做例子的工作:
#include <opencv2/opencv.hpp>
using namespace cv;
然而waitKey只能在viewerPsycho函數的最後一個簡單的使用它真正延遲計數器在函數中:
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);
// this will delay counter but shows nothing
waitKey(1000);
viewer.addPointCloud(point_cloud_ptr, "first");
waitKey(1000);
viewer.removePointCloud("first");
}
我的代碼比原始示例更豐富,並且在不嘗試延遲時,addPointCloud方法可以正常工作。方法removePointCloud可能也可以工作,因爲沒有顯示任何內容(waitKey忽略?)。
的waitKey也似乎在viewerOneOff功能與addPointCloud和removePointCloud用同樣的方式像這樣的時候被忽略(在函數結尾):
作品(僅顯示):
viewer.addPointCloud(point_cloud_ptr, "first");
不工作(不顯示任何內容):
viewer.addPointCloud(point_cloud_ptr, "first");
waitKey(5000);
viewer.removePointCloud("first");
我的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})
我會很感激任何幫助。
你說得對,這就是我正在尋找的。我試圖使用CloudViewer類,但它似乎沒有旋轉/延遲方法,所以它在waitKey中表現得有點奇怪。人們必須切換到真正的spin/spinOnce的「大」PCLVisualizer類。 – Kozuch 2014-10-08 18:56:15