PCL函数库摘要——采样一致性

15 篇文章 28 订阅

1.Class pcl::SampleConsensusModel< PointT >

类SampleConsensusModel是随机采样一致性估计算法中不同模型实现的基类,所有的采样一致性估计模型都继承于此类,该类定义了采样一致性估计模型相关的一般接口,具体实现由其子类完成。

#include <pcl/sample_consensus/sac_model.h>
SampleConsensusModel (const PointCloudConstPtr &cloud, bool random=false) 
//  SampleConsensusModel类的构造函数,cloud为输入点云对象指针引用,如果设置random为true,则用当前时间初始化随机函数的种子,否则使用12345作为种子。
SampleConsensusModel (const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false) 
//  SampleConsensusModel类的构造函数,cloud为输入点云对象指针引用, indices为算法使用的点云索引向量,前面两个参数一起限定确定算法输入的点云,如果设置random为true,则用当前时间初始化随机函数的种子,否则使用12345作为种子。
virtual  ~SampleConsensusModel () 
//  析构函数
virtual void  getSamples (int &iterations, std::vector< int > &samples) 
//  获取一组随机采样点数据以点云中点的索引方式存储到samples, iterations为采用随机采样一致性算法的初始迭代次数。
virtual bool  computeModelCoefficients (const std::vector< int > &samples, Eigen::VectorXf &model_coefficients)=0 
//  纯虚函数检查给定的点云索引样本samples能否估计一个有效的模型,实现基于这些样本估算模型系数并将它们存储在model_coefficients中。
virtual void  optimizeModelCoefficients (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients)=0 
//  优化初始估计的模型参数, inliers为设定的局内点, model_coefficients为初始估计的模型系数, optimized_coefficients 为优化后的模型系数。
virtual void  getDistancesToModel (const Eigen::VectorXf &model_coefficients, std::vector< double > &distances)=0 
//  计算点云中所有的点到给定模型model_coefficients 的距离,存储到distances。
virtual void  selectWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold, std::vector< int > &inliers)=0 
//  从点云中选择所有到给定模型model_coefficients的距离小于给定阈值thresh-old的点作为局内点, model_coefficients为估算出来的模型系数, threshold为点到模型的距离阈值,如果点到模型的距离在这个阈值内,视为局内点,否则为局外点, inliers存储最终输出的局内点。
virtual int  countWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold)=0 
//  统计点云中到给定模型model_coefficients的距离小于阈值threshold的点的个数,并作为函数返回值返回。
virtual void  projectPoints (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, PointCloud &projected_points, bool copy_data_fields=true)=0 
//  将局内点inliers投影到模型model_coefficients上创建一组新的点云projected_points,如果 copy_data_fields 设为true,则投影所得到的点云不包含已经在模型上的点,因为局内点部分在模型上,部分是在距离模型允许范围内。
virtual bool  doSamplesVerifyModel (const std::set< int > &indices, const Eigen::VectorXf &model_coefficients, const double threshold)=0 
//  验证一组点集索引indices中的每个子集是否适应给定的模型model_coefficients,在判断每个点是否在给定模型上时所采用的阈值为threshold,如果所有点都在该阈值下适应指定模型,则返回true,否则返回false。
virtual void  setInputCloud (const PointCloudConstPtr &cloud) 
//  设置输入点云,参数cloud指向输入点云对象。
PointCloudConstPtr  getInputCloud () const 
//  获得输入点云的指针。
void  setIndices (const boost::shared_ptr< std::vector< int > > &indices) 
//  设置指向输入点云的索引向量的指针。
void  setIndices (const std::vector< int > &indices) 
//  设置表示输入点云的索引矢量。
boost::shared_ptr< std::vector< int > >  getIndices () const 
//  获得指向输入点云的索引向量的指针。
virtual SacModel  getModelType () const =0 
//  获得所采用模型的类型ID。
const std::string &  getClassName () const 
//  获取此类名称的字符串表示形式。
unsigned int  getSampleSize () const 
//  返回用于计算模型的样本大小。
unsigned int  getModelSize () const 
//  返回模型中的参数数量。
void  setRadiusLimits (const double &min_radius, const double &max_radius) 
//  该函数配合,当用户设定带有半径参数的模型类型时,设置模型半径参数的最大最小半径阈值, min_radius, max_radius分别为设置的模型的最小最大半径。
void  getRadiusLimits (double &min_radius, double &max_radius) 
//  获得用户设定的模型半径参数的最大最小半径阈值。
void  setSamplesMaxDist (const double &radius, SearchPtr search) 
//  设置随机采样时样本之间允许的最大距离为radius, search为采样时使用的搜索对象。
void  getSamplesMaxDist (double &radius) 
//  获得随机采样时样本之间允许的最大距离为radius。
double  computeVariance (const std::vector< double > &error_sqr_dists) 
//  计算模型误差的方差
double  computeVariance () 
//  根据内部估计的距离向量计算模型误差的方差。


2.Class pcl::SampleConsensus< T >

类SampleConsensus是采样一致性算法的基类,所有的采样一致性算法都继承于此类,该类定义了采样一致性算法的接口,具体实现由其各个子类完成。

#include <pcl/sample_consensus/sac.h>
SampleConsensus (const SampleConsensusModelPtr &model, bool random=false) 
//  SampleConsensus类的构造函数,其中model设置随机采样性算法使用的模型,如果设置random为true,则用当前时间初始化随机函数的种子,否则使用12345作为种子。
SampleConsensus (const SampleConsensusModelPtr &model, double threshold, bool random=false) 
//  SampleConsensus类的构造函数,其中model设置随机采样性算法使用的模型,threshold设置模型到点之间的距离阈值,到模型距离大于该阈值的点为局外点,否则为局内点,如果设置random为true,则用当前时间初始化随机函数的种子,否则使用12345作为种子。
void  setSampleConsensusModel (const SampleConsensusModelPtr &model) 
//  设置随机采样性算法使用的模型
SampleConsensusModelPtr  getSampleConsensusModel () const 
//  获得随机采样性算法使用的模型
virtual  ~SampleConsensus () 
//  析构函数
void  setDistanceThreshold (double threshold) 
//  设置点到模型的距离阈值threshold,如果点到模型的距离超过这个阈值,视为局外点,否则,认为是局内点。
double  getDistanceThreshold () 
//  获得点到模型的距离阈值threshold。
void  setMaxIterations (int max_iterations) 
//  设置迭代次数的上限max_iterations。
int  getMaxIterations () 
//  获得迭代次数的上限。
void  setProbability (double probability) 
//  设置每次从数据集中选取至少一个局内点的概率probability。
double  getProbability () 
//  获得每次从数据集中选取至少一个局内点的概率。
virtual bool  computeModel (int debug_verbosity_level=0)=0 
//  纯虚函数,估算实际的模型, debug_verbosity_level设置是否打印调试信息,该函数必须由子类实现具体模型的计算算法。
virtual bool  refineModel (const double sigma=3.0, const unsigned int max_iterations=1000) 
//  优化计算得到的莫模型。
void  getRandomSamples (const boost::shared_ptr< std::vector< int > > &indices, size_t nr_samples, std::set< int > &indices_subset) 
//  获得一组随机采样点存储其索引在向量indices_subset中,Indices是输入的点云索引向量,nr_sample设置需要随机选择的点的数目。
void  getModel (std::vector< int > &model) 
//  获取当前计算所得的模型存储在model返回。   
void  getInliers (std::vector< int > &inliers) 
//  获取局内点存储索引在inliers中返回。
void  getModelCoefficients (Eigen::VectorXf &model_coefficients) 
//  获取当前计算所得的模型系数存储在model_coefficients返回。


3.Class pcl::LeastMedianSquares< PointT >

类LeastMedianSquares < PointT>是LMedS最小中值方差算法的实现,LMedS算法稳健性很好,可以处理有50%以上局内点的随机采样一致性模型估计,并且不需要设置阈值。

#include <pcl/sample_consensus/lmeds.h>
LeastMedianSquares (const SampleConsensusModelPtr &model) 
//  最小中值方差算法的构造函数,其中model设置随机采样性算法使用的模型。
LeastMedianSquares (const SampleConsensusModelPtr &model, double threshold) 
//  最小中值方差算法的构造函数,其中model设置随机采样性算法使用的模型,threshold设置模型到点之间的距离阈值。
bool  computeModel (int debug_verbosity_level=0) 
//  估算实际的模型, debug_verbosity_level设置是否打印调试信息。
void  setDistanceThreshold (double threshold) 
//  设置点到模型的距离阈值threshold,如果点到模型的距离超过这个阈值,视为局外点,否则,认为是局内点。
double  getDistanceThreshold () 
//  获得点到模型的距离阈值threshold。
void  setMaxIterations (int max_iterations) 
//  设置迭代次数的上限max_iterations。
void  setProbability (double probability) 
//  设置每次从数据集中选取至少一个局内点的概率probability。。
void  getRandomSamples (const boost::shared_ptr< std::vector< int > > &indices, size_t nr_samples, std::set< int > &indices_subset) 
//  获得一组随机采样点存储其索引在向量indices_subset中,Indices是输入的点云索引向量,nr_sample设置需要随机选择的点的数目。


4.Class pcl::MaximumLikelihoodSampleConsensus< PointT >

类MaximumLikelihoodSampleConsensus< PointT >是MLESAC极大似然采样一致性估计算法的实现,极大似然采样一致性算法适用于处理数据点中局内点的比例较大的情况,可快速剔除局外点。该方法和RANSAC采用同样的取样策略计算假定的模型结果,但是在选择最优方案时,不仅使用最大内点数目策略,而且使用了极大似然策略,算法详见MLESAC: A new robust estimator with application to estimating image geometry。

#include <pcl/sample_consensus/mlesac.h>
MaximumLikelihoodSampleConsensus (const SampleConsensusModelPtr &model) 
//  MLESAC(最大似然估计样本一致性)的构造函数,其中model设置随机采样性算法使用的模型。
MaximumLikelihoodSampleConsensus (const SampleConsensusModelPtr &model, double threshold) 
//  MLESAC(最大似然估计样本一致性)的构造函数,其中model设置随机采样性算法使用的模型,threshold设置模型到点之间的距离阈值。
bool  computeModel (int debug_verbosity_level=0) 
//  估算实际的模型, debug_verbosity_level设置是否打印调试信息。
void  setEMIterations (int iterations) 
//  设置最大的EM迭代次数iterations。
int  getEMIterations () const 
//  获得最大的EM迭代次数。
void  setMaxIterations (int max_iterations) 
//  设置迭代次数的上限max_iterations。
void  setProbability (double probability) 
//  设置每次从数据集中选取至少一个局内点的概率probability。。



5.Class pcl::MEstimatorSampleConsensus< PointT >

类MEstimatorSampleConsensus< PointT >是M -采样一致性估计算法的实现,M-采样一致性估计算法的基本思想是减小每个异常数据点对其相应的残差的影响,实验结果表明当数据中的异常数据是不精确的定位时,用M-estimators方法得到的结果非常好,但是当数据中有错误匹配时,结果不够理想,这是因为该算法依赖于最初的由最小二乘方法得到的初值,这也是M-estimators方法的缺点,即依赖于初值。M- estimators可以认为是一种策略,可以保证异常数据的作用被衰减的概率要比他们产生平方误差的概率要高。算法详见MLESAC: A new robust estimator with application to estimating image geometry。

6.Class pcl::ProgressiveSampleConsensus< PointT >

类ProgressiveSampleConsensus< PointT >是PROSAC采样一致性估计方法的实现,PROSAC的采样方式不像RANSAC是对所有样本同等对待从整个样本集中取样,而是从通过相似度排序的样本中取排名前N个样本,所以它比RANSAC随机采样一致性算法速率要高出很多倍,该算法常用于伪配准对剔除问题。算法详见Matching with PROSAC- Progressive Sample Consensus。

7.Class pcl::RandomSampleConsensus< PointT >

类RandomSampleConsensus< PointT >是RANSAC算法的实现,算法详见Random Sample Consensus: A Paradigm for Model Fitting with Applications to Im-age Analysis and Automated Cartography。

8.Class pcl::RandomizedRandomSampleConsensus< PointT >

类RandomizedRandomSampleConsensus< PointT >是RRANSAC算法的实现,RRANSAC算法适用于处理数据点中局内点所占比例较大的情况,可快速进行局外点剔除,RRANSAC算法在RANSAC随机抽样一致性算法中加入了Td-d测试,RRANSAC算法比RANSAC模型参数的估算速度快,算法详见RandomizedRANSAC with Td-d test。

#include <pcl/sample_consensus/rransac.h>
RandomizedRandomSampleConsensus (const SampleConsensusModelPtr &model) 
//  RRANSAC(随机样本一致性)的构造函数,其中model设置随机采样性算法使用的模型。 
RandomizedRandomSampleConsensus (const SampleConsensusModelPtr &model, double threshold) 
//  RRANSAC(随机样本一致性)的构造函数,其中model设置随机采样性算法使用的模型,threshold设置模型到点之间的距离阈值。
bool  computeModel (int debug_verbosity_level=0) 
//  估算实际的模型, debug_verbosity_level设置是否打印调试信息。
void  setFractionNrPretest (double nr_pretest) 
//  设置需要预先进行Td-d测试的点所占的百分比nr_ pretest。
double  getFractionNrPretest () 
//  获得需要预先进行Td-d测试的点所占的百分比。
void  setDistanceThreshold (double threshold) 
//  设置点到模型的距离阈值threshold,如果点到模型的距离超过这个阈值,视为局外点,否则,认为是局内点。
void  setMaxIterations (int max_iterations) 
//  设置迭代次数的上限max_iterations。
void  setProbability (double probability) 
//  设置每次从数据集中选取至少一个局内点的概率probability。。


9.Class pcl::RandomizedMEstimatorSampleConsensus< PointT >

类RandomizedMEstimatorSampleConsensus< PointT >实现了RMSAC算法,RMSAC算法适用于处理数据点中局内点比例比较大的情况,可快速进行局外点剔除。RMSAC算法是在M -采样一致性估计算法中加入了Td-d测试。

#include <pcl/sample_consensus/rmsac.h>
RandomizedMEstimatorSampleConsensus (const SampleConsensusModelPtr &model) 
//  RMSAC (随机M-采样一致性估计算法)的构造函数,其中model设置随机采样性算法使用的模型。 
RandomizedMEstimatorSampleConsensus (const SampleConsensusModelPtr &model, double threshold) 
//  RMSAC (随机M-采样一致性估计算法)的构造函数,其中model设置随机采样性算法使用的模型,threshold设置模型到点之间的距离阈值。
bool  computeModel (int debug_verbosity_level=0) 
//  估算实际的模型, debug_verbosity_level设置是否打印调试信息。  
void  setFractionNrPretest (double nr_pretest) 
//  设置前置需要预先进行Td-d测试的点所占的百分比nr_ pretest。
double  getFractionNrPretest () 
//  获得需要预先进行Td-d测试的点所占的百分比。

10.Class pcl::SampleConsensusModelCircle2D< PointT >

类SampleConsensusModelCircle2D< PointT >实现了采样一致性计算的二维平面圆周模型,SACMODEL_CIRCLE2D定义为二维平面圆周模型,共设置3个参数[center. x center. y radius],其中(center. x, center. y)为圆周中心二维坐标,radius为圆周半径,从点云中分割提取的内点都处在估计参数对应的圆周上或距离圆周边线的距离在一定范围内。

#include <pcl/sample_consensus/sac_model_circle.h>
SampleConsensusModelCircle2D (const PointCloudConstPtr &cloud, bool random=false) 
//  SampleConsensusModelCircle2D类的构造函数  
SampleConsensusModelCircle2D (const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false) 
//  SampleConsensusModelCircle2D类的构造函数  
SampleConsensusModelCircle2D (const SampleConsensusModelCircle2D &source) 
//  复制构造函数
virtual  ~SampleConsensusModelCircle2D () 
//  空析构函数
SampleConsensusModelCircle2D &  operator= (const SampleConsensusModelCircle2D &source) 
//  复制构造函数
bool  computeModelCoefficients (const std::vector< int > &samples, Eigen::VectorXf &model_coefficients) 
//  检查给定的点云索引样本samples能否形成二维圆周模型,实现基于这些样本估算模型参数,并将其存储到model_coefficients 中。  
void  getDistancesToModel (const Eigen::VectorXf &model_coefficients, std::vector< double > &distances) 
//  计算从点云数据到给定二维圆周模型的所有距离。
void  selectWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold, std::vector< int > &inliers) 
//  从点云中选择所有到圆周模型model_cofficients的距离小于给定阈值threshold的点作为局内点,model_coefficients为估算出来的模型系数,threshold为点到模型的距离阈值,如果点到模型的距离在这个阈值内,视为局内点,否则为局外点,inliers存储最终输出的局内点。
virtual int  countWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold) 
//  统计点云中到圆周模型model_coefficients的距离小于阈值threshold的点的个数,并作为函数返回值返回。
void  optimizeModelCoefficients (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients) 
//  优化初始估计的模型参数,inliers为设定的局内点,model_coefficients为初始估计的模型系数,optimized_coefficients为优化后的模型系数。
void  projectPoints (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, PointCloud &projected_points, bool copy_data_fields=true) 
//  将局内点inliers投影到模型model_coefficients上创建一组新的点云projected_points,如果copy_data_fields 设为true,则投影所得到的点云不包含已经在模型上的点,因为局内点部分在模型上,部分是在距离模型允许范围内。
bool  doSamplesVerifyModel (const std::set< int > &indices, const Eigen::VectorXf &model_coefficients, const double threshold) 
//  验证一组点集索引indices中的每个子集是否适应圆周模型model_coefficients,在判断每个点是否在圆周模型上时所采用的阈值为threshold,如果所有点都在该阈值下适应圆周模型,则返回true,否则返回false.
pcl::SacModel  getModelType () const 
//  为SACMODEL__CIRCLE2D这个模型返回一个特定的编码。
virtual void  getSamples (int &iterations, std::vector< int > &samples) 
//  获取一组随机采样点数据以点云中点的索引方式存储到samples, iterations为采用随机采样一致性算法的初始迭代次数。  
virtual void  setInputCloud (const PointCloudConstPtr &cloud) 
//  设置输入点云,参数cloud指向输入点云对象。


11.Class pcl::SampleConsensusModelCone< PointT, PointNT >

类SampleConsensusModelCone< PointT, PointNT >实现了采样一致性计算的三维圆锥体模型。

#include <pcl/sample_consensus/sac_model_cone.h>
SampleConsensusModelCone (const PointCloudConstPtr &cloud, bool random=false) 
//  SampleConsensusModelCone类构造函数  
SampleConsensusModelCone (const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false) 
// SampleConsensusModelCone类构造函数
SampleConsensusModelCone (const SampleConsensusModelCone &source) 
//  复制构造函数  
virtual  ~SampleConsensusModelCone () 
//  析构函数
SampleConsensusModelCone &  operator= (const SampleConsensusModelCone &source) 
//  复制构造函数
void  setEpsAngle (double ea) 
//  该函数配合当用户设定有平行或垂直限定有关的模型类型时,设置判断是否平行或垂直时的角度阈值,ea是最大角度差,采用弧度制。
double  getEpsAngle () const 
//  该函数配合当用户设定有平行或垂直限定有关的模型类型时,获得判断是否平行或垂直时的角度阈值。
void  setAxis (const Eigen::Vector3f &ax) 
//  函数配合当用户设定与轴线平行或垂直有关的模型类型时,设置垂直或平行于所要建立模型的轴线。
Eigen::Vector3f  getAxis () const 
//  获得垂直或平行于所要建立模型的轴线。
void  setMinMaxOpeningAngle (const double &min_angle, const double &max_angle) 
//  该函数配合当用户指定模型为圆锥模型时,设置圆锥模型锥角的最小值与最大值,作为估计时的取值范围。
void  getMinMaxOpeningAngle (double &min_angle, double &max_angle) const 
//  该函数配合当用户指定模型为圆锥模型时,获得圆锥模型锥角的最小值与最大值。
void  setNormalDistanceWeight (const double w) 
//  设置法线角距离的权重,w是点到法线和模型法线之间的夹角对应的权重。
pcl::SacModel  getModelType () const 
//  为SACMODEL__CONE这个模型返回--个特定的编码。
void  setInputNormals (const PointCloudNConstPtr &normals) 
//  设置输入点云的法线,normals为指向法线的指针。
bool  computeModelCoefficients (const std::vector< int > &samples, Eigen::VectorXf &model_coefficients) 
//  检查给定的点云索引样本samples能否形成圆锥模型,实现基于这些样本估算模型参数,并将其存储到model_coefficients 中。  
void  getDistancesToModel (const Eigen::VectorXf &model_coefficients, std::vector< double > &distances) 
//  计算从点云数据到给定圆锥模型的所有距离。
void  selectWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold, std::vector< int > &inliers) 
//  从点云中选择所有到圆锥模型model_cofficients的距离小于给定阈值threshold的点作为局内点,model_coefficients为估算出来的模型系数,threshold为点到模型的距离阈值,如果点到模型的距离在这个阈值内,视为局内点,否则为局外点,inliers存储最终输出的局内点。
virtual int  countWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold) 
//  统计点云中到圆锥模型model_coefficients的距离小于阈值threshold的点的个数,并作为函数返回值返回。
void  optimizeModelCoefficients (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients) 
//  优化初始估计的模型参数,inliers为设定的局内点,model_coefficients为初始估计的模型系数,optimized_coefficients为优化后的模型系数。
void  projectPoints (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, PointCloud &projected_points, bool copy_data_fields=true) 
//  将局内点inliers投影到圆锥模型model_coefficients上创建一组新的点云projected_points,如果copy_data_fields 设为true,则投影所得到的点云不包含已经在模型上的点,因为局内点部分在模型上,部分是在距离模型允许范围内。


12.Class pcl::SampleConsensusModelCylinder< PointT, PointNT >

类SampleConsensusModelCylinder< PointT, PointNT >实现了采样一致性计算的三维圆柱体模型,SACMODEL_ CYLINDER定义为圆柱体模型,共设置7个参数[point_on_axis. x point_on_axis. y point_ on_axis. z axis_direction. x axis_direction.y axis_direction. z radius],其中,(point_on_axis. x,point_on_axis. y, point_on_ax-is. z)为轴线上点的三维坐标,(direction. x ,axis_ direction. y, axis_ direction. z)为轴线方向向量的三维坐标,radius为圆柱体半径,从点云中分割提取的内点都处在估计参数对应的圆柱体上或距离圆柱体边线的距离在一定范围内。

#include <pcl/sample_consensus/sac_model_cylinder.h>
SampleConsensusModelCylinder (const PointCloudConstPtr &cloud, bool random=false) 
//   SampleConsensusModelCylinder类构造函数  
SampleConsensusModelCylinder (const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false) 
//   SampleConsensusModelCylinder类构造函数  
SampleConsensusModelCylinder (const SampleConsensusModelCylinder &source) 
//  复制构造函数
virtual  ~SampleConsensusModelCylinder () 
//  空析构函数
SampleConsensusModelCylinder &  operator= (const SampleConsensusModelCylinder &source) 
//  复制构造函数
void  setEpsAngle (const double ea) 
//  该函数配合,当用户设定有平行或垂直限定有关的模型类型时,设置判断是否平行或垂直时的角度阈值,ea是最大角度差,采用弧度制。
double  getEpsAngle () 
//  该函数配合当用户设定有平行或垂直限定有关的模型类型时,获得判断是否平行或垂直时的角度阈值。
void  setAxis (const Eigen::Vector3f &ax) 
//  该函数配合当用户设定与轴线平行或垂直有关的模型类型时,设置垂直或平行于所要建立模型的轴线。
Eigen::Vector3f  getAxis () 
//  获得垂直或平行于所要建立模型的轴线。  
bool  computeModelCoefficients (const std::vector< int > &samples, Eigen::VectorXf &model_coefficients) 
//  检查给定的点云索引样本samples能否估计一个有效的圆柱体模型,实现基于这些样本估算模型系数并将它们存储在model_coefficients中。
void  getDistancesToModel (const Eigen::VectorXf &model_coefficients, std::vector< double > &distances) 
//  计算从点云数据到给定二维圆周模型的所有距离。
void  selectWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold, std::vector< int > &inliers) 
//  从点云中选择所有到圆柱体模型model_coefficients的距离小于给定阈值threshold的点作为局内点,modelcoefficients为估算出来的模型系数,threshold为点到模型的距离阈值,如果点到模型的距离在这个阈值内,视为局内点,否则为局外点,inliers存储最终输出的局内点。
virtual int  countWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold) 
//  统计点云中到圆柱体模型model_coefficients的距离小于阈值threshold的点的个数,并作为函数返回值返回。
void  optimizeModelCoefficients (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients) 
//  优化初始估计的模型参数,inliers为设定的局内点,model.coefficients为初始估计的模型系数,optimized_coefficients为优化后的模型系数。
void  projectPoints (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, PointCloud &projected_points, bool copy_data_fields=true) 
//  将局内点inliers投影到圆柱体模型model_cofficients.上创建一组新的点云projected_ points, 如果copy_ data_ fields 设为true, 则投影所得到的点云不包含已经在模型上的点,因为局内点部分在模型上,部分是在距离模型允许范围内。
bool  doSamplesVerifyModel (const std::set< int > &indices, const Eigen::VectorXf &model_coefficients, const double threshold) 
//  验证一组点集索引indices中的每个子集是否适应圆柱体模型model_coefficients,在判断每个点是否在圆柱体模型上时所采用的阈值为threshold,如果所有点都在该阈值下适应指定模型,则返回true,否则返回false.
pcl::SacModel  getModelType () const 
//  为SACMODEL_CYLINDER这个模型返回一个特定的编码。
virtual void  getSamples (int &iterations, std::vector< int > &samples) 
//  获取一组随机采样点数据以点云中点的索引方式存储到samples, iterations为采用随机采样一致性算法的初始迭代次数。
virtual void  setInputCloud (const PointCloudConstPtr &cloud) 
//  设置输入点云,参数cloud指向输入点云对象。
void  setRadiusLimits (const double &min_radius, const double &max_radius) 
//  该函数配合,当用户设定带有半径参数的模型类型时,设置模型半径参数的最大最小半径阈值max_radius 、min_radius.
void  setNormalDistanceWeight (const double w) 
//  设置法线角距离的权重,w是点到法线和模型法线之间的夹角对应的权重。
void  setInputNormals (const PointCloudNConstPtr &normals) 
//  设署输入点云的法线。normals为指向法线的指针


13.Class pcl::SampleConsensusModelLine< PointT > Class

类SampleConsensusModelLine实现了采样一致性计算的三维直线模型,SACMODEL_LINE 定义为直线模型,共设置6个参数[point_ on_line.x point_on_line. y point_on_line. z line_direction. x line_direction. y line_direction. z],其中(point_on_line.x, point_n_line.y, point_ on_line.z)为直线上一点的三维坐标,(line_direction.x, line_direction.y, line_ direction.z)为直线方向向量,从点云中分割提取的内点都处在估计参数对应直线上或与直线距离在一定范围内。

#include <pcl/sample_consensus/sac_model_line.h>
SampleConsensusModelLine (const PointCloudConstPtr &cloud, bool random=false) 
//  SampleConsensusModelLine类构造函数
SampleConsensusModelLine (const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false) 
//  SampleConsensusModelLine类构造函数
virtual  ~SampleConsensusModelLine () 
//  空析构函数
bool  computeModelCoefficients (const std::vector< int > &samples, Eigen::VectorXf &model_coefficients) 
//  检查给定的点云索引样本samples能否估计一个有效的直线模型,实现基于这些样本估算模型系数并将它们存储在model_coefficients中。
void  getDistancesToModel (const Eigen::VectorXf &model_coefficients, std::vector< double > &distances) 
//  计算从点云数据到给定直线模型的所有距离。  
void  selectWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold, std::vector< int > &inliers) 
//  从点云中选择所有到直线模型model_coefficients的距离小于给定阈值threshold的点作为局内点,modelcoefficients为估算出来的模型系数,threshold为点到模型的距离阈值,如果点到模型的距离在这个阈值内,视为局内点,否则为局外点,inliers存储最终输出的局内点。
virtual int  countWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold) 
//  统计点云中到直线模型model_coefficients的距离小于阈值threshold的点的个数,并作为函数返回值返回。
void  optimizeModelCoefficients (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients) 
//  优化初始估计的模型参数,inliers为设定的局内点,model_cofficients为初始估计的模型系数, optimized_coefficients 为优化后的模型系数。
void  projectPoints (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, PointCloud &projected_points, bool copy_data_fields=true) 
//  将局内点inliers投影到直线模型model_cofficients上创建一组新的点云projected_points, 如果copy_data_fields设为true,则投影所得到的点云不包含已经在模型上的点,因为局内点部分在模型上,部分是在距离模型允许范围内。
bool  doSamplesVerifyModel (const std::set< int > &indices, const Eigen::VectorXf &model_coefficients, const double threshold) 
//  验证一组点集索引indices中的每个子集是否适应直线模型model_coefficients,在判断每个点是否在直线模型上时所采用的阈值为threshold,如果所有点都在该阈值下适应直线模型,则返回true,否则返回false。
pcl::SacModel  getModelType () const 
//  为SACMODEL_ LINE这个模型返回一个特定的编码。
virtual void  getSamples (int &iterations, std::vector< int > &samples) 
//  获取一组随机采样点数据以点云中点的索引方式存储到samples, iterations为采用随机采样一致性算法的初始迭代次数。
virtual void  setInputCloud (const PointCloudConstPtr &cloud) 
//  设置输入点云,参数cloud指向输入点云对象。


14.Class pcl::SampleConsensusModelNormalParallelPlane< PointT, PointNT >

类SampleConsensusModelNormalParallelPlane实现了采样一致性计算的有曲面法线约束的三维平行平面模型,SACMODEL_NORMAL_PARALLEL_PLANE定义为有条件限制的平面模型,在规定的最大角度偏差限制下,平面模型与给定的轴线平行,参数设置参见SACMODEL_PLANE模型。

#include <pcl/sample_consensus/sac_model_normal_parallel_plane.h>
SampleConsensusModelNormalParallelPlane (const PointCloudConstPtr &cloud, bool random=false) 
//  SampleConsensusModelNormalParallelPlane构造函数
SampleConsensusModelNormalParallelPlane (const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false) 
//  SampleConsensusModelNormalParallelPlane构造函数
virtual  ~SampleConsensusModelNormalParallelPlane () 
//  空析构函数
void  setAxis (const Eigen::Vector3f &ax) 
//  该函数配合当用户设定与轴线平行或垂直有关的模型类型时,设置垂直或平行于所要建立模型的轴线。
Eigen::Vector3f  getAxis () 
//  获得垂直或平行于所要建立模型的轴线。
void  setEpsAngle (const double ea) 
//  该函数配合当用户设定有平行或垂直限定有关的模型类型时,设置判断是否平行或垂直时的角度阈值,ea是最大角度差,采用弧度制。
double  getEpsAngle () 
//  获得判断是否平行或垂直时的角度阈值。
void  setDistanceFromOrigin (const double d) 
//  该函数配合当用户指定模型为平面模型时,设定原点到平面模型的距离为d。
double  getDistanceFromOrigin () 
//  获得原点到平面模型的距离为。
void  setEpsDist (const double delta) 
//  设置距离阈值,delta为原点到模型的距离的阈值。
double  getEpsDist () 
//  获得原点到模型的距离的阈值。
virtual int  countWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold) 
//  统计点云中到平面模型model_cofficients的距离小于阈值threshold的点的个数,并作为函数返回值返回。
pcl::SacModel  getModelType () const 
//  为SACMODEL_ _NORMAL_ PARALLEL_ PLANE这个模型返回一个特定的编码.
bool  computeModelCoefficients (const std::vector< int > &samples, Eigen::VectorXf &model_coefficients) 
//  纯虚函数检查给定的点云索引样本samples能否估计一个有效的平面模型,实现基于这些样本估算模型系数并将它们存储在model_coefficients中。
void  selectWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold, std::vector< int > &inliers) 
//  从点云中选择所有到给定平面模型model_coefficients的距离小于给定阈值threshold的点作为局内点,model_cofficients为估算出来的模型系数,threshold为点到模型的距离阈值,如果点到模型的距离在这个阈值内,视为局内点,否则为局外点,inliers存储最终输出的局内点。
void  optimizeModelCoefficients (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients) 
//  优化初始估计的模型参数,inliers为设定的局内点,model_cofficients为初始估计的模型系数,optimized_coefficients为优化后的模型系数。
void  projectPoints (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, PointCloud &projected_points, bool copy_data_fields=true) 
//  将局内点inliers投影到平面模型model_cofficients上创建一组新的点云projected_points, 如果copy_data_fields设为true,则投影所得到的点云不包含已经在模型上的点,因为局内点部分在模型上,部分是在距离模型允许范围内。
bool  doSamplesVerifyModel (const std::set< int > &indices, const Eigen::VectorXf &model_coefficients, const double threshold) 
//  验证一组点集索引indices中的每个子集是否适应平面模型model_coefficients,在判断每个点是否在平面模型上时所采用的阈值为threshold,如果所有点都在该阈值下适应指定模型,则返回true,否则返回false.
virtual void  getSamples (int &iterations, std::vector< int > &samples) 
//  获取一组随机采样点数据以点云中点的索引方式存储到samples, iterations为采用随机采样一致性算法的初始迭代次数。
virtual void  setInputCloud (const PointCloudConstPtr &cloud) 
//  设置输入点云,参数cloud指向输入点云对象。
    

15.Class pcl::SampleConsensusModelNormalPlane< PointT, PointNT >

类SampleConsensusModelNormalPlane< PointT, PointNT >实现了采样一致性计算的有曲面法线约束的三维平面模型,SACMODEL_NORMAL_PLANE模型定义为有条件限制的平面模型,在规定的最大角度偏差限制下,每一个局内点的法线必须与估计的平面模型的法线平行,参数设置参见SACMODEL_PLANE模型。

//  统计点云中到平面模型model_cofficients的距离小于阈值threshold的点的个数,并作为函数返回值返回。#include <pcl/sample_consensus/sac_model_normal_plane.h>
SampleConsensusModelNormalPlane (const PointCloudConstPtr &cloud, bool random=false) 
//  SampleConsensusModelNormalPlane类构造函数
SampleConsensusModelNormalPlane (const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false) 
//  SampleConsensusModelNormalPlane类构造函数
virtual  ~SampleConsensusModelNormalPlane () 
//  空析构函数
void  selectWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold, std::vector< int > &inliers) 
//  从点云中选择所有到给定平面模型model_coefficients的距离小于给定阈值threshold的点作为局内点,model_cofficients为估算出来的模型系数,threshold为点到模型的距离阈值,如果点到模型的距离在这个阈值内,视为局内点,否则为局外点,inliers存储最终输出的局内点。
virtual int  countWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold) 
//  统计点云中到平面模型model_cofficients的距离小于阈值threshold的点的个数,并作为函数返回值返回。
void  getDistancesToModel (const Eigen::VectorXf &model_coefficients, std::vector< double > &distances) 
//  计算从点云数据到给定平面模型的所有距离。  
pcl::SacModel  getModelType () const 
//  为SACMODEL_NORMAL_PLANE这个模型返回一个特定的编码。
bool  computeModelCoefficients (const std::vector< int > &samples, Eigen::VectorXf &model_coefficients) 
//  纯虚函数,检查给定的点云索引样本samples能否估计一个有效的平面模型,实现基于这些样本估算模型系数并将它们存储在model_coefficients中。
void  optimizeModelCoefficients (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients) 
//  优化初始估计的模型参数,inliers为设定的局内点,model_cofficients为初始估计的模型系数,optimized_ coefficients为优化后的模型系数。
void  projectPoints (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, PointCloud &projected_points, bool copy_data_fields=true) 
//  将局内点inliers投影到平面模型model_coefficients.上创建一组新的点云projected_points, 如果copy_data_fields 设为true,则投影所得到的点云不包含已经在模型上的点,因为局内点部分在模型上,部分是在距离模型允许范围内。
bool  doSamplesVerifyModel (const std::set< int > &indices, const Eigen::VectorXf &model_coefficients, const double threshold) 
//  验证一组点集索引indices中的每个子集是否适应给定的平面模型model_coefficients,在判断每个点是否在给定模型上时所采用的阈值为threshold,如果所有点都在该阈值下适应指定模型,则返回true,否则返回false。
virtual void  getSamples (int &iterations, std::vector< int > &samples) 
//  获取一组随机采样点数据以点云中点的索引方式存储到samples , iterations为采用随机采样一致性算法的初始迭代次数。
virtual void  setInputCloud (const PointCloudConstPtr &cloud) 
//  设置输入点云,参数cloud指向输入点云对象。


16.Class pcl::SampleConsensusModelNormalSphere< PointT, PointNT >

类SampleConsensusModelNormalSphere< PointT, PointNT >实现了采样一致性算法的有曲面法线约束的三维球体模型。

#include <pcl/sample_consensus/sac_model_normal_sphere.h>
SampleConsensusModelNormalSphere (const PointCloudConstPtr &cloud, bool random=false) 
//  SampleConsensusModelNormalSphere类构造函数
SampleConsensusModelNormalSphere (const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false) 
//  SampleConsensusModelNormalSphere.类构造函数
virtual  ~SampleConsensusModelNormalSphere () 
//  空析构函数
void  selectWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold, std::vector< int > &inliers) 
//  从点云中选择所有到给定球体模型model_coefficients的距离小于给定阈值threshold的点作为局内点,model_cofficients为估算出来的模型系数,threshold为点到模型的距离阈值,如果点到模型的距离在这个阈值内,视为局内点,否则为局外点,inliers存储最终输出的局内点。
virtual int  countWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold) 
//  统计点云中到球体模型model_cofficients的距离小于阈值threshold的点的个数,并作为函数返回值返回。
void  getDistancesToModel (const Eigen::VectorXf &model_coefficients, std::vector< double > &distances) 
//  计算从点云数据到给定平面模型的所有距离  
pcl::SacModel  getModelType () const 
//  为SACMODEL_NORMAL_SPHERE这个模型返回一个特定的编码。
bool  computeModelCoefficients (const std::vector< int > &samples, Eigen::VectorXf &model_coefficients) 
//  检查给定的点云索引样本samples能否估计一个有效的球体模型,实现基于这些样本估算模型系数并将它们存储在model_coefficients中。


17.Class pcl::SampleConsensusModelParallelLine< PointT >

类SampleConsensusModelParallelLine实现采样一致性计算的有角度约束的三维直线模型,SACMODEL_PARALLEL_LINE模型定义为有条件限制的直线模型,在规定的最大角度偏差限制下,直线模型与给定轴线平行,其参数设置参见SACMODEL_LINE模型。

#include <pcl/sample_consensus/sac_model_parallel_line.h>
SampleConsensusModelParallelLine (const PointCloudConstPtr &cloud, bool random=false) 
//  SampleConsensusModelParallelLine类构造函数
  SampleConsensusModelParallelLine (const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false) 
//  SampleConsensusModelParallelLine类构造函数
virtual  ~SampleConsensusModelParallelLine () 
//  空析构函数
void  setAxis (const Eigen::Vector3f &ax) 
//  该函数配合当用户设定与轴线平行或垂直有关的模型类型时,设置垂直或平行于所要建立模型的轴线。
Eigen::Vector3f  getAxis () const 
//  获得垂直或平行于所要建立模型的轴线。
void  setEpsAngle (const double ea) 
//  该函数配合当用户设定有平行或垂直限定有关的模型类型时,设置判断是否平行或垂直时的角度阈值,ea是最大角度差,采用弧度制。
double  getEpsAngle () const 
//  获得判断是否平行或垂直时的角度阈值。
bool  computeModelCoefficients (const std::vector< int > &samples, Eigen::VectorXf &model_coefficients) 
//  检查给定的点云索引样本samples能否估计一个有效的直线模型,实现基于这些样本估算模型系数并将它们存储在model_coefficients中。
void  selectWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold, std::vector< int > &inliers) 
//  从点云中选择所有到给定直线模型model_coefficients的距离小于给定阈值threshold的点作为局内点,model_cofficients为估算出来的模型系数,threshold为点到模型的距离阈值,如果点到模型的距离在这个阈值内,视为局内点,否则为局外点,inliers存储最终输出的局内点。
virtual int  countWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold) 
//  统计点云中到直线模型model_cofficients的距离小于阈值threshold的点的个数,并作为函数返回值返回。
void  getDistancesToModel (const Eigen::VectorXf &model_coefficients, std::vector< double > &distances) 
//  计算从点云数据到给定球体模型的所有距离  
pcl::SacModel  getModelType () const 
//  为SACMODEL_PARALLEL_LINE这个模型返回一个特定的编码。


18.Class pcl::SampleConsensusModelParallelPlane< PointT >

类SampleConsensusModelParallelPlane< PointT >实现随机采样一致性计算的有角度约束的三维平面模型,SACMODEL_PARALLEL_ PLANE模型:定义为有条件限制的平面模型,在规定的最大角度偏差限制下,平面模型与给定的轴线平行,参数设置参见SACMODEL_PLANE模型。

#include <pcl/sample_consensus/sac_model_parallel_plane.h>
SampleConsensusModelParallelPlane (const PointCloudConstPtr &cloud, bool random=false) 
//  SampleConsensusModelParallelPlane构造函数
  SampleConsensusModelParallelPlane (const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false) 
//  SampleConsensusModelParallelPlane构造函数
virtual  ~SampleConsensusModelParallelPlane () 
//  空析构函数
void  setAxis (const Eigen::Vector3f &ax) 
//  该函数配合当用户设定与轴线平行或垂直有关的模型类型时,设置垂直或平行于所要建立模型的轴线。
Eigen::Vector3f  getAxis () 
//  获得垂直或平行于所要建立模型的轴线。
void  setEpsAngle (const double ea) 
//  该函数配合当用户设定有平行或垂直限定有关的模型类型时,设置判断是否平行或垂直时的角度阈值,ea是最大角度差,采用弧度制。
double  getEpsAngle () 
//  获得判断是否平行或垂直时的角度阈值
void  selectWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold, std::vector< int > &inliers) 
//  从点云中选择所有到给定平面模型model_coefficients的距离小于给定阈值threshold的点作为局内点,model_cofficients为估算出来的模型系数,threshold为点到模型的距离阈值,如果点到模型的距离在这个阈值内,视为局内点,否则为局外点,inliers存储最终输出的局内点。
virtual int  countWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold) 
//  统计点云中到平面模型model_cofficients的距离小于阈值threshold的点的个数,并作为函数返回值返回。
void  getDistancesToModel (const Eigen::VectorXf &model_coefficients, std::vector< double > &distances) 
//  计算从点云数据到给定平面模型的所有距离。  
pcl::SacModel  getModelType () const 
//  为SACMODEL_PARALLEL_PLANE这个模型返回一个特定的编码。
bool  computeModelCoefficients (const std::vector< int > &samples, Eigen::VectorXf &model_coefficients) 
//  纯虚函数,检查给定的点云索引样本samples能否估计一个有效的平面模型,实现基于这些样本估算模型系数并将它们存储在model_coefficients中。
void  optimizeModelCoefficients (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients) 
//  优化初始估计的模型参数,inliers为设定的局内点,model_cofficients为初始估计的模型系数,optimized_coefficients为优化后的模型系数。
void  projectPoints (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, PointCloud &projected_points, bool copy_data_fields=true) 
//  将局内点inliers投影到平面模型model_coefficients.上创建一组新的点云projected_points, 如果copy_data_fields 设为true,则投影所得到的点云不包含已经在模型上的点,因为局内点部分在模型上,部分是在距离模型允许范围内。
bool  doSamplesVerifyModel (const std::set< int > &indices, const Eigen::VectorXf &model_coefficients, const double threshold) 
//  验证一组点集索引indices中的每个子集是否适应给定的平面模型model_coefficients,在判断每个点是否在给定模型上时所采用的阈值为threshold,如果所有点都在该阈值下适应指定模型,则返回true,否则返回false。

19.Class pcl::SampleConsensusModelPerpendicularPlane< PointT >

类SampleConsensusModelPerpendicularPlane< PointT >实现了采样一致性计算的有角度约束的三维平面模型,这个平面必须与用户定义的轴线垂直,并取决于用户定义的角度阈值范围。注意必须定义一个大于0的角度值作为约束条件。

20.Class pcl::SampleConsensusModelPlane< PointT >

类SampleConsensusModelPlane< PointT >是实现采样一致性计算的三维平面模型分割基类,SACMODEL_PLANE定义为平面模型,共设置4个参数[ normal_x,normal y, normal_ z, d],其中(normal_ x, normal_ y, normal_ z) 为Hessian 范式中法向量的坐标及常量d值,ax+by+cz+d=0,从点云中分割提取的内点都处在估计参数对应的平面上或与平面距离在一定范围内。

#include <pcl/sample_consensus/sac_model_plane.h>
SampleConsensusModelPlane (const PointCloudConstPtr &cloud, bool random=false) 
//  SampleConsensusModelPlane类构造函数
SampleConsensusModelPlane (const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false) 
//  SampleConsensusModelPlane类构造函数
virtual  ~SampleConsensusModelPlane () 
//  空析构函数
bool  computeModelCoefficients (const std::vector< int > &samples, Eigen::VectorXf &model_coefficients) 
//  检查给定的点云索引样本samples能否估计一个有效的平面模型,实现基于这些样本估算模型系数并将它们存储在model_coefficients中。
void  getDistancesToModel (const Eigen::VectorXf &model_coefficients, std::vector< double > &distances) 
//  计算从点云数据到给定平面模型的所有距离。
void  selectWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold, std::vector< int > &inliers) 
//  从点云中选择所有到平面模型model_coefficients的距离小于给定阈值threshold的点作为局内点,model_coefficients为估算出来的模型系数,threshold为点到模型的距离阈值,如果点到模型的距离在这个阈值内,视为局内点,否则为局外点,inliers存储最终输出的局内点。
virtual int  countWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold) 
//  统计点云中到平面模型model_cofficients的距离小于阈值threshold的点的个数,并作为函数返回值返回。
void  optimizeModelCoefficients (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients) 
//  优化初始估计的模型参数,inliers为设定的局内点,model_cofficients为初始估计的模型系数,optimized_coefficients为优化后的模型系数。
void  projectPoints (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, PointCloud &projected_points, bool copy_data_fields=true) 
//  将局内点inliers投影到平面模型model_coefficients上创建一组新的点云projected_ points, 如果copy_ data_ fields 设为true,则投影所得到的点云不包含已经在模型上的点,因为局内点部分在模型上,部分是在距离模型允许范围内。
bool  doSamplesVerifyModel (const std::set< int > &indices, const Eigen::VectorXf &model_coefficients, const double threshold) 
//  验证一组点集索引indices中的每个子集是否适应给定的平面模型model_coefficients,在判断每个点是否在给定模型上时所采用的阈值为threshold,如果所有点都在该阈值下适应指定模型,则返回true,否则返回false.
pcl::SacModel  getModelType () const 
//  为SACMODEL_PLANE这个模型返回一个特定的编码。
virtual void  getSamples (int &iterations, std::vector< int > &samples) 
//  获取一组随机采样点数据以点云中点的索引方式存储到samples,iterations为采用随机采样一致性算法的初始迭代次数。


21.Class pcl::SampleConsensusModelRegistration< PointT >

类SampleConsensusModelRegistration< PointT >实现了配准时的对应点剔除模型。

#include <pcl/sample_consensus/sac_model_registration.h>
SampleConsensusModelRegistration (const PointCloudConstPtr &cloud, bool random=false) 
//  SampleConsensusModelRegistration类构造函数
SampleConsensusModelRegistration (const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false) 
//  SampleConsensusModelRegistration类构造函数
virtual  ~SampleConsensusModelRegistration () 
//  析构函数
virtual void  setInputCloud (const PointCloudConstPtr &cloud) 
//  设置输入点云,参数cloud指向输入点云对象。
void  setInputTarget (const PointCloudConstPtr &target) 
//  设置目标点云target
void  setInputTarget (const PointCloudConstPtr &target, const std::vector< int > &indices_tgt) 
//  设置目标点云target,indices_tgt为指向目标点云的索引向量
bool  computeModelCoefficients (const std::vector< int > &samples, Eigen::VectorXf &model_coefficients) 
//  创建点云索引样本samples的4X4刚体变换矩阵,实现基于这些样本估算模型系数并将它们存储在model_ coefficients中。
void  getDistancesToModel (const Eigen::VectorXf &model_coefficients, std::vector< double > &distances) 
//  计算从变换点到其对应点的所有距离。
void  selectWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold, std::vector< int > &inliers) 
//  从点云中选择所有到模型model_coefficients的距离小于给定阈值threshold的点作为局内点,model_coefficients为估算出来的模型系数,threshold为点到模型的距离阈值,如果点到模型的距离在这个阈值内,视为局内点,否则为局外点,inliers存储最终输出的局内点。 
virtual int  countWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold) 
//  统计点云中到模型model_cofficients的距离小于阈值threshold的点的个数,并作为函数返回值返回。  
void  optimizeModelCoefficients (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients) 
//  优化初始估计的4X4刚体变换矩阵,inliers为设定的局内点,model_coefficients为初始估计的模型系数,optimized_ cofficients 为优化后的模型系数。
void  projectPoints (const std::vector< int > &, const Eigen::VectorXf &, PointCloud &, bool=true) 
//  将局内点inliers投影到模型model_cofficients 上创建一组新的点云projected_points,如果copy_data_fields设为true, 则投影所得到的点云不包含已经在模型上的点,因为局内点部分在模型上,部分是在距离模型允许范围内。
bool  doSamplesVerifyModel (const std::set< int > &, const Eigen::VectorXf &, const double) 
//  验证一组点集索引indices中的每个子集是否适应给定的模型model_coefficients,在判断每个点是否在给定模型上时所采用的阈值为threshold,如果所有点都在该阈值下适应指定模型,则返回true,否则返回false。
pcl::SacModel  getModelType () const 
//  为SSACMODEL_REGISTRATION这个模型返回一个特定的编码,此模型PC中还未实现。
virtual void  getSamples (int &iterations, std::vector< int > &samples) 
//  获取一组随机采样点数据以点云中点的索引方式存储到samples,iterations为采用随机采样一致性算法的初始迭代次数。


22.Class pcl::SampleConsensusModelSphere< PointT >

类SampleConsensusModelSphere< PointT >实现了采样一致性计算的三维球体模型,SACMODEL_ SPHERE 模型定义为三维球体模型,共设置4个参数[center.x, center. y, center. z, radius],其中(center. x, center. y, center. z)为球体中心的三维坐标,radius为球体半径,从点云中分割提取的内点都处在估计参数对应的球体上或距离球体边线的距离在一定范围内。

#include <pcl/sample_consensus/sac_model_sphere.h>
SampleConsensusModelSphere (const PointCloudConstPtr &cloud, bool random=false) 
//  SampleConsensusModelSphere类构造函数
SampleConsensusModelSphere (const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false) 
//  SampleConsensusModelSphere类构造函数
virtual  ~SampleConsensusModelSphere () 
//  析构函数
SampleConsensusModelSphere (const SampleConsensusModelSphere &source) 
//  复制构造函数
SampleConsensusModelSphere &  operator= (const SampleConsensusModelSphere &source) 
//  复制构造函数
bool  computeModelCoefficients (const std::vector< int > &samples, Eigen::VectorXf &model_coefficients) 
//  纯虚函数,检查给定的点云索引样本samples能否估计一个有效的球体模型,实现基于这些样本估算模型系数并将它们存储在model_coefficients中。 
void  getDistancesToModel (const Eigen::VectorXf &model_coefficients, std::vector< double > &distances) 
//  计算从点云数据到给定球体模型的所有距离  
void  selectWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold, std::vector< int > &inliers) 
//  从点云中选择所有到球体模型model_coefficients的距离小于给定阈值threshold的点作为局内点,model_coefficients为估算出来的模型系数,threshold为点到模型的距离阈值,如果点到模型的距离在这个阈值内,视为局内点,否则为局外点,inliers存储最终输出的局内点。
virtual int  countWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold) 
//  统计点云中到球体模型model_coefficients的距离小于阈值threshold的点的个数,并作为函数返回值返回。
void  optimizeModelCoefficients (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients) 
//  优化初始估计的模型参数,inliers为设定的局内点,model_cofficients为初始估计的模型系数,optimized_coefficients 为优化后的模型系数。
void  projectPoints (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, PointCloud &projected_points, bool copy_data_fields=true) 
//  将局内点inliers投影到模型model_ coefficients. 上创建一组新的点云projected_points,如果copy_data_fields 设为true, 则投影所得到的点云不包含已经在模型上的点,因为局内点部分在模型上,部分是在距离模型允许范围内。
bool  doSamplesVerifyModel (const std::set< int > &indices, const Eigen::VectorXf &model_coefficients, const double threshold) 
//  验证一组点集索引indices中的每个子集是否适应给定的模型model_coefficients,在判断每个点是否在给定模型上时所采用的阈值为threshold,如果所有点都在该阈值下适应指定模型,则返回true,否则返回false.
pcl::SacModel  getModelType () const 
//  为SACMODEL_SPHERE这个模型返回一个特定的编码。
virtual void  getSamples (int &iterations, std::vector< int > &samples) 
//  获取一组随机采样点数据以点云中点的索引方式存储到samples,iterations为采用随机采样一致性算法的初始迭代次数。

23.Class pcl::SampleConsensusModelStick< PointT >

类SampleConsensusModelStick< PointT >实现了采样一致性计算的三维棒状模型,棒状物定义为有用户给定最大和最小宽度的线。类SampleConsensusModelStick< PointT >关键成员函数关键函数参考其基类SampleConsensusModel。

24.pcl_sample_consensus 模块其他关键成员说明

#include <sac_model_plane.h>
double  pcl::pointToPlaneDistanceSigned (const Point &p, double a, double b, double c, double d) 
//  获取点到平面的距离(带符号的)定义为ax+by+cz+d=0。
template<typename Point >  
double  pcl::pointToPlaneDistanceSigned (const Point &p, const Eigen::Vector4f &plane_coefficients) 
//  获取点到平面的距离(带符号的),定义为ax+by+cz+d=0, plane_coefficients是标准的平面参数,P代表一个点。
template<typename Point >  
double  pcl::pointToPlaneDistance (const Point &p, double a, double b, double c, double d) 
//  获取点到平面的距离(不带符号的)定义为ax+by+cz+d=0。
template<typename Point >  
double  pcl::pointToPlaneDistance (const Point &p, const Eigen::Vector4f &plane_coefficients) 
//  获取点到平面的距离(不带符号的),定义为ax+by+cz+d=0。


  • 5
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
PCL学习教程是关于点云库(Point Cloud Library)的教程,该库可以用于处理和分析来自传感器的三维点云数据。学习PCL的教程通常包括以下内容: 1. 安装PCL:首先,你需要安装PCL库及其依赖项。具体的安装方法可以参考PCL官方网站上的文档。 2. 点云数据的读取和可视化:学习如何读取和可视化点云数据是PCL学习的第一步。使用PCL提供的函数和类,你可以读取来自传感器的点云数据,并将其可视化以便观察和分析。 3. 点云滤波:PCL提供了各种滤波器,用于去除点云中的噪声、采样和下采样,以及提取感兴趣的特征。 4. 特征提取:学习如何从点云中提取表面特征,例如平面、曲率、法线等。 5. 点云配准:点云配准是将多个点云对齐到一个共同的坐标系中的过程。PCL提供了各种配准算法,包括ICP(迭代最近点)和SAC-IA(随机一致性),用于实现点云的配准。 6. 点云分割:点云分割是将点云分成多个不同的部分或对象的过程。PCL提供了各种分割算法,例如基于颜色、法线、平面模型等的分割算法。 7. 点云配准和分割的应用:学习如何将点云配准和分割应用于实际问题,例如机器人导航、三维重建和目标检测等。 在学习PCL时,你可以通过阅读PCL官方文档、实践示例代码和参加相关培训课程等方式来深入了解和掌握PCL库的使用。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值