Point Cloud Library (PCL)
1.15.1
Toggle main menu visibility
Loading...
Searching...
No Matches
pcl
registration
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
45
namespace
pcl
{
46
namespace
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
*/
58
class
PCL_EXPORTS
CorrespondenceRejectionOrganizedBoundary
59
:
public
CorrespondenceRejector
{
60
public
:
61
/** @brief Empty constructor. */
62
CorrespondenceRejectionOrganizedBoundary
() =
default
;
63
64
void
65
getRemainingCorrespondences
(
const
pcl::Correspondences
& original_correspondences,
66
pcl::Correspondences
& remaining_correspondences)
override
;
67
68
inline
void
69
setNumberOfBoundaryNaNs
(
int
val)
70
{
71
boundary_nans_threshold_
= val;
72
}
73
74
template
<
typename
Po
int
T>
75
inline
void
76
setInputSource
(
const
typename
pcl::PointCloud<PointT>::ConstPtr
& cloud)
77
{
78
if
(!
data_container_
)
79
data_container_
.reset(
new
pcl::registration::DataContainer<PointT>
);
80
static_pointer_cast<pcl::registration::DataContainer<PointT>>(
data_container_
)
81
->
setInputSource
(cloud);
82
}
83
84
template
<
typename
Po
int
T>
85
inline
void
86
setInputTarget
(
const
typename
pcl::PointCloud<PointT>::ConstPtr
& cloud)
87
{
88
if
(!
data_container_
)
89
data_container_
.reset(
new
pcl::registration::DataContainer<PointT>
);
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
103
setSourcePoints
(
pcl::PCLPointCloud2::ConstPtr
cloud2)
override
104
{
105
PointCloud<PointXYZ>::Ptr
cloud(
new
PointCloud<PointXYZ>
);
106
fromPCLPointCloud2
(*cloud2, *cloud);
107
setInputSource<PointXYZ>
(cloud);
108
}
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
119
setTargetPoints
(
pcl::PCLPointCloud2::ConstPtr
cloud2)
override
120
{
121
PointCloud<PointXYZ>::Ptr
cloud(
new
PointCloud<PointXYZ>
);
122
fromPCLPointCloud2
(*cloud2, *cloud);
123
setInputTarget<PointXYZ>
(cloud);
124
}
125
126
virtual
bool
127
updateSource
(
const
Eigen::Matrix4d&)
128
{
129
return
(
true
);
130
}
131
132
protected
:
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
{
139
getRemainingCorrespondences
(*
input_correspondences_
, correspondences);
140
}
141
142
int
boundary_nans_threshold_
{8};
143
int
window_size_
{5};
144
float
depth_step_threshold_
{0.025f};
145
146
using
DataContainerPtr
=
DataContainerInterface::Ptr
;
147
DataContainerPtr
data_container_
;
148
};
149
}
// namespace registration
150
}
// namespace pcl
pcl::PointCloud
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition
point_cloud.h:174
pcl::PointCloud::Ptr
shared_ptr< PointCloud< PointT > > Ptr
Definition
point_cloud.h:414
pcl::PointCloud::ConstPtr
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition
point_cloud.h:415
pcl::registration::CorrespondenceRejectionOrganizedBoundary::setInputTarget
void setInputTarget(const typename pcl::PointCloud< PointT >::ConstPtr &cloud)
Definition
correspondence_rejection_organized_boundary.h:86
pcl::registration::CorrespondenceRejectionOrganizedBoundary::depth_step_threshold_
float depth_step_threshold_
Definition
correspondence_rejection_organized_boundary.h:144
pcl::registration::CorrespondenceRejectionOrganizedBoundary::requiresTargetPoints
bool requiresTargetPoints() const override
See if this rejector requires a target cloud.
Definition
correspondence_rejection_organized_boundary.h:112
pcl::registration::CorrespondenceRejectionOrganizedBoundary::DataContainerPtr
DataContainerInterface::Ptr DataContainerPtr
Definition
correspondence_rejection_organized_boundary.h:146
pcl::registration::CorrespondenceRejectionOrganizedBoundary::setNumberOfBoundaryNaNs
void setNumberOfBoundaryNaNs(int val)
Definition
correspondence_rejection_organized_boundary.h:69
pcl::registration::CorrespondenceRejectionOrganizedBoundary::setSourcePoints
void setSourcePoints(pcl::PCLPointCloud2::ConstPtr cloud2) override
Blob method for setting the source cloud.
Definition
correspondence_rejection_organized_boundary.h:103
pcl::registration::CorrespondenceRejectionOrganizedBoundary::setTargetPoints
void setTargetPoints(pcl::PCLPointCloud2::ConstPtr cloud2) override
Method for setting the target cloud.
Definition
correspondence_rejection_organized_boundary.h:119
pcl::registration::CorrespondenceRejectionOrganizedBoundary::updateSource
virtual bool updateSource(const Eigen::Matrix4d &)
Definition
correspondence_rejection_organized_boundary.h:127
pcl::registration::CorrespondenceRejectionOrganizedBoundary::boundary_nans_threshold_
int boundary_nans_threshold_
Definition
correspondence_rejection_organized_boundary.h:142
pcl::registration::CorrespondenceRejectionOrganizedBoundary::CorrespondenceRejectionOrganizedBoundary
CorrespondenceRejectionOrganizedBoundary()=default
Empty constructor.
pcl::registration::CorrespondenceRejectionOrganizedBoundary::setInputSource
void setInputSource(const typename pcl::PointCloud< PointT >::ConstPtr &cloud)
Definition
correspondence_rejection_organized_boundary.h:76
pcl::registration::CorrespondenceRejectionOrganizedBoundary::applyRejection
void applyRejection(pcl::Correspondences &correspondences) override
Apply the rejection algorithm.
Definition
correspondence_rejection_organized_boundary.h:137
pcl::registration::CorrespondenceRejectionOrganizedBoundary::getRemainingCorrespondences
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.
pcl::registration::CorrespondenceRejectionOrganizedBoundary::data_container_
DataContainerPtr data_container_
Definition
correspondence_rejection_organized_boundary.h:147
pcl::registration::CorrespondenceRejectionOrganizedBoundary::requiresSourcePoints
bool requiresSourcePoints() const override
See if this rejector requires source points.
Definition
correspondence_rejection_organized_boundary.h:96
pcl::registration::CorrespondenceRejectionOrganizedBoundary::window_size_
int window_size_
Definition
correspondence_rejection_organized_boundary.h:143
pcl::registration::CorrespondenceRejector::CorrespondenceRejector
CorrespondenceRejector()=default
Empty constructor.
pcl::registration::CorrespondenceRejector::input_correspondences_
CorrespondencesConstPtr input_correspondences_
The input correspondences.
Definition
correspondence_rejection.h:204
pcl::registration::DataContainer
DataContainer is a container for the input and target point clouds and implements the interface to co...
Definition
correspondence_rejection.h:234
pcl::registration::DataContainerInterface::Ptr
shared_ptr< DataContainerInterface > Ptr
Definition
correspondence_rejection.h:217
memory.h
Defines functions, macros and traits for allocating and using memory.
pcl::registration
Definition
convergence_criteria.h:46
pcl
Definition
convolution.h:46
pcl::Correspondences
std::vector< pcl::Correspondence, Eigen::aligned_allocator< pcl::Correspondence > > Correspondences
Definition
correspondence.h:89
pcl::fromPCLPointCloud2
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.
Definition
conversions.h:229
pcl::PCLPointCloud2::ConstPtr
shared_ptr< const ::pcl::PCLPointCloud2 > ConstPtr
Definition
PCLPointCloud2.h:36