SACSegmentation封装了多种Ransac方法,包括:
RandomSampleConsensus,
LeastMedianSquares,
MEstimatorSampleConsensus
ProgressiveSampleConsensus,
RandomizedRandomSampleConsensus,
RandomizedMEstimatorSampleConsensus,
MaximumLikelihoodSampleConsensus
1.PCL所谓的平行线判断,是已知一个法向量,判断面与之平行。
2.PCL直线Ransac拟合,为啥只需要设置一个距离阈值?因为默认值迭代50次
templatevoidpcl::SACSegmentation ::initSAC (const int method_type){ if (sac_) sac_.reset (); // Build the sample consensus method switch (method_type) { case SAC_RANSAC: default: { PCL_DEBUG ("[pcl::%s::initSAC] Using a method of type: SAC_RANSAC with a model threshold of %f\n", getClassName ().c_str (), threshold_); sac_.reset (new RandomSampleConsensus (model_, threshold_)); break; } case SAC_LMEDS: { PCL_DEBUG ("[pcl::%s::initSAC] Using a method of type: SAC_LMEDS with a model threshold of %f\n", getClassName ().c_str (), threshold_); sac_.reset (new LeastMedianSquares (model_, threshold_)); break; } case SAC_MSAC: { PCL_DEBUG ("[pcl::%s::initSAC] Using a method of type: SAC_MSAC with a model threshold of %f\n", getClassName ().c_str (), threshold_); sac_.reset (new MEstimatorSampleConsensus (model_, threshold_)); break; } case SAC_RRANSAC: { PCL_DEBUG ("[pcl::%s::initSAC] Using a method of type: SAC_RRANSAC with a model threshold of %f\n", getClassName ().c_str (), threshold_); sac_.reset (new RandomizedRandomSampleConsensus (model_, threshold_)); break; } case SAC_RMSAC: { PCL_DEBUG ("[pcl::%s::initSAC] Using a method of type: SAC_RMSAC with a model threshold of %f\n", getClassName ().c_str (), threshold_); sac_.reset (new RandomizedMEstimatorSampleConsensus (model_, threshold_)); break; } case SAC_MLESAC: { PCL_DEBUG ("[pcl::%s::initSAC] Using a method of type: SAC_MLESAC with a model threshold of %f\n", getClassName ().c_str (), threshold_); sac_.reset (new MaximumLikelihoodSampleConsensus (model_, threshold_)); break; } case SAC_PROSAC: { PCL_DEBUG ("[pcl::%s::initSAC] Using a method of type: SAC_PROSAC with a model threshold of %f\n", getClassName ().c_str (), threshold_); sac_.reset (new ProgressiveSampleConsensus (model_, threshold_)); break; } } // Set the Sample Consensus parameters if they are given/changed if (sac_->getProbability () != probability_) { PCL_DEBUG ("[pcl::%s::initSAC] Setting the desired probability to %f\n", getClassName ().c_str (), probability_); sac_->setProbability (probability_); } if (max_iterations_ != -1 && sac_->getMaxIterations () != max_iterations_) { PCL_DEBUG ("[pcl::%s::initSAC] Setting the maximum number of iterations to %d\n", getClassName ().c_str (), max_iterations_); sac_->setMaxIterations (max_iterations_); } if (samples_radius_ > 0.) { PCL_DEBUG ("[pcl::%s::initSAC] Setting the maximum sample radius to %f\n", getClassName ().c_str (), samples_radius_); // Set maximum distance for radius search during random sampling model_->setSamplesMaxDist (samples_radius_, samples_radius_search_); }}