![](/img/trans.png)
[英]How to store/write the surface normals of a point cloud in a PCL data file?
[英]PCL: How can I update the normals's cloud in pcl::visualizer?
我有一个线程,可以在我工作时可视化一个pointcloud。 我还需要将法线可视化,我该如何更新它们?
对于普通的云,我找不到像updateClouds这样的东西。
void pclVisualizerThread::operator()()
{
// prepare visualizer named "viewer"
while (!viewer_->wasStopped ())
{
viewer_->spinOnce (100);
// Get lock on the boolean update and check if cloud was updated
boost::mutex::scoped_lock updateLock(*(updateModelMutex_.get()));
if((*update_))
{
// I NEED ALSO TO UPDATE THE NORMALS
if(!viewer_->updatePointCloud(cloud_, "Triangulated points"))
{
viewer_->addPointCloud<pcl::PointXYZRGB>(cloud_, *rgb_, "Triangulated points");
viewer_->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "Triangulated points");
}
(*update_) = false;
}
updateLock.unlock();
}
}
提前致谢。
一种方法是删除普通的云并再次添加:
void pclVisualizerThread::operator()()
{
// prepare visualizer named "viewer"
while (!viewer_->wasStopped ())
{
viewer_->spinOnce (100);
// Get lock on the boolean update and check if cloud was updated
boost::mutex::scoped_lock updateLock(*(updateModelMutex_.get()));
if((*update_))
{
if(!viewer_->updatePointCloud(cloud_, "Triangulated points"))
{
viewer_->addPointCloud<pcl::PointXYZRGB>(cloud_, *rgb_, "Triangulated points");
viewer_->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "Triangulated points");
}
viewer_->removePointCloud("normals", 0);
viewer_->addPointCloudNormals<pcl::PointXYZRGB, pcl::Normal> (cloud_, normals_, 150, 0.35, "normals");
(*update_) = false;
}
updateLock.unlock();
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.