Point Cloud Library (PCL)  1.14.1-dev
transformation_estimation.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010-2011, Willow Garage, Inc.
6  * Copyright (c) 2012-, 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  * $Id$
38  *
39  */
40 
41 #pragma once
42 
43 #include <pcl/common/transforms.h>
44 #include <pcl/registration/correspondence_types.h>
45 #include <pcl/correspondence.h>
46 
47 namespace pcl {
48 namespace registration {
49 /** \brief TransformationEstimation represents the base class for methods for
50  * transformation estimation based on:
51  * - correspondence vectors
52  * - two point clouds (source and target) of the same size
53  * - a point cloud with a set of indices (source), and another point cloud (target)
54  * - two point clouds with two sets of indices (source and target) of the same size
55  *
56  * \note The class is templated on the source and target point types as well as on the
57  * output scalar of the transformation matrix (i.e., float or double). Default: float.
58  * \author Dirk Holz, Radu B. Rusu
59  * \ingroup registration
60  */
61 template <typename PointSource, typename PointTarget, typename Scalar = float>
63 public:
64  using Matrix4 = Eigen::Matrix<Scalar, 4, 4>;
65 
67  virtual ~TransformationEstimation() = default;
68 
69  /** \brief Estimate a rigid rotation transformation between a source and a target
70  * point cloud. \param[in] cloud_src the source point cloud dataset \param[in]
71  * cloud_tgt the target point cloud dataset \param[out] transformation_matrix the
72  * resultant transformation matrix
73  */
74  virtual void
76  const pcl::PointCloud<PointTarget>& cloud_tgt,
77  Matrix4& transformation_matrix) const = 0;
78 
79  /** \brief Estimate a rigid rotation transformation between a source and a target
80  * point cloud. \param[in] cloud_src the source point cloud dataset \param[in]
81  * indices_src the vector of indices describing the points of interest in \a cloud_src
82  * \param[in] cloud_tgt the target point cloud dataset
83  * \param[out] transformation_matrix the resultant transformation matrix
84  */
85  virtual void
87  const pcl::Indices& indices_src,
88  const pcl::PointCloud<PointTarget>& cloud_tgt,
89  Matrix4& transformation_matrix) const = 0;
90 
91  /** \brief Estimate a rigid rotation transformation between a source and a target
92  * point cloud. \param[in] cloud_src the source point cloud dataset \param[in]
93  * indices_src the vector of indices describing the points of interest in \a cloud_src
94  * \param[in] cloud_tgt the target point cloud dataset
95  * \param[in] indices_tgt the vector of indices describing the correspondences of the
96  * interest points from \a indices_src
97  * \param[out] transformation_matrix the resultant transformation matrix
98  */
99  virtual void
101  const pcl::Indices& indices_src,
102  const pcl::PointCloud<PointTarget>& cloud_tgt,
103  const pcl::Indices& indices_tgt,
104  Matrix4& transformation_matrix) const = 0;
105 
106  /** \brief Estimate a rigid rotation transformation between a source and a target
107  * point cloud. \param[in] cloud_src the source point cloud dataset \param[in]
108  * cloud_tgt the target point cloud dataset \param[in] correspondences the vector of
109  * correspondences between source and target point cloud \param[out]
110  * transformation_matrix the resultant transformation matrix
111  */
112  virtual void
114  const pcl::PointCloud<PointTarget>& cloud_tgt,
115  const pcl::Correspondences& correspondences,
116  Matrix4& transformation_matrix) const = 0;
117 
118  using Ptr = shared_ptr<TransformationEstimation<PointSource, PointTarget, Scalar>>;
119  using ConstPtr =
120  shared_ptr<const TransformationEstimation<PointSource, PointTarget, Scalar>>;
121 };
122 } // namespace registration
123 } // namespace pcl
TransformationEstimation represents the base class for methods for transformation estimation based on...
virtual void estimateRigidTransformation(const pcl::PointCloud< PointSource > &cloud_src, const pcl::PointCloud< PointTarget > &cloud_tgt, const pcl::Correspondences &correspondences, Matrix4 &transformation_matrix) const =0
Estimate a rigid rotation transformation between a source and a target point cloud.
shared_ptr< const TransformationEstimation< PointSource, PointTarget, Scalar > > ConstPtr
shared_ptr< TransformationEstimation< PointSource, PointTarget, Scalar > > Ptr
virtual void estimateRigidTransformation(const pcl::PointCloud< PointSource > &cloud_src, const pcl::Indices &indices_src, const pcl::PointCloud< PointTarget > &cloud_tgt, const pcl::Indices &indices_tgt, Matrix4 &transformation_matrix) const =0
Estimate a rigid rotation transformation between a source and a target point cloud.
virtual void estimateRigidTransformation(const pcl::PointCloud< PointSource > &cloud_src, const pcl::Indices &indices_src, const pcl::PointCloud< PointTarget > &cloud_tgt, Matrix4 &transformation_matrix) const =0
Estimate a rigid rotation transformation between a source and a target point cloud.
virtual void estimateRigidTransformation(const pcl::PointCloud< PointSource > &cloud_src, const pcl::PointCloud< PointTarget > &cloud_tgt, Matrix4 &transformation_matrix) const =0
Estimate a rigid rotation transformation between a source and a target point cloud.
std::vector< pcl::Correspondence, Eigen::aligned_allocator< pcl::Correspondence > > Correspondences
IndicesAllocator<> Indices
Type used for indices in PCL.
Definition: types.h:133