Point Cloud Library (PCL)
1.3.1
|
00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Point Cloud Library (PCL) - www.pointclouds.org 00005 * Copyright (c) 2011, Willow Garage, Inc. 00006 * 00007 * All rights reserved. 00008 * 00009 * Redistribution and use in source and binary forms, with or without 00010 * modification, are permitted provided that the following conditions 00011 * are met: 00012 * 00013 * * Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * * Redistributions in binary form must reproduce the above 00016 * copyright notice, this list of conditions and the following 00017 * disclaimer in the documentation and/or other materials provided 00018 * with the distribution. 00019 * * Neither the name of Willow Garage, Inc. nor the names of its 00020 * contributors may be used to endorse or promote products derived 00021 * from this software without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00026 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00027 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00028 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00029 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00030 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00031 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00032 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00033 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00034 * POSSIBILITY OF SUCH DAMAGE. 00035 * 00036 * $Id: elch.h 3042 2011-11-01 04:44:47Z svn $ 00037 * 00038 */ 00039 00040 #ifndef PCL_ELCH_H_ 00041 #define PCL_ELCH_H_ 00042 00043 #include <boost/graph/adjacency_list.hpp> 00044 #include <boost/graph/graph_traits.hpp> 00045 00046 #include <Eigen/Geometry> 00047 00048 #include <pcl/pcl_base.h> 00049 #include <pcl/point_types.h> 00050 #include <pcl/point_cloud.h> 00051 #include <pcl/registration/registration.h> 00052 #include <pcl/registration/icp.h> 00053 00054 namespace pcl 00055 { 00056 namespace registration 00057 { 00062 template <typename PointT> 00063 class ELCH : public PCLBase<PointT> 00064 { 00065 public: 00066 typedef boost::shared_ptr< ELCH<PointT> > Ptr; 00067 typedef boost::shared_ptr< const ELCH<PointT> > ConstPtr; 00068 00069 typedef pcl::PointCloud<PointT> PointCloud; 00070 typedef typename PointCloud::Ptr PointCloudPtr; 00071 typedef typename PointCloud::ConstPtr PointCloudConstPtr; 00072 00074 typedef boost::adjacency_list< 00075 boost::vecS, boost::vecS, boost::undirectedS, 00076 PointCloudPtr, 00077 boost::no_property> 00078 LoopGraph; 00079 00080 typedef typename pcl::Registration<PointT, PointT> Registration; 00081 typedef typename Registration::Ptr RegistrationPtr; 00082 typedef typename Registration::ConstPtr RegistrationConstPtr; 00083 00085 ELCH () : loop_graph_ (), loop_start_ (), loop_end_ (), reg_ (pcl::IterativeClosestPoint<PointT, PointT> ()) 00086 {}; 00087 00091 inline void 00092 addPointCloud (PointCloudConstPtr cloud) 00093 { 00094 add_vertex (loop_graph_, cloud); 00095 } 00096 00098 inline LoopGraph 00099 getLoopGraph () 00100 { 00101 return (loop_graph_); 00102 } 00103 00107 inline void 00108 setLoopGraph (LoopGraph loop_graph) 00109 { 00110 loop_graph_ = loop_graph; 00111 } 00112 00114 inline PointCloudConstPtr 00115 getLoopStart () 00116 { 00117 return (loop_start_); 00118 } 00119 00123 inline void 00124 setLoopStart (PointCloudConstPtr loop_start) 00125 { 00126 loop_start_ = loop_start; 00127 } 00128 00130 inline PointCloudConstPtr 00131 getLoopend () 00132 { 00133 return (loop_end_); 00134 } 00135 00139 inline void 00140 setLoopend (PointCloudConstPtr loop_end) 00141 { 00142 loop_end_ = loop_end; 00143 } 00144 00146 inline RegistrationConstPtr 00147 getReg () 00148 { 00149 return (reg_); 00150 } 00151 00155 inline void 00156 setReg (RegistrationConstPtr reg) 00157 { 00158 reg_ = reg; 00159 } 00160 00162 inline Eigen::Affine3f & 00163 getLoopTransform () 00164 { 00165 return (loop_transform_); 00166 } 00167 00171 inline void 00172 setLoopTransform (Eigen::Affine3f &loop_transform) 00173 { 00174 loop_transform_ = loop_transform; 00175 } 00176 00181 void 00182 compute (); 00183 00184 protected: 00185 using PCLBase<PointT>::deinitCompute; 00186 00188 virtual bool 00189 initCompute (); 00190 00191 private: 00193 typedef boost::adjacency_list< 00194 boost::vecS, boost::vecS, boost::undirectedS, 00195 boost::no_property, 00196 boost::property< boost::edge_weight_t, double > > 00197 LOAGraph; 00198 00206 void 00207 loopOptimizerAlgorithm (LOAGraph &g, int f, int l, double *weights); 00208 00210 LoopGraph *loop_graph_; 00211 00213 PointCloudConstPtr loop_start_; 00214 00216 PointCloudConstPtr loop_end_; 00217 00219 RegistrationConstPtr reg_; 00220 00222 Eigen::Affine3f *loop_transform_; 00223 00224 public: 00225 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00226 }; 00227 } 00228 } 00229 00230 #include "pcl/registration/impl/elch.hpp" 00231 00232 #endif // PCL_ELCH_H_