Point Cloud Library (PCL)  1.11.1-dev
meta_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 Meta @ref Registration class
47  * \note This method accumulates all registered points and becomes more costly with each
48  * registered point cloud.
49  *
50  * This class provides a way to register a stream of clouds where each cloud
51  * will be aligned to the conglomerate of all previous clouds.
52  *
53  * \code
54  * IterativeClosestPoint<PointXYZ,PointXYZ>::Ptr icp (new
55  * IterativeClosestPoint<PointXYZ,PointXYZ>); icp->setMaxCorrespondenceDistance (0.05);
56  * icp->setMaximumIterations (50);
57  *
58  * MetaRegistration<PointXYZ> mreg;
59  * mreg.setRegistration (icp);
60  *
61  * while (true)
62  * {
63  * PointCloud<PointXYZ>::Ptr cloud (new PointCloud<PointXYZ>);
64  * read_cloud (*cloud);
65  * mreg.registerCloud (cloud);
66  *
67  * PointCloud<PointXYZ>::Ptr tmp (new PointCloud<PointXYZ>);
68  * transformPointCloud (*cloud, *tmp, mreg.getAbsoluteTransform ());
69  * write_cloud (*tmp);
70  * }
71  * \endcode
72  *
73  * \author Michael 'v4hn' Goerner
74  * \ingroup registration
75  */
76 template <typename PointT, typename Scalar = float>
78 public:
81 
84 
86 
87  /** \brief Empty destructor */
88  virtual ~MetaRegistration(){};
89 
90  /** \brief Register new point cloud
91  * \note You have to set a valid registration object with \ref setRegistration before
92  * using this \param[in] cloud point cloud to register \param[in] delta_estimate
93  * estimated transform between last registered cloud and this one \return true if
94  * registration converged
95  */
96  bool
97  registerCloud(const PointCloudConstPtr& cloud,
98  const Matrix4& delta_estimate = Matrix4::Identity());
99 
100  /** \brief Get estimated transform of the last registered cloud */
101  inline Matrix4
102  getAbsoluteTransform() const;
103 
104  /** \brief Reset MetaRegistration without resetting registration_ */
105  inline void
106  reset();
107 
108  /** \brief Set registration instance used to align clouds */
109  inline void setRegistration(RegistrationPtr);
110 
111  /** \brief get accumulated meta point cloud */
112  inline PointCloudConstPtr
113  getMetaCloud() const;
114 
115 protected:
116  /** \brief registered accumulated point cloud */
118 
119  /** \brief registration instance to align clouds */
121 
122  /** \brief estimated transform */
124 };
125 
126 } // namespace registration
127 } // namespace pcl
128 
129 #include <pcl/registration/impl/meta_registration.hpp>
pcl
Definition: convolution.h:46
pcl::registration::MetaRegistration::getMetaCloud
PointCloudConstPtr getMetaCloud() const
get accumulated meta point cloud
Definition: meta_registration.hpp:105
pcl::registration::MetaRegistration::PointCloudPtr
typename pcl::PointCloud< PointT >::Ptr PointCloudPtr
Definition: meta_registration.h:79
pcl::registration::MetaRegistration::registration_
RegistrationPtr registration_
registration instance to align clouds
Definition: meta_registration.h:120
pcl::Registration::Matrix4
Eigen::Matrix< Scalar, 4, 4 > Matrix4
Definition: registration.h:59
pcl::registration::MetaRegistration::reset
void reset()
Reset MetaRegistration without resetting registration_.
Definition: meta_registration.hpp:90
pcl::Registration::Ptr
shared_ptr< Registration< PointSource, PointTarget, Scalar > > Ptr
Definition: registration.h:66
pcl::registration::MetaRegistration::full_cloud_
PointCloudPtr full_cloud_
registered accumulated point cloud
Definition: meta_registration.h:117
pcl::registration::MetaRegistration::MetaRegistration
MetaRegistration()
Definition: meta_registration.hpp:46
pcl::registration::MetaRegistration::~MetaRegistration
virtual ~MetaRegistration()
Empty destructor.
Definition: meta_registration.h:88
pcl::registration::MetaRegistration::abs_transform_
Matrix4 abs_transform_
estimated transform
Definition: meta_registration.h:123
pcl::registration::MetaRegistration::setRegistration
void setRegistration(RegistrationPtr)
Set registration instance used to align clouds.
Definition: meta_registration.hpp:98
pcl::registration::MetaRegistration::Matrix4
typename pcl::Registration< PointT, PointT, Scalar >::Matrix4 Matrix4
Definition: meta_registration.h:83
pcl::registration::MetaRegistration::PointCloudConstPtr
typename pcl::PointCloud< PointT >::ConstPtr PointCloudConstPtr
Definition: meta_registration.h:80
pcl::registration::MetaRegistration
Meta Registration class.
Definition: meta_registration.h:77
pcl::PointCloud::Ptr
shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:407
pcl::registration::MetaRegistration::getAbsoluteTransform
Matrix4 getAbsoluteTransform() const
Get estimated transform of the last registered cloud.
Definition: meta_registration.hpp:83
pcl::registration::MetaRegistration::registerCloud
bool registerCloud(const PointCloudConstPtr &cloud, const Matrix4 &delta_estimate=Matrix4::Identity())
Register new point cloud.
Definition: meta_registration.hpp:52
pcl::PointCloud::ConstPtr
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:408
pcl::registration::MetaRegistration::RegistrationPtr
typename pcl::Registration< PointT, PointT, Scalar >::Ptr RegistrationPtr
Definition: meta_registration.h:82