1. 程式人生 > >PCL學習筆記——合併點雲

PCL學習筆記——合併點雲

合併點雲分為兩種型別:第一種是兩個點雲資料集的欄位型別和維度相同,合併之後點雲只是點的數量增加了;第二種是兩個點雲資料集的欄位型別或維度不同,但是點的數量相同,合併之後相當於擴充套件了欄位或維度,例如點雲A是N個點的XYZ點集,點雲B是N個點的RGB點,則連線兩個欄位形成的點雲C是N個XYZRGB型別。

一、擴充套件點的數目

相關函式:

inline const PointCloud
      operator + (const PointCloud& rhs)

example:

cloudC = cloudA + cloudB;

二、擴充套件點雲欄位或者維度

相關函式:

template <typename PointIn1T, typename PointIn2T, typename PointOutT> void
pcl::concatenateFields (const pcl::PointCloud<PointIn1T> &cloud1_in,
                        const pcl::PointCloud<PointIn2T> &cloud2_in,
                        pcl::PointCloud<PointOutT> &cloud_out)

example:
一定要確定cloud1_in和cloud2_in點雲數目相同,並且cloud_out的欄位包含兩個輸入點雲的所有欄位!

// 一個PointXYZ型別的點雲和一個Normal型別的點雲合併為一個PointNormal型別點雲
pcl::concatenateFields(cloudC, cloud_normal, cloud_xyznormal);