1. 需要進(jìn)行濾波的4種情況
1 點(diǎn)云數(shù)據(jù)密度不規(guī)則
2 離群點(diǎn)(比如由于遮擋等原因噪聲的)
3 下采樣
4 噪聲
2. PCL濾波中的類(32)和函數(shù)(5)
類class pcl::ApproximateVoxelGrid<PointT>
該類根據(jù)給定的點(diǎn)云生成三維體素柵格,并利用柵格的中心店近似替代該柵格中的所有點(diǎn),以此完成降采樣,得到濾波效果.
用途:海量數(shù)據(jù)壓縮,濾波,尤其是在特征提取中,選擇合適的體素大小可以極大提高效率.
類成員函數(shù):設(shè)置柵格大小,設(shè)置是否對所有字段(XYZRGBA等)進(jìn)行下采樣等.
1.雙邊濾波 class pcl::BilateralFilter<PointT>
圖像處理中的雙邊濾波可以較好的保留邊界信息
(注:高斯濾波按照距離中心店的遠(yuǎn)近設(shè)置權(quán)種,越近則權(quán)重越大;
而雙邊濾波是按照卷積核中元素強(qiáng)度值與中心點(diǎn)強(qiáng)度的近似情況來設(shè)置權(quán)重,強(qiáng)度值越相近,則該點(diǎn)權(quán)重越大 ---顧雙邊濾波能更好的保留邊界信息)
同樣,在pcl三維點(diǎn)云濾波中,也是按照強(qiáng)度值來進(jìn)行濾波的--故要求點(diǎn)云信息中必須包含強(qiáng)度數(shù)據(jù)
關(guān)鍵成員函數(shù)列舉:void applyFilter(&output) 對數(shù)據(jù)點(diǎn)云進(jìn)行濾波,并輸出到output中存儲結(jié)果
double computePointWeight(pid,vector<points_index>,vector<points_dist>)
2.類BoxClipper3D<pointT>
3.Clipper3D
4. class pcl::ConditionalRemoval<PointT>
用戶自定義規(guī)則,以規(guī)律符合條件的點(diǎn),非常靈活
關(guān)鍵成員函數(shù):void setKeepOrganized(bool) 是否保留濾波后被刪除的點(diǎn)(比如可以直接刪除(false),或設(shè)置用戶自定義值(true) setUserFilterValue(float)
setCondition(ConditionBasePtr condition) 設(shè)置濾波條件(具體使用待查)
5. 類卷積濾波 class pcl::filters::Convolution<PointT,PointOut>
實(shí)現(xiàn)卷積濾波的功能
關(guān)鍵成員函數(shù)void setKernal(const Eigen::ArrayXf & kernal) 設(shè)置卷積核(Eigen::Array格式)
void setBordersPolicy(int policy) 設(shè)置邊緣處理方式 (-1:0處理;0:鏡像處理;1:擴(kuò)展處理,賦值附近的點(diǎn)值)
void setDistanceThreshold(float) 設(shè)置卷積時行列相鄰點(diǎn)之間的最大距離閾值
void setNumberOfThreads(int) 設(shè)置線程數(shù)(值-1表示不限制)
void convolveRows(&out) 行卷積實(shí)現(xiàn)
void convolveCols(&out) 列卷積實(shí)現(xiàn)
void convolve(&out) 先行再列卷積
7. 高斯濾波class pcl::filters::GaussianKernal<PointT,PointTout>
相當(dāng)于一個具有平滑性能的低通濾波器
關(guān)鍵函數(shù)void setSigma(float) 設(shè)置高斯標(biāo)準(zhǔn)差(決定了函數(shù)的寬度)
setThresholdRelativeToSigma(float)
setThreshold(float)
8. 基于顏色的高斯濾波pcl::filters::GaussianKernalRGB<in,out>
同時考慮XYZ和RGB
9. pcl::CropBox<PointT>
刪除用戶給定空間內(nèi)的點(diǎn)
10. pcl::CropHull<PointT>
14 pcl::Filter<PointT>
24. 簡單刪除離群點(diǎn)class pcl::RadiusOutlierRemoval<PointT>
即如果一個點(diǎn)在radius半徑內(nèi)少于k個點(diǎn),那么就認(rèn)為該點(diǎn)是離群點(diǎn)
setRadiusSearch(double radius)
setMinNeighborsInRadius(int k)
26. 均勻概率隨機(jī)抽樣 pcl::RandomSample<PointT>
應(yīng)用實(shí)例
使用直通濾波器對點(diǎn)云進(jìn)行濾波
對指定某一維度進(jìn)行濾波,即去掉用戶指定范圍內(nèi)的點(diǎn) --大范圍截取ROI
pcl::PassThroudh<pcl::PointXYZ> pass; //設(shè)置濾波器對象
pass.setInputCloud(cloud);
pass.setFilterFieldName("z"); //設(shè)置對那個維度進(jìn)行過濾
pass.setFilterLimits(0.0,1.0); // 設(shè)置過濾值范圍
// pass.setFilterLimitsNegative(true); //設(shè)置保留范圍內(nèi)的害死過濾掉范圍內(nèi)的
pass.filter(*out_cloud); // 執(zhí)行