Point Cloud Library (PCL) 1.15.0
Loading...
Searching...
No Matches
transformation_validation.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/features/feature.h>
45#include <pcl/registration/correspondence_types.h>
46#include <pcl/correspondence.h>
47
48namespace pcl {
49namespace registration {
50/** \brief TransformationValidation represents the base class for methods
51 * that validate the correctness of a transformation found through \ref
52 * TransformationEstimation.
53 *
54 * The inputs for a validation estimation can take any or all of the following:
55 *
56 * - source point cloud
57 * - target point cloud
58 * - estimated transformation between source and target
59 *
60 * The output is in the form of a score or a confidence measure.
61 *
62 * \note The class is templated on the source and target point types as well as on the
63 * output scalar of the transformation matrix (i.e., float or double). Default: float.
64 * \author Radu B. Rusu
65 * \ingroup registration
66 */
67template <typename PointSource, typename PointTarget, typename Scalar = float>
69public:
70 using Matrix4 = Eigen::Matrix<Scalar, 4, 4>;
71 using Ptr = shared_ptr<TransformationValidation<PointSource, PointTarget, Scalar>>;
72 using ConstPtr =
73 shared_ptr<const TransformationValidation<PointSource, PointTarget, Scalar>>;
74
78
82
84 virtual ~TransformationValidation() = default;
85
86 /** \brief Validate the given transformation with respect to the input cloud data, and
87 * return a score. Pure virtual.
88 *
89 * \param[in] cloud_src the source point cloud dataset
90 * \param[in] cloud_tgt the target point cloud dataset
91 * \param[out] transformation_matrix the transformation matrix
92 *
93 * \return the score or confidence measure for the given
94 * transformation_matrix with respect to the input data
95 */
96 virtual double
98 const PointCloudTargetConstPtr& cloud_tgt,
99 const Matrix4& transformation_matrix) const = 0;
100
101 /** \brief Comparator function for deciding which score is better after running the
102 * validation on multiple transforms. Pure virtual.
103 *
104 * \note For example, for Euclidean distances smaller is better, for inliers the
105 * opposite.
106 *
107 * \param[in] score1 the first value
108 * \param[in] score2 the second value
109 *
110 * \return true if score1 is better than score2
111 */
112 virtual bool
113 operator()(const double& score1, const double& score2) const = 0;
114
115 /** \brief Check if the score is valid for a specific transformation. Pure virtual.
116 *
117 * \param[in] cloud_src the source point cloud dataset
118 * \param[in] cloud_tgt the target point cloud dataset
119 * \param[out] transformation_matrix the transformation matrix
120 *
121 * \return true if the transformation is valid, false otherwise.
122 */
123 virtual bool
125 const PointCloudTargetConstPtr& cloud_tgt,
126 const Matrix4& transformation_matrix) const = 0;
127};
128} // namespace registration
129} // namespace pcl
shared_ptr< PointCloud< PointSource > > Ptr
shared_ptr< const PointCloud< PointSource > > ConstPtr
TransformationValidation represents the base class for methods that validate the correctness of a tra...
virtual double validateTransformation(const PointCloudSourceConstPtr &cloud_src, const PointCloudTargetConstPtr &cloud_tgt, const Matrix4 &transformation_matrix) const =0
Validate the given transformation with respect to the input cloud data, and return a score.
virtual bool operator()(const double &score1, const double &score2) const =0
Comparator function for deciding which score is better after running the validation on multiple trans...
virtual bool isValid(const PointCloudSourceConstPtr &cloud_src, const PointCloudTargetConstPtr &cloud_tgt, const Matrix4 &transformation_matrix) const =0
Check if the score is valid for a specific transformation.
typename PointCloudSource::ConstPtr PointCloudSourceConstPtr
shared_ptr< TransformationValidation< PointSource, PointTarget, Scalar > > Ptr
shared_ptr< const TransformationValidation< PointSource, PointTarget, Scalar > > ConstPtr
typename PointCloudTarget::ConstPtr PointCloudTargetConstPtr