簡體   English   中英

點雲庫:切片到自定義顏色的點

[英]Point Cloud Library: Sliced points to custom colors

我正在將帶有Qt的pcl和vtk庫用於點雲可視化。 我的設置如下鏈接http://unanancyowen.com/en/pcl-with-qt/

現在,當我們對點進行切片時,即按“ x”並通過AreaPickingEvent選擇一個區域,所選的切片點將變為紅色。 通過以下功能完成

void PointCloudVisualizer::highlightPoint(std::vector<int>& slice)
    {
        if (slice.size()<1) return;

        for (std::vector<int>::iterator it = slice.begin(); it != slice.end(); it++)    {
            m_cloudLabel[*it] = SELECTED_POINT;//SELECTED_POINT = 1
        }
    }

   void PointCloudVisualizer::updateCloud()
   {
    m_pViewer->updatePointCloud<PointT>(m_pCloud, m_pColorHandler, m_sCurrentPointCloudId.toStdString());
    m_pPointCloudVisualizerUI->qvtkWidget->update();
}

//area picking event, after the points are sliced we call these 2 functions and the sliced points gets red
void PointCloudVisualizer::AreaPickingEventProcess(const pcl::visualization::AreaPickingEvent& event)
{
    vector<int> newSelectedSliceVector;
    event.getPointsIndices(newSelectedSliceVector);

    if (newSelectedSliceVector.empty()) return;

    // remove ground points
    vector<int> groundPointsVector;

    for (auto point : newSelectedSliceVector)
    {
        if (m_cloudLabel[point] != GROUND_POINT)
        {
            groundPointsVector.push_back(point);
        }
    }
    .
    .
    .
    newSelectedSliceVector = groundPointsVector;

    m_lastSelectedSliceVector = newSelectedSliceVector;
    .
    .
    .
    highlightPoint(m_lastSelectedSliceVector);//red color selected points
    updateCloud();
    .
    .
    .
    }

//other variables
    int* m_cloudLabel;
    PointCloudTPtr m_pCloud;

    //initializing m_cloudLabel
    m_cloudLabel = new int[m_pCloud->size()];
    memset(m_cloudLabel, 0, m_pCloud->size()*sizeof(int));

    m_pColorHandler.setInputCloud(m_pCloud);
    m_pColorHandler.setLabel(m_cloudLabel);
    //----------------------------------------

    const int DEFAULT_POINT =  0;
    const int SELECTED_POINT = 1;
    const int GROUND_POINT = 2;

現在,如果我們通過GROUND_POINT,它將變為藍色,用於平面檢測或閾值。

現在,我的要求是根據用戶的定義為切片的點着色。 如何將我的自定義顏色應用於pcl :: RGB的切片點。

任何建議表示贊賞!

點雲處理程序維護用於為切片點着色的顏色LUT(查找表)。 更新了顏色LUT並調用了HighlightPoints,其中SELECTED_POINT索引隨着用戶選擇顏色而更新。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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