Point Cloud Library (PCL)  1.12.0-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
53  * (new IterativeClosestPoint<PointXYZ,PointXYZ>);
54  * icp->setMaxCorrespondenceDistance (0.05);
55  * icp->setMaximumIterations (50);
56  *
57  * IncrementalRegistration<PointXYZ> iicp;
58  * iicp.setRegistration (icp);
59  *
60  * while (true){
61  * PointCloud<PointXYZ>::Ptr cloud (new PointCloud<PointXYZ>);
62  * read_cloud (*cloud);
63  * iicp.registerCloud (cloud);
64  *
65  * PointCloud<PointXYZ>::Ptr tmp (new PointCloud<PointXYZ>);
66  * transformPointCloud (*cloud, *tmp, iicp.getAbsoluteTransform ());
67  * write_cloud (*tmp);
68  * }
69  * \endcode
70  *
71  * \author Michael 'v4hn' Goerner
72  * \ingroup registration
73  */
74 template <typename PointT, typename Scalar = float>
76 public:
79 
82 
84 
85  /** \brief Empty destructor */
87 
88  /** \brief Register new point cloud incrementally
89  * \note You have to set a valid registration object with @ref setRegistration before
90  * using this \note The class doesn't copy cloud. If you afterwards change cloud, that
91  * will affect this class. \param[in] cloud point cloud to register \param[in]
92  * delta_estimate estimated transform between last registered cloud and this one
93  * \return true if registration converged
94  */
95  bool
96  registerCloud(const PointCloudConstPtr& cloud,
97  const Matrix4& delta_estimate = Matrix4::Identity());
98 
99  /** \brief Get estimated transform between the last two registered clouds */
100  inline Matrix4
101  getDeltaTransform() const;
102 
103  /** \brief Get estimated overall transform */
104  inline Matrix4
105  getAbsoluteTransform() const;
106 
107  /** \brief Reset incremental Registration without resetting registration_ */
108  inline void
109  reset();
110 
111  /** \brief Set registration instance used to align clouds */
112  inline void setRegistration(RegistrationPtr);
113 
114 protected:
115  /** \brief last registered point cloud */
117 
118  /** \brief registration instance to align clouds */
120 
121  /** \brief estimated transforms */
124 };
125 
126 } // namespace registration
127 } // namespace pcl
128 
129 #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:122
pcl::registration::IncrementalRegistration
Incremental IterativeClosestPoint class.
Definition: incremental_registration.h:75
pcl::registration::IncrementalRegistration::PointCloudConstPtr
typename pcl::PointCloud< PointT >::ConstPtr PointCloudConstPtr
Definition: incremental_registration.h:78
pcl::registration::IncrementalRegistration::abs_transform_
Matrix4 abs_transform_
Definition: incremental_registration.h:123
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:86
pcl::registration::IncrementalRegistration::Matrix4
typename pcl::Registration< PointT, PointT, Scalar >::Matrix4 Matrix4
Definition: incremental_registration.h:81
pcl::registration::IncrementalRegistration::last_cloud_
PointCloudConstPtr last_cloud_
last registered point cloud
Definition: incremental_registration.h:116
pcl::registration::IncrementalRegistration::RegistrationPtr
typename pcl::Registration< PointT, PointT, Scalar >::Ptr RegistrationPtr
Definition: incremental_registration.h:80
pcl::registration::IncrementalRegistration::PointCloudPtr
typename pcl::PointCloud< PointT >::Ptr PointCloudPtr
Definition: incremental_registration.h:77
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:413
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:414
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:119