Point Cloud Library (PCL) 1.12.1
transformation_estimation_symmetric_point_to_plane_lls.h
1/*
2 * Software License Agreement (BSD License)
3 *
4 * Point Cloud Library (PCL) - www.pointclouds.org
5 * Copyright (c) 2019-, 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#include <pcl/cloud_iterator.h>
42
43namespace pcl {
44namespace registration {
45/** \brief @b TransformationEstimationSymmetricPointToPlaneLLS implements a Linear Least
46 * Squares (LLS) approximation for minimizing the symmetric point-to-plane distance
47 * between two clouds of corresponding points with normals.
48 *
49 * For additional details, see
50 * "Linear Least-Squares Optimization for Point-to-Plane ICP Surface Registration",
51 * Kok-Lim Low, 2004 "A Symmetric Objective Function for ICP", Szymon Rusinkiewicz, 2019
52 *
53 * \note The class is templated on the source and target point types as well as on the
54 * output scalar of the transformation matrix (i.e., float or double). Default: float.
55 * \author Matthew Cong
56 * \ingroup registration
57 */
58template <typename PointSource, typename PointTarget, typename Scalar = float>
60: public TransformationEstimation<PointSource, PointTarget, Scalar> {
61public:
63 PointTarget,
64 Scalar>>;
65 using ConstPtr =
66 shared_ptr<const TransformationEstimationSymmetricPointToPlaneLLS<PointSource,
67 PointTarget,
68 Scalar>>;
69
70 using Matrix4 =
72 using Vector6 = Eigen::Matrix<Scalar, 6, 1>;
73
77
78 /** \brief Estimate a rigid rotation transformation between a source and a target
79 * point cloud using SVD. \param[in] cloud_src the source point cloud dataset
80 * \param[in] cloud_tgt the target point cloud dataset
81 * \param[out] transformation_matrix the resultant transformation matrix
82 */
83 inline void
85 const pcl::PointCloud<PointTarget>& cloud_tgt,
86 Matrix4& transformation_matrix) const override;
87
88 /** \brief Estimate a rigid rotation transformation between a source and a target
89 * point cloud using SVD. \param[in] cloud_src the source point cloud dataset
90 * \param[in] indices_src the vector of indices describing the points of interest in
91 * \a cloud_src
92 * \param[in] cloud_tgt the target point cloud dataset
93 * \param[out] transformation_matrix the resultant transformation matrix
94 */
95 inline void
97 const pcl::Indices& indices_src,
98 const pcl::PointCloud<PointTarget>& cloud_tgt,
99 Matrix4& transformation_matrix) const override;
100
101 /** \brief Estimate a rigid rotation transformation between a source and a target
102 * point cloud using SVD. \param[in] cloud_src the source point cloud dataset
103 * \param[in] indices_src the vector of indices describing the points of interest in
104 * \a cloud_src
105 * \param[in] cloud_tgt the target point cloud dataset
106 * \param[in] indices_tgt the vector of indices describing the correspondences of the
107 * interest points from \a indices_src
108 * \param[out] transformation_matrix the resultant transformation matrix
109 */
110 inline void
112 const pcl::Indices& indices_src,
113 const pcl::PointCloud<PointTarget>& cloud_tgt,
114 const pcl::Indices& indices_tgt,
115 Matrix4& transformation_matrix) const override;
116
117 /** \brief Estimate a rigid rotation transformation between a source and a target
118 * point cloud using SVD. \param[in] cloud_src the source point cloud dataset
119 * \param[in] cloud_tgt the target point cloud dataset
120 * \param[in] correspondences the vector of correspondences between source and target
121 * point cloud \param[out] transformation_matrix the resultant transformation matrix
122 */
123 inline void
125 const pcl::PointCloud<PointTarget>& cloud_tgt,
126 const pcl::Correspondences& correspondences,
127 Matrix4& transformation_matrix) const override;
128
129 /** \brief Set whether or not to negate source or target normals on a per-point basis
130 * such that they point in the same direction. \param[in]
131 * enforce_same_direction_normals whether to negate source or target normals on a
132 * per-point basis such that they point in the same direction.
133 */
134 inline void
135 setEnforceSameDirectionNormals(bool enforce_same_direction_normals);
136
137 /** \brief Obtain whether source or target normals are negated on a per-point basis
138 * such that they point in the same direction or not */
139 inline bool
141
142protected:
143 /** \brief Estimate a rigid rotation transformation between a source and a target
144 * \param[in] source_it an iterator over the source point cloud dataset
145 * \param[in] target_it an iterator over the target point cloud dataset
146 * \param[out] transformation_matrix the resultant transformation matrix
147 */
148 void
151 Matrix4& transformation_matrix) const;
152
153 /** \brief Construct a 4 by 4 transformation matrix from the provided rotation and
154 * translation. \param[in] parameters (alpha, beta, gamma, tx, ty, tz) specifying
155 * rotation about the x, y, and z-axis and translation along the the x, y, and z-axis
156 * respectively \param[out] transformation_matrix the resultant transformation matrix
157 */
158 inline void
159 constructTransformationMatrix(const Vector6& parameters,
160 Matrix4& transformation_matrix) const;
161
162 /** \brief Whether or not to negate source and/or target normals such that they point
163 * in the same direction */
165};
166} // namespace registration
167} // namespace pcl
168
169#include <pcl/registration/impl/transformation_estimation_symmetric_point_to_plane_lls.hpp>
Iterator class for point clouds with or without given indices.
TransformationEstimation represents the base class for methods for transformation estimation based on...
TransformationEstimationSymmetricPointToPlaneLLS implements a Linear Least Squares (LLS) approximatio...
bool enforce_same_direction_normals_
Whether or not to negate source and/or target normals such that they point in the same direction.
bool getEnforceSameDirectionNormals()
Obtain whether source or target normals are negated on a per-point basis such that they point in the ...
shared_ptr< const TransformationEstimationSymmetricPointToPlaneLLS< PointSource, PointTarget, Scalar > > ConstPtr
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 using SVD.
shared_ptr< TransformationEstimationSymmetricPointToPlaneLLS< PointSource, PointTarget, Scalar > > Ptr
typename TransformationEstimation< PointSource, PointTarget, Scalar >::Matrix4 Matrix4
void setEnforceSameDirectionNormals(bool enforce_same_direction_normals)
Set whether or not to negate source or target normals on a per-point basis such that they point in th...
void constructTransformationMatrix(const Vector6 &parameters, Matrix4 &transformation_matrix) const
Construct a 4 by 4 transformation matrix from the provided rotation and translation.
std::vector< pcl::Correspondence, Eigen::aligned_allocator< pcl::Correspondence > > Correspondences
IndicesAllocator<> Indices
Type used for indices in PCL.
Definition: types.h:133