Point Cloud Library (PCL)
1.12.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
()
63
:
boundary_nans_threshold_
(8),
window_size_
(5),
depth_step_threshold_
(0.025f)
64
{}
65
66
void
67
getRemainingCorrespondences
(
const
pcl::Correspondences
& original_correspondences,
68
pcl::Correspondences
& remaining_correspondences)
override
;
69
70
inline
void
71
setNumberOfBoundaryNaNs
(
int
val)
72
{
73
boundary_nans_threshold_
= val;
74
}
75
76
template
<
typename
Po
int
T>
77
inline
void
78
setInputSource
(
const
typename
pcl::PointCloud<PointT>::ConstPtr
& cloud)
79
{
80
if
(!
data_container_
)
81
data_container_
.reset(
new
pcl::registration::DataContainer<PointT>
);
82
static_pointer_cast<pcl::registration::DataContainer<PointT>>(
data_container_
)
83
->
setInputSource
(cloud);
84
}
85
86
template
<
typename
Po
int
T>
87
inline
void
88
setInputTarget
(
const
typename
pcl::PointCloud<PointT>::ConstPtr
& cloud)
89
{
90
if
(!
data_container_
)
91
data_container_
.reset(
new
pcl::registration::DataContainer<PointT>
);
92
static_pointer_cast<pcl::registration::DataContainer<PointT>>(
data_container_
)
93
->
setInputTarget
(cloud);
94
}
95
96
/** \brief See if this rejector requires source points */
97
bool
98
requiresSourcePoints
()
const override
99
{
100
return
(
true
);
101
}
102
103
/** \brief Blob method for setting the source cloud */
104
void
105
setSourcePoints
(
pcl::PCLPointCloud2::ConstPtr
cloud2)
override
106
{
107
PointCloud<PointXYZ>::Ptr
cloud(
new
PointCloud<PointXYZ>
);
108
fromPCLPointCloud2
(*cloud2, *cloud);
109
setInputSource<PointXYZ>
(cloud);
110
}
111
112
/** \brief See if this rejector requires a target cloud */
113
bool
114
requiresTargetPoints
()
const override
115
{
116
return
(
true
);
117
}
118
119
/** \brief Method for setting the target cloud */
120
void
121
setTargetPoints
(
pcl::PCLPointCloud2::ConstPtr
cloud2)
override
122
{
123
PointCloud<PointXYZ>::Ptr
cloud(
new
PointCloud<PointXYZ>
);
124
fromPCLPointCloud2
(*cloud2, *cloud);
125
setInputTarget<PointXYZ>
(cloud);
126
}
127
128
virtual
bool
129
updateSource
(
const
Eigen::Matrix4d&)
130
{
131
return
(
true
);
132
}
133
134
protected
:
135
/** \brief Apply the rejection algorithm.
136
* \param[out] correspondences the set of resultant correspondences.
137
*/
138
inline
void
139
applyRejection
(
pcl::Correspondences
& correspondences)
override
140
{
141
getRemainingCorrespondences
(*
input_correspondences_
, correspondences);
142
}
143
144
int
boundary_nans_threshold_
;
145
int
window_size_
;
146
float
depth_step_threshold_
;
147
148
using
DataContainerPtr
=
DataContainerInterface::Ptr
;
149
DataContainerPtr
data_container_
;
150
};
151
}
// namespace registration
152
}
// namespace pcl
pcl::PointCloud
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition
point_cloud.h:173
pcl::PointCloud::Ptr
shared_ptr< PointCloud< PointT > > Ptr
Definition
point_cloud.h:413
pcl::PointCloud::ConstPtr
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition
point_cloud.h:414
pcl::registration::CorrespondenceRejectionOrganizedBoundary::CorrespondenceRejectionOrganizedBoundary
CorrespondenceRejectionOrganizedBoundary()
Empty constructor.
Definition
correspondence_rejection_organized_boundary.h:62
pcl::registration::CorrespondenceRejectionOrganizedBoundary::setInputTarget
void setInputTarget(const typename pcl::PointCloud< PointT >::ConstPtr &cloud)
Definition
correspondence_rejection_organized_boundary.h:88
pcl::registration::CorrespondenceRejectionOrganizedBoundary::depth_step_threshold_
float depth_step_threshold_
Definition
correspondence_rejection_organized_boundary.h:146
pcl::registration::CorrespondenceRejectionOrganizedBoundary::requiresTargetPoints
bool requiresTargetPoints() const override
See if this rejector requires a target cloud.
Definition
correspondence_rejection_organized_boundary.h:114
pcl::registration::CorrespondenceRejectionOrganizedBoundary::DataContainerPtr
DataContainerInterface::Ptr DataContainerPtr
Definition
correspondence_rejection_organized_boundary.h:148
pcl::registration::CorrespondenceRejectionOrganizedBoundary::setNumberOfBoundaryNaNs
void setNumberOfBoundaryNaNs(int val)
Definition
correspondence_rejection_organized_boundary.h:71
pcl::registration::CorrespondenceRejectionOrganizedBoundary::setSourcePoints
void setSourcePoints(pcl::PCLPointCloud2::ConstPtr cloud2) override
Blob method for setting the source cloud.
Definition
correspondence_rejection_organized_boundary.h:105
pcl::registration::CorrespondenceRejectionOrganizedBoundary::setTargetPoints
void setTargetPoints(pcl::PCLPointCloud2::ConstPtr cloud2) override
Method for setting the target cloud.
Definition
correspondence_rejection_organized_boundary.h:121
pcl::registration::CorrespondenceRejectionOrganizedBoundary::updateSource
virtual bool updateSource(const Eigen::Matrix4d &)
Definition
correspondence_rejection_organized_boundary.h:129
pcl::registration::CorrespondenceRejectionOrganizedBoundary::boundary_nans_threshold_
int boundary_nans_threshold_
Definition
correspondence_rejection_organized_boundary.h:144
pcl::registration::CorrespondenceRejectionOrganizedBoundary::setInputSource
void setInputSource(const typename pcl::PointCloud< PointT >::ConstPtr &cloud)
Definition
correspondence_rejection_organized_boundary.h:78
pcl::registration::CorrespondenceRejectionOrganizedBoundary::applyRejection
void applyRejection(pcl::Correspondences &correspondences) override
Apply the rejection algorithm.
Definition
correspondence_rejection_organized_boundary.h:139
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:149
pcl::registration::CorrespondenceRejectionOrganizedBoundary::requiresSourcePoints
bool requiresSourcePoints() const override
See if this rejector requires source points.
Definition
correspondence_rejection_organized_boundary.h:98
pcl::registration::CorrespondenceRejectionOrganizedBoundary::window_size_
int window_size_
Definition
correspondence_rejection_organized_boundary.h:145
pcl::registration::CorrespondenceRejector::input_correspondences_
CorrespondencesConstPtr input_correspondences_
The input correspondences.
Definition
correspondence_rejection.h:200
pcl::registration::CorrespondenceRejector::CorrespondenceRejector
CorrespondenceRejector()
Empty constructor.
Definition
correspondence_rejection.h:60
pcl::registration::DataContainer
DataContainer is a container for the input and target point clouds and implements the interface to co...
Definition
correspondence_rejection.h:230
pcl::registration::DataContainerInterface::Ptr
shared_ptr< DataContainerInterface > Ptr
Definition
correspondence_rejection.h:213
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)
Convert a PCLPointCloud2 binary data blob into a pcl::PointCloud<T> object using a field_map.
Definition
conversions.h:166
pcl::PCLPointCloud2::ConstPtr
shared_ptr< const ::pcl::PCLPointCloud2 > ConstPtr
Definition
PCLPointCloud2.h:36