00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef PCL_SAMPLE_CONSENSUS_MLESAC_H_
00039 #define PCL_SAMPLE_CONSENSUS_MLESAC_H_
00040
00041 #include <pcl/sample_consensus/sac.h>
00042 #include <pcl/sample_consensus/sac_model.h>
00043
00044 namespace pcl
00045 {
00047
00053 template <typename PointT>
00054 class MaximumLikelihoodSampleConsensus : public SampleConsensus<PointT>
00055 {
00056 using SampleConsensus<PointT>::max_iterations_;
00057 using SampleConsensus<PointT>::threshold_;
00058 using SampleConsensus<PointT>::iterations_;
00059 using SampleConsensus<PointT>::sac_model_;
00060 using SampleConsensus<PointT>::model_;
00061 using SampleConsensus<PointT>::model_coefficients_;
00062 using SampleConsensus<PointT>::inliers_;
00063 using SampleConsensus<PointT>::probability_;
00064
00065 typedef typename SampleConsensusModel<PointT>::Ptr SampleConsensusModelPtr;
00066 typedef typename SampleConsensusModel<PointT>::PointCloudConstPtr PointCloudConstPtr;
00067
00068 public:
00072 MaximumLikelihoodSampleConsensus (const SampleConsensusModelPtr &model) : SampleConsensus<PointT> (model),
00073 iterations_EM_ (3)
00074 {
00075
00076 max_iterations_ = 10000;
00077 }
00078
00083 MaximumLikelihoodSampleConsensus (const SampleConsensusModelPtr &model, double threshold) : SampleConsensus<PointT> (model, threshold),
00084 iterations_EM_ (3)
00085 {
00086
00087 max_iterations_ = 10000;
00088 }
00089
00093 bool computeModel (int debug_verbosity_level = 0);
00094
00098 inline void setEMIterations (int iterations) { iterations_EM_ = iterations; }
00099
00101 inline int getEMIterations () { return (iterations_EM_); }
00102
00103
00104 protected:
00114 double computeMedianAbsoluteDeviation (const PointCloudConstPtr &cloud, const IndicesPtr &indices, double sigma);
00115
00122 void getMinMax (const PointCloudConstPtr &cloud, const IndicesPtr &indices, Eigen::Vector4f &min_p, Eigen::Vector4f &max_p);
00123
00129 void computeMedian (const PointCloudConstPtr &cloud, const IndicesPtr &indices, Eigen::Vector4f &median);
00130
00131 private:
00133 int iterations_EM_;
00135 double sigma_;
00136 };
00137 }
00138
00139 #endif //#ifndef PCL_SAMPLE_CONSENSUS_MLESAC_H_