gpt4 book ai didi

c++ - PCL:如何更新 pcl::visualizer 中的法线云?

转载 作者:太空狗 更新时间:2023-10-29 21:45:11 25 4
gpt4 key购买 nike

我有一个线程可以在处理点云时将其可视化。我还需要可视化法线,我该如何更新它们?

我找不到像普通云的 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();

}
}

关于c++ - PCL:如何更新 pcl::visualizer 中的法线云?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18214903/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com