Go to the documentation of this file.00001
00064 #ifndef REGISTRATION_ICP_H_
00065 #define REGISTRATION_ICP_H_
00066
00067 #include "general_registration.h"
00068 #include "impl/modified_icp.hpp"
00069 #include "feature_container.h"
00070 #include <pcl/point_cloud.h>
00071
00072 #include <Eigen/Core>
00073 #include <pcl/io/io.h>
00074 #include <pcl/kdtree/kdtree_flann.h>
00075 #include <pcl/registration/ia_ransac.h>
00076 #include <pcl/sample_consensus/sac_model_plane.h>
00077 #include <pcl/io/pcd_io.h>
00078 #include <pcl/registration/icp.h>
00079 #include <pcl/features/fpfh.h>
00080 #include <pcl/features/normal_3d.h>
00081
00082 namespace cob_3d_registration {
00083
00088 template <typename Point>
00089 class Registration_ICP : public GeneralRegistration<Point>
00090 {
00091 public:
00092 Registration_ICP():
00093 icp_max_iterations_(50),
00094 icp_max_corr_dist_(0.05),
00095 outlier_rejection_threshold_(0.01),
00096 icp_trf_epsilon_(0.0001),
00097 non_linear_(false),
00098 use_only_last_refrence_(false),
00099 use_gicp_(false)
00100 {}
00101
00103 void setNonLinear(bool b) {non_linear_=b;}
00104
00106 void setUseOnlyLastReference(bool b) {use_only_last_refrence_=b;}
00107
00109 void setUseGICP(bool b) {
00110 use_gicp_=b;
00111 #ifndef GICP_ENABLE
00112 ROS_ERROR("GICP is not supported by this version");
00113 #endif
00114 }
00115
00117 virtual boost::shared_ptr<pcl::PointCloud<Point> > getMap() {return register_.makeShared();}
00118
00120 void setMaxIterations(int v) {icp_max_iterations_=v;}
00121
00123 void setCorrDist(float v) {icp_max_corr_dist_=v;}
00124
00126 void setTrfEpsilon(float v) {icp_trf_epsilon_=v;}
00127
00129 void setOutlierRejectionThreshold(float v) {outlier_rejection_threshold_=v;}
00130
00131 protected:
00132
00133 virtual bool compute_features();
00134 virtual bool compute_corrospondences();
00135 virtual bool compute_transformation();
00136
00141 virtual void setSettingsForICP(ModifiedICP_G *icp);
00142
00143
00144 pcl::PointCloud<Point> register_;
00145
00146
00147 int icp_max_iterations_;
00148 float icp_max_corr_dist_,
00149 outlier_rejection_threshold_,
00150 icp_trf_epsilon_;
00151 bool non_linear_, use_only_last_refrence_, use_gicp_;
00152 };
00153
00157 template <typename Point>
00158 class Registration_ICP_Features : public Registration_ICP<Point>
00159 {
00160 public:
00161
00166 void setFeatures(FeatureContainerInterface* features) {features_ = features;}
00167 protected:
00168
00169 FeatureContainerInterface* features_;
00170
00171 virtual void setSettingsForICP(ModifiedICP_G *icp);
00172 };
00173
00174 template <typename Point, typename FeatureType>
00175 class Registration_ICP_Features_Extra : public Registration_ICP_Features<Point>
00176 {
00177 public:
00178
00179 virtual bool calculateFeature(boost::shared_ptr<pcl::PointCloud<Point> > input, boost::shared_ptr<pcl::PointCloud<Point> > output, boost::shared_ptr<pcl::PointCloud<FeatureType> > features);
00180 protected:
00181 virtual bool compute_features();
00182 };
00183
00184
00185 }
00186
00187 #endif