Point Cloud Library (PCL)  1.14.1-dev
transformation_estimation_3point.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2014-, Open Perception, Inc.
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of the copyright holder(s) nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  */
37 
38 #pragma once
39 
40 #include <pcl/registration/transformation_estimation.h>
41 
42 namespace pcl {
43 namespace registration {
44 /** \brief TransformationEstimation3Points represents the class for transformation
45  * estimation based on:
46  * - correspondence vectors of 3 pairs (planar case)
47  * - two point clouds (source and target) of size 3
48  * - a point cloud with a set of 3 indices (source), and another point cloud (target)
49  * - two point clouds with two sets of indices (source and target) of the size 3
50  *
51  * \note The class is templated on the source and target point types as well as on the
52  * output scalar of the transformation matrix (i.e., float or double). Default: float.
53  *
54  * \author P.W.Theiler
55  * \ingroup registration
56  */
57 template <typename PointSource, typename PointTarget, typename Scalar = float>
59 : public TransformationEstimation<PointSource, PointTarget, Scalar> {
60 public:
61  /** \cond */
62  using Ptr =
63  shared_ptr<TransformationEstimation3Point<PointSource, PointTarget, Scalar>>;
64  using ConstPtr = shared_ptr<
66  using Matrix4 =
68  /** \endcond */
69 
70  /** \brief Constructor */
72 
73  /** \brief Destructor */
74  ~TransformationEstimation3Point() override = default;
75 
76  /** \brief Estimate a rigid rotation transformation between a source and a target
77  * point cloud. \param[in] cloud_src the source point cloud dataset \param[in]
78  * cloud_tgt the target point cloud dataset \param[out] transformation_matrix the
79  * resultant transformation matrix
80  */
81  void
83  const pcl::PointCloud<PointTarget>& cloud_tgt,
84  Matrix4& transformation_matrix) const override;
85 
86  /** \brief Estimate a rigid rotation transformation between a source and a target
87  * point cloud. \param[in] cloud_src the source point cloud dataset \param[in]
88  * indices_src the vector of indices describing the points of interest in \a cloud_src
89  * \param[in] cloud_tgt the target point cloud dataset
90  * \param[out] transformation_matrix the resultant transformation matrix
91  */
92  void
94  const pcl::Indices& indices_src,
95  const pcl::PointCloud<PointTarget>& cloud_tgt,
96  Matrix4& transformation_matrix) const override;
97 
98  /** \brief Estimate a rigid rotation transformation between a source and a target
99  * point cloud. \param[in] cloud_src the source point cloud dataset \param[in]
100  * indices_src the vector of indices describing the points of interest in \a cloud_src
101  * \param[in] cloud_tgt the target point cloud dataset
102  * \param[in] indices_tgt the vector of indices describing the correspondences of the
103  * interest points from \a indices_src
104  * \param[out] transformation_matrix the resultant transformation matrix
105  */
106  void
108  const pcl::Indices& indices_src,
109  const pcl::PointCloud<PointTarget>& cloud_tgt,
110  const pcl::Indices& indices_tgt,
111  Matrix4& transformation_matrix) const override;
112 
113  /** \brief Estimate a rigid rotation transformation between a source and a target
114  * point cloud. \param[in] cloud_src the source point cloud dataset \param[in]
115  * cloud_tgt the target point cloud dataset \param[in] correspondences the vector of
116  * correspondences between source and target point cloud \param[out]
117  * transformation_matrix the resultant transformation matrix
118  */
119  void
121  const pcl::PointCloud<PointTarget>& cloud_tgt,
122  const pcl::Correspondences& correspondences,
123  Matrix4& transformation_matrix) const override;
124 
125 protected:
126  /** \brief Estimate a rigid rotation transformation between a source and a target
127  * \param[in] source_it an iterator over the source point cloud dataset
128  * \param[in] target_it an iterator over the target point cloud dataset
129  * \param[out] transformation_matrix the resultant transformation matrix
130  */
131  void
134  Matrix4& transformation_matrix) const;
135 };
136 }; // namespace registration
137 }; // namespace pcl
138 
139 #include <pcl/registration/impl/transformation_estimation_3point.hpp>
Iterator class for point clouds with or without given indices.
TransformationEstimation3Points represents the class for transformation estimation based on:
~TransformationEstimation3Point() override=default
Destructor.
void estimateRigidTransformation(const pcl::PointCloud< PointSource > &cloud_src, const pcl::PointCloud< PointTarget > &cloud_tgt, Matrix4 &transformation_matrix) const override
Estimate a rigid rotation transformation between a source and a target point cloud.
TransformationEstimation represents the base class for methods for transformation estimation based on...
shared_ptr< const TransformationEstimation< PointSource, PointTarget, float > > ConstPtr
shared_ptr< TransformationEstimation< PointSource, PointTarget, float > > Ptr
std::vector< pcl::Correspondence, Eigen::aligned_allocator< pcl::Correspondence > > Correspondences
IndicesAllocator<> Indices
Type used for indices in PCL.
Definition: types.h:133