代码来自官方网站。我只使用PointXYZ类型的PCDFile,云中就有数据。这是我的代码:
int main() {
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
if (-1 == pcl::io::loadPCDFile<pcl::PointXYZ>("to_shuidaoyezi.pcd", *cloud))
{
std::cout << "无法读取PCD文件数据" << endl;
return -1;
}
std::cout << "Load " << cloud->width * cloud->height << " points from PCDFile" << endl;
pcl::visualization::CloudViewer viewer("Cloud Viewer");
//blocks until the cloud is actually rendered
viewer.showCloud(cloud);
//use the following functions to get access to the underlying more advanced/powerful
//PCLVisualizer
//This will only get called once
viewer.runOnVisualizationThreadOnce(viewerOneOff);
//This will get called once per visualization iteration
viewer.runOnVisualizationThread(viewerPsycho);
while (!viewer.wasStopped())
{
//you can also do cool processing here
//FIXME: Note that this is running in a separate thread from viewerPsycho
//and you should guard against race conditions yourself...
user_data++;
}
return 0;
}
有人知道如何解决这个问题吗? 预先感谢!