Point Cloud Library (PCL)  1.9.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/correspondence.h>
44 #include <pcl/common/transforms.h>
45 #include <pcl/registration/correspondence_types.h>
46 
47 namespace pcl
48 {
49  namespace registration
50  {
51  /** \brief TransformationEstimation represents the base class for methods for transformation estimation based on:
52  * - correspondence vectors
53  * - two point clouds (source and target) of the same size
54  * - a point cloud with a set of indices (source), and another point cloud (target)
55  * - two point clouds with two sets of indices (source and target) of the same size
56  *
57  * \note The class is templated on the source and target point types as well as on the 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  {
64  public:
65  using Matrix4 = Eigen::Matrix<Scalar, 4, 4>;
66 
69 
70  /** \brief Estimate a rigid rotation transformation between a source and a target point cloud.
71  * \param[in] cloud_src the source point cloud dataset
72  * \param[in] cloud_tgt the target point cloud dataset
73  * \param[out] transformation_matrix the resultant transformation matrix
74  */
75  virtual void
77  const pcl::PointCloud<PointSource> &cloud_src,
78  const pcl::PointCloud<PointTarget> &cloud_tgt,
79  Matrix4 &transformation_matrix) const = 0;
80 
81  /** \brief Estimate a rigid rotation transformation between a source and a target point cloud.
82  * \param[in] cloud_src the source point cloud dataset
83  * \param[in] indices_src the vector of indices describing the points of interest in \a cloud_src
84  * \param[in] cloud_tgt the target point cloud dataset
85  * \param[out] transformation_matrix the resultant transformation matrix
86  */
87  virtual void
89  const pcl::PointCloud<PointSource> &cloud_src,
90  const std::vector<int> &indices_src,
91  const pcl::PointCloud<PointTarget> &cloud_tgt,
92  Matrix4 &transformation_matrix) const = 0;
93 
94  /** \brief Estimate a rigid rotation transformation between a source and a target point cloud.
95  * \param[in] cloud_src the source point cloud dataset
96  * \param[in] indices_src the vector of indices describing the points of interest in \a cloud_src
97  * \param[in] cloud_tgt the target point cloud dataset
98  * \param[in] indices_tgt the vector of indices describing the correspondences of the interest points from \a indices_src
99  * \param[out] transformation_matrix the resultant transformation matrix
100  */
101  virtual void
103  const pcl::PointCloud<PointSource> &cloud_src,
104  const std::vector<int> &indices_src,
105  const pcl::PointCloud<PointTarget> &cloud_tgt,
106  const std::vector<int> &indices_tgt,
107  Matrix4 &transformation_matrix) const = 0;
108 
109  /** \brief Estimate a rigid rotation transformation between a source and a target point cloud.
110  * \param[in] cloud_src the source point cloud dataset
111  * \param[in] cloud_tgt the target point cloud dataset
112  * \param[in] correspondences the vector of correspondences between source and target point cloud
113  * \param[out] transformation_matrix the resultant transformation matrix
114  */
115  virtual void
117  const pcl::PointCloud<PointSource> &cloud_src,
118  const pcl::PointCloud<PointTarget> &cloud_tgt,
119  const pcl::Correspondences &correspondences,
120  Matrix4 &transformation_matrix) const = 0;
121 
122 
123  using Ptr = boost::shared_ptr<TransformationEstimation<PointSource, PointTarget, Scalar> >;
124  using ConstPtr = boost::shared_ptr<const TransformationEstimation<PointSource, PointTarget, Scalar> >;
125  };
126  }
127 }
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
boost::shared_ptr< TransformationEstimation< PointT, PointT, Scalar > > Ptr
boost::shared_ptr< const TransformationEstimation< PointT, PointT, Scalar > > ConstPtr
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
TransformationEstimation represents the base class for methods for transformation estimation based on...