Point Cloud Library (PCL)  1.11.1-dev
incremental_registration.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2015, Michael 'v4hn' Goerner
6  * Copyright (c) 2015-, Open Perception, Inc.
7  *
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  *
14  * * Redistributions of source code must retain the above copyright
15  * notice, this list of conditions and the following disclaimer.
16  * * Redistributions in binary form must reproduce the above
17  * copyright notice, this list of conditions and the following
18  * disclaimer in the documentation and/or other materials provided
19  * with the distribution.
20  * * Neither the name of the copyright holder(s) nor the names of its
21  * contributors may be used to endorse or promote products derived
22  * from this software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35  * POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #pragma once
39 
40 #include <pcl/registration/registration.h>
41 #include <pcl/point_cloud.h>
42 
43 namespace pcl {
44 namespace registration {
45 
46 /** \brief Incremental @ref IterativeClosestPoint class
47  *
48  * This class provides a way to register a stream of clouds where each cloud will be
49  * aligned to the previous cloud.
50  *
51  * \code
52  * IterativeClosestPoint<PointXYZ,PointXYZ>::Ptr icp (new
53  * IterativeClosestPoint<PointXYZ,PointXYZ>); icp->setMaxCorrespondenceDistance (0.05);
54  * icp->setMaximumIterations (50);
55  *
56  * IncrementalRegistration<PointXYZ> iicp;
57  * iicp.setRegistration (icp);
58  *
59  * while (true){
60  * PointCloud<PointXYZ>::Ptr cloud (new PointCloud<PointXYZ>);
61  * read_cloud (*cloud);
62  * iicp.registerCloud (cloud);
63  *
64  * PointCloud<PointXYZ>::Ptr tmp (new PointCloud<PointXYZ>);
65  * transformPointCloud (*cloud, *tmp, iicp.getAbsoluteTransform ());
66  * write_cloud (*tmp);
67  * }
68  * \endcode
69  *
70  * \author Michael 'v4hn' Goerner
71  * \ingroup registration
72  */
73 template <typename PointT, typename Scalar = float>
75 public:
78 
81 
83 
84  /** \brief Empty destructor */
86 
87  /** \brief Register new point cloud incrementally
88  * \note You have to set a valid registration object with @ref setRegistration before
89  * using this \note The class doesn't copy cloud. If you afterwards change cloud, that
90  * will affect this class. \param[in] cloud point cloud to register \param[in]
91  * delta_estimate estimated transform between last registered cloud and this one
92  * \return true if registration converged
93  */
94  bool
95  registerCloud(const PointCloudConstPtr& cloud,
96  const Matrix4& delta_estimate = Matrix4::Identity());
97 
98  /** \brief Get estimated transform between the last two registered clouds */
99  inline Matrix4
100  getDeltaTransform() const;
101 
102  /** \brief Get estimated overall transform */
103  inline Matrix4
104  getAbsoluteTransform() const;
105 
106  /** \brief Reset incremental Registration without resetting registration_ */
107  inline void
108  reset();
109 
110  /** \brief Set registration instance used to align clouds */
111  inline void setRegistration(RegistrationPtr);
112 
113 protected:
114  /** \brief last registered point cloud */
116 
117  /** \brief registration instance to align clouds */
119 
120  /** \brief estimated transforms */
123 };
124 
125 } // namespace registration
126 } // namespace pcl
127 
128 #include <pcl/registration/impl/incremental_registration.hpp>
pcl
Definition: convolution.h:46
pcl::registration::IncrementalRegistration::delta_transform_
Matrix4 delta_transform_
estimated transforms
Definition: incremental_registration.h:121
pcl::registration::IncrementalRegistration
Incremental IterativeClosestPoint class.
Definition: incremental_registration.h:74
pcl::registration::IncrementalRegistration::PointCloudConstPtr
typename pcl::PointCloud< PointT >::ConstPtr PointCloudConstPtr
Definition: incremental_registration.h:77
pcl::registration::IncrementalRegistration::abs_transform_
Matrix4 abs_transform_
Definition: incremental_registration.h:122
pcl::Registration::Matrix4
Eigen::Matrix< Scalar, 4, 4 > Matrix4
Definition: registration.h:59
pcl::Registration::Ptr
shared_ptr< Registration< PointSource, PointTarget, Scalar > > Ptr
Definition: registration.h:66
pcl::registration::IncrementalRegistration::getAbsoluteTransform
Matrix4 getAbsoluteTransform() const
Get estimated overall transform.
Definition: incremental_registration.hpp:91
pcl::registration::IncrementalRegistration::reset
void reset()
Reset incremental Registration without resetting registration_.
Definition: incremental_registration.hpp:98
pcl::registration::IncrementalRegistration::~IncrementalRegistration
virtual ~IncrementalRegistration()
Empty destructor.
Definition: incremental_registration.h:85
pcl::registration::IncrementalRegistration::Matrix4
typename pcl::Registration< PointT, PointT, Scalar >::Matrix4 Matrix4
Definition: incremental_registration.h:80
pcl::registration::IncrementalRegistration::last_cloud_
PointCloudConstPtr last_cloud_
last registered point cloud
Definition: incremental_registration.h:115
pcl::registration::IncrementalRegistration::RegistrationPtr
typename pcl::Registration< PointT, PointT, Scalar >::Ptr RegistrationPtr
Definition: incremental_registration.h:79
pcl::registration::IncrementalRegistration::PointCloudPtr
typename pcl::PointCloud< PointT >::Ptr PointCloudPtr
Definition: incremental_registration.h:76
pcl::registration::IncrementalRegistration::registerCloud
bool registerCloud(const PointCloudConstPtr &cloud, const Matrix4 &delta_estimate=Matrix4::Identity())
Register new point cloud incrementally.
Definition: incremental_registration.hpp:52
pcl::PointCloud::Ptr
shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:406
pcl::registration::IncrementalRegistration::setRegistration
void setRegistration(RegistrationPtr)
Set registration instance used to align clouds.
Definition: incremental_registration.hpp:106
pcl::PointCloud::ConstPtr
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:407
pcl::registration::IncrementalRegistration::getDeltaTransform
Matrix4 getDeltaTransform() const
Get estimated transform between the last two registered clouds.
Definition: incremental_registration.hpp:84
pcl::registration::IncrementalRegistration::IncrementalRegistration
IncrementalRegistration()
Definition: incremental_registration.hpp:46
pcl::registration::IncrementalRegistration::registration_
RegistrationPtr registration_
registration instance to align clouds
Definition: incremental_registration.h:118