【问题标题】:PCL: How can I update the normals's cloud in pcl::visualizer?PCL:如何更新 pcl::visualizer 中的法线云?
【发布时间】:2013-08-15 09:53:33
【问题描述】:

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

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

    }   
} 

提前致谢。

【问题讨论】:

    标签: c++ multithreading point-cloud-library normals visualizer


    【解决方案1】:

    一种方法是移除法线的云并再次添加:

    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();
    
        }   
    } 
    

    【讨论】:

      猜你喜欢
      • 2013-06-15
      • 1970-01-01
      • 2022-12-21
      • 2018-11-19
      • 2023-03-03
      • 2021-04-06
      • 2017-01-15
      • 1970-01-01
      • 2020-09-20
      相关资源
      最近更新 更多