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