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
00040
00041 #ifndef PCL_ELCH_H_
00042 #define PCL_ELCH_H_
00043
00044 #include <pcl/pcl_base.h>
00045 #include <pcl/point_types.h>
00046 #include <pcl/point_cloud.h>
00047 #include <pcl/registration/registration.h>
00048 #include <pcl/registration/boost.h>
00049 #include <pcl/registration/eigen.h>
00050 #include <pcl/registration/icp.h>
00051 #include <pcl/registration/boost_graph.h>
00052
00053 namespace pcl
00054 {
00055 namespace registration
00056 {
00061 template <typename PointT>
00062 class ELCH : public PCLBase<PointT>
00063 {
00064 public:
00065 typedef boost::shared_ptr< ELCH<PointT> > Ptr;
00066 typedef boost::shared_ptr< const ELCH<PointT> > ConstPtr;
00067
00068 typedef pcl::PointCloud<PointT> PointCloud;
00069 typedef typename PointCloud::Ptr PointCloudPtr;
00070 typedef typename PointCloud::ConstPtr PointCloudConstPtr;
00071
00072 struct Vertex
00073 {
00074 Vertex () : cloud () {}
00075 PointCloudPtr cloud;
00076 };
00077
00079 typedef boost::adjacency_list<
00080 boost::listS, boost::eigen_vecS, boost::undirectedS,
00081 Vertex,
00082 boost::no_property>
00083 LoopGraph;
00084
00085 typedef boost::shared_ptr< LoopGraph > LoopGraphPtr;
00086
00087 typedef typename pcl::Registration<PointT, PointT> Registration;
00088 typedef typename Registration::Ptr RegistrationPtr;
00089 typedef typename Registration::ConstPtr RegistrationConstPtr;
00090
00092 ELCH () :
00093 loop_graph_ (new LoopGraph),
00094 loop_start_ (0),
00095 loop_end_ (0),
00096 reg_ (new pcl::IterativeClosestPoint<PointT, PointT>),
00097 loop_transform_ (),
00098 compute_loop_ (true),
00099 vd_ ()
00100 {};
00101
00103 virtual ~ELCH () {}
00104
00108 inline void
00109 addPointCloud (PointCloudPtr cloud)
00110 {
00111 typename boost::graph_traits<LoopGraph>::vertex_descriptor vd = add_vertex (*loop_graph_);
00112 (*loop_graph_)[vd].cloud = cloud;
00113 if (num_vertices (*loop_graph_) > 1)
00114 add_edge (vd_, vd, *loop_graph_);
00115 vd_ = vd;
00116 }
00117
00119 inline LoopGraphPtr
00120 getLoopGraph ()
00121 {
00122 return (loop_graph_);
00123 }
00124
00128 inline void
00129 setLoopGraph (LoopGraphPtr loop_graph)
00130 {
00131 loop_graph_ = loop_graph;
00132 }
00133
00135 inline typename boost::graph_traits<LoopGraph>::vertex_descriptor
00136 getLoopStart ()
00137 {
00138 return (loop_start_);
00139 }
00140
00144 inline void
00145 setLoopStart (const typename boost::graph_traits<LoopGraph>::vertex_descriptor &loop_start)
00146 {
00147 loop_start_ = loop_start;
00148 }
00149
00151 inline typename boost::graph_traits<LoopGraph>::vertex_descriptor
00152 getLoopEnd ()
00153 {
00154 return (loop_end_);
00155 }
00156
00160 inline void
00161 setLoopEnd (const typename boost::graph_traits<LoopGraph>::vertex_descriptor &loop_end)
00162 {
00163 loop_end_ = loop_end;
00164 }
00165
00167 inline RegistrationPtr
00168 getReg ()
00169 {
00170 return (reg_);
00171 }
00172
00176 inline void
00177 setReg (RegistrationPtr reg)
00178 {
00179 reg_ = reg;
00180 }
00181
00183 inline Eigen::Matrix4f
00184 getLoopTransform ()
00185 {
00186 return (loop_transform_);
00187 }
00188
00192 inline void
00193 setLoopTransform (const Eigen::Matrix4f &loop_transform)
00194 {
00195 loop_transform_ = loop_transform;
00196 compute_loop_ = false;
00197 }
00198
00203 void
00204 compute ();
00205
00206 protected:
00207 using PCLBase<PointT>::deinitCompute;
00208
00210 virtual bool
00211 initCompute ();
00212
00213 private:
00215 typedef boost::adjacency_list<
00216 boost::listS, boost::vecS, boost::undirectedS,
00217 boost::no_property,
00218 boost::property< boost::edge_weight_t, double > >
00219 LOAGraph;
00220
00228 void
00229 loopOptimizerAlgorithm (LOAGraph &g, double *weights);
00230
00232 LoopGraphPtr loop_graph_;
00233
00235 typename boost::graph_traits<LoopGraph>::vertex_descriptor loop_start_;
00236
00238 typename boost::graph_traits<LoopGraph>::vertex_descriptor loop_end_;
00239
00241 RegistrationPtr reg_;
00242
00244 Eigen::Matrix4f loop_transform_;
00245 bool compute_loop_;
00246
00248 typename boost::graph_traits<LoopGraph>::vertex_descriptor vd_;
00249
00250 public:
00251 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00252 };
00253 }
00254 }
00255
00256 #include <pcl/registration/impl/elch.hpp>
00257
00258 #endif // PCL_ELCH_H_