Point Cloud Library (PCL) 1.15.1
Loading...
Searching...
No Matches
correspondence_rejection_organized_boundary.h
1/*
2 * Software License Agreement (BSD License)
3 *
4 * Point Cloud Library (PCL) - www.pointclouds.org
5 * Copyright (c) 2009-2012, Willow Garage, Inc.
6 * Copyright (c) 2012-, Open Perception, Inc.
7 * Copyright (c) Alexandru-Eugen Ichim
8 *
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * * Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * * Redistributions in binary form must reproduce the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer in the documentation and/or other materials provided
20 * with the distribution.
21 * * Neither the name of the copyright holder(s) nor the names of its
22 * contributors may be used to endorse or promote products derived
23 * from this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39#pragma once
40
41#include <pcl/registration/correspondence_rejection.h>
42#include <pcl/conversions.h> // for fromPCLPointCloud2
43#include <pcl/memory.h> // for static_pointer_cast
44
45namespace pcl {
46namespace registration {
47/**
48 * @brief The CorrespondenceRejectionOrganizedBoundary class implements a simple
49 * correspondence rejection measure. For each pair of points in correspondence, it
50 * checks whether they are on the boundary of a silhouette. This is done by counting the
51 * number of NaN dexels in a window around the points (the threshold and window size can
52 * be set by the user). \note Both the source and the target clouds need to be
53 * organized, otherwise all the correspondences will be rejected.
54 *
55 * \author Alexandru E. Ichim
56 * \ingroup registration
57 */
60public:
61 /** @brief Empty constructor. */
63
64 void
65 getRemainingCorrespondences(const pcl::Correspondences& original_correspondences,
66 pcl::Correspondences& remaining_correspondences) override;
67
68 inline void
73
74 template <typename PointT>
75 inline void
77 {
78 if (!data_container_)
80 static_pointer_cast<pcl::registration::DataContainer<PointT>>(data_container_)
81 ->setInputSource(cloud);
82 }
83
84 template <typename PointT>
85 inline void
87 {
88 if (!data_container_)
90 static_pointer_cast<pcl::registration::DataContainer<PointT>>(data_container_)
91 ->setInputTarget(cloud);
92 }
93
94 /** \brief See if this rejector requires source points */
95 bool
96 requiresSourcePoints() const override
97 {
98 return (true);
99 }
100
101 /** \brief Blob method for setting the source cloud */
102 void
109
110 /** \brief See if this rejector requires a target cloud */
111 bool
112 requiresTargetPoints() const override
113 {
114 return (true);
115 }
116
117 /** \brief Method for setting the target cloud */
118 void
125
126 virtual bool
127 updateSource(const Eigen::Matrix4d&)
128 {
129 return (true);
130 }
131
132protected:
133 /** \brief Apply the rejection algorithm.
134 * \param[out] correspondences the set of resultant correspondences.
135 */
136 inline void
137 applyRejection(pcl::Correspondences& correspondences) override
138 {
140 }
141
145
148};
149} // namespace registration
150} // namespace pcl
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
void setInputTarget(const typename pcl::PointCloud< PointT >::ConstPtr &cloud)
bool requiresTargetPoints() const override
See if this rejector requires a target cloud.
void setSourcePoints(pcl::PCLPointCloud2::ConstPtr cloud2) override
Blob method for setting the source cloud.
void setTargetPoints(pcl::PCLPointCloud2::ConstPtr cloud2) override
Method for setting the target cloud.
CorrespondenceRejectionOrganizedBoundary()=default
Empty constructor.
void setInputSource(const typename pcl::PointCloud< PointT >::ConstPtr &cloud)
void applyRejection(pcl::Correspondences &correspondences) override
Apply the rejection algorithm.
void getRemainingCorrespondences(const pcl::Correspondences &original_correspondences, pcl::Correspondences &remaining_correspondences) override
Get a list of valid correspondences after rejection from the original set of correspondences.
bool requiresSourcePoints() const override
See if this rejector requires source points.
CorrespondenceRejector()=default
Empty constructor.
CorrespondencesConstPtr input_correspondences_
The input correspondences.
DataContainer is a container for the input and target point clouds and implements the interface to co...
shared_ptr< DataContainerInterface > Ptr
Defines functions, macros and traits for allocating and using memory.
std::vector< pcl::Correspondence, Eigen::aligned_allocator< pcl::Correspondence > > Correspondences
void fromPCLPointCloud2(const pcl::PCLPointCloud2 &msg, pcl::PointCloud< PointT > &cloud, const MsgFieldMap &field_map, const std::uint8_t *msg_data)
Convert a PCLPointCloud2 binary data blob into a pcl::PointCloud<T> object using a field_map.
shared_ptr< const ::pcl::PCLPointCloud2 > ConstPtr