PCLを使用して点群に対して空間フィルタリングを実行する場合、PassThroughは座標軸方向のフィルタリングのみを実行でき、PlaneClipper3Dは点群空間を任意の平面で分割できます。これはより柔軟です。使用方法は次のとおりです。
定義された関数:
pcl::PointCloud<PointT>::Ptr plane_clip(const pcl::PointCloud<PointT>::Ptr& src_cloud, const Eigen::Vector4f& plane, bool negative)
{
pcl::PlaneClipper3D<PointT> clipper(plane);
pcl::PointIndices::Ptr indices(new pcl::PointIndices);
clipper.clipPointCloud3D(*src_cloud, indices->indices);
pcl::PointCloud<PointT>::Ptr dst_cloud(new pcl::PointCloud<PointT>);
pcl::ExtractIndices<PointT> extract;
extract.setInputCloud(src_cloud);
extract.setIndices(indices);
extract.setNegative(negative);
extract.filter(*dst_cloud);
return dst_cloud;
}
使用:
1.ヘッダーファイルを導入します。#include <pcl / filters / plane_clipper3D.h>
2.関数を呼び出します。入力パラメーターは(入力点群、平面パラメーター、セグメンテーション方向)です。
cloud_out = plane_clip(cloud_in, Eigen::Vector4f(1.0,1.0, 1.0,1.0), false);