Go to the documentation of this file.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
00039 #ifndef PCL_REGISTRATION_CORRESPONDENCE_REJECTION_VAR_TRIMMED_H_
00040 #define PCL_REGISTRATION_CORRESPONDENCE_REJECTION_VAR_TRIMMED_H_
00041
00042 #include <pcl/registration/correspondence_rejection.h>
00043 #include <pcl/point_cloud.h>
00044
00045 #include <vector>
00046
00047 namespace pcl
00048 {
00049 namespace registration
00050 {
00064 class PCL_EXPORTS CorrespondenceRejectorVarTrimmed: public CorrespondenceRejector
00065 {
00066 using CorrespondenceRejector::input_correspondences_;
00067 using CorrespondenceRejector::rejection_name_;
00068 using CorrespondenceRejector::getClassName;
00069
00070 public:
00071 typedef boost::shared_ptr<CorrespondenceRejectorVarTrimmed> Ptr;
00072 typedef boost::shared_ptr<const CorrespondenceRejectorVarTrimmed> ConstPtr;
00073
00075 CorrespondenceRejectorVarTrimmed () :
00076 trimmed_distance_ (0),
00077 factor_ (),
00078 min_ratio_ (0.05),
00079 max_ratio_ (0.95),
00080 lambda_ (0.95),
00081 data_container_ ()
00082 {
00083 rejection_name_ = "CorrespondenceRejectorVarTrimmed";
00084 }
00085
00090 void
00091 getRemainingCorrespondences (const pcl::Correspondences& original_correspondences,
00092 pcl::Correspondences& remaining_correspondences);
00093
00095 inline double
00096 getTrimmedDistance () const { return trimmed_distance_; };
00097
00102 template <typename PointT> inline void
00103 setInputSource (const typename pcl::PointCloud<PointT>::ConstPtr &cloud)
00104 {
00105 if (!data_container_)
00106 data_container_.reset (new DataContainer<PointT>);
00107 boost::static_pointer_cast<DataContainer<PointT> > (data_container_)->setInputSource (cloud);
00108 }
00109
00114 template <typename PointT> inline void
00115 setInputCloud (const typename pcl::PointCloud<PointT>::ConstPtr &cloud)
00116 {
00117 PCL_WARN ("[pcl::registration::%s::setInputCloud] setInputCloud is deprecated. Please use setInputSource instead.\n", getClassName ().c_str ());
00118 if (!data_container_)
00119 data_container_.reset (new DataContainer<PointT>);
00120 boost::static_pointer_cast<DataContainer<PointT> > (data_container_)->setInputSource (cloud);
00121 }
00122
00127 template <typename PointT> inline void
00128 setInputTarget (const typename pcl::PointCloud<PointT>::ConstPtr &target)
00129 {
00130 if (!data_container_)
00131 data_container_.reset (new DataContainer<PointT>);
00132 boost::static_pointer_cast<DataContainer<PointT> > (data_container_)->setInputTarget (target);
00133 }
00134
00142 template <typename PointT> inline void
00143 setSearchMethodTarget (const boost::shared_ptr<pcl::search::KdTree<PointT> > &tree,
00144 bool force_no_recompute = false)
00145 {
00146 boost::static_pointer_cast< DataContainer<PointT> >
00147 (data_container_)->setSearchMethodTarget (tree, force_no_recompute );
00148 }
00149
00151 inline double
00152 getTrimFactor () const { return factor_; }
00153
00157 inline void
00158 setMinRatio (double ratio) { min_ratio_ = ratio; }
00159
00162 inline double
00163 getMinRatio () const { return min_ratio_; }
00164
00168 inline void
00169 setMaxRatio (double ratio) { max_ratio_ = ratio; }
00170
00173 inline double
00174 getMaxRatio () const { return max_ratio_; }
00175
00176 protected:
00177
00181 inline void
00182 applyRejection (pcl::Correspondences &correspondences)
00183 {
00184 getRemainingCorrespondences (*input_correspondences_, correspondences);
00185 }
00186
00189 double trimmed_distance_;
00190
00195 double factor_;
00196
00199 double min_ratio_;
00200
00203 double max_ratio_;
00204
00207 double lambda_;
00208
00209 typedef boost::shared_ptr<DataContainerInterface> DataContainerPtr;
00210
00212 DataContainerPtr data_container_;
00213
00214 private:
00215
00218 inline float optimizeInlierRatio (std::vector <double> &dists);
00219 };
00220 }
00221 }
00222
00223 #include <pcl/registration/impl/correspondence_rejection_var_trimmed.hpp>
00224
00225 #endif // PCL_REGISTRATION_CORRESPONDENCE_REJECTION_VAR_TRIMMED_H_