簡體   English   中英

PCL:如何在pcl :: visualizer中更新法線的雲?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM