Point Cloud Library (PCL) 1.12.0
Loading...
Searching...
No Matches
usc.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/point_types.h>
44#include <pcl/features/feature.h>
45
46namespace pcl
47{
48 /** \brief UniqueShapeContext implements the Unique Shape Context Descriptor
49 * described here:
50 *
51 * - F. Tombari, S. Salti, L. Di Stefano,
52 * "Unique Shape Context for 3D data description",
53 * International Workshop on 3D Object Retrieval (3DOR 10) -
54 * in conjunction with ACM Multimedia 2010
55 *
56 * The suggested PointOutT is pcl::UniqueShapeContext1960
57 *
58 * \author Alessandro Franchi, Federico Tombari, Samuele Salti (original code)
59 * \author Nizar Sallem (port to PCL)
60 * \ingroup features
61 */
62 template <typename PointInT, typename PointOutT = pcl::UniqueShapeContext1960, typename PointRFT = pcl::ReferenceFrame>
63 class UniqueShapeContext : public Feature<PointInT, PointOutT>,
64 public FeatureWithLocalReferenceFrames<PointInT, PointRFT>
65 {
66 public:
77
82
83
84 /** \brief Constructor. */
93
95
96 /** \return The number of bins along the azimuth. */
97 inline std::size_t
98 getAzimuthBins () const { return (azimuth_bins_); }
99
100 /** \return The number of bins along the elevation */
101 inline std::size_t
102 getElevationBins () const { return (elevation_bins_); }
103
104 /** \return The number of bins along the radii direction. */
105 inline std::size_t
106 getRadiusBins () const { return (radius_bins_); }
107
108 /** The minimal radius value for the search sphere (rmin) in the original paper
109 * \param[in] radius the desired minimal radius
110 */
111 inline void
112 setMinimalRadius (double radius) { min_radius_ = radius; }
113
114 /** \return The minimal sphere radius. */
115 inline double
116 getMinimalRadius () const { return (min_radius_); }
117
118 /** This radius is used to compute local point density
119 * density = number of points within this radius
120 * \param[in] radius Value of the point density search radius
121 */
122 inline void
123 setPointDensityRadius (double radius) { point_density_radius_ = radius; }
124
125 /** \return The point density search radius. */
126 inline double
128
129 /** Set the local RF radius value
130 * \param[in] radius the desired local RF radius
131 */
132 inline void
133 setLocalRadius (double radius) { local_radius_ = radius; }
134
135 /** \return The local RF radius. */
136 inline double
137 getLocalRadius () const { return (local_radius_); }
138
139 protected:
140 /** Compute 3D shape context feature descriptor
141 * \param[in] index point index in input_
142 * \param[out] desc descriptor to compute
143 */
144 void
145 computePointDescriptor (std::size_t index, std::vector<float> &desc);
146
147 /** \brief Initialize computation by allocating all the intervals and the volume lookup table. */
148 bool
149 initCompute () override;
150
151 /** \brief The actual feature computation.
152 * \param[out] output the resultant features
153 */
154 void
156
157 /** \brief values of the radii interval. */
158 std::vector<float> radii_interval_;
159
160 /** \brief Theta divisions interval. */
161 std::vector<float> theta_divisions_;
162
163 /** \brief Phi divisions interval. */
164 std::vector<float> phi_divisions_;
165
166 /** \brief Volumes look up table. */
167 std::vector<float> volume_lut_;
168
169 /** \brief Bins along the azimuth dimension. */
170 std::size_t azimuth_bins_;
171
172 /** \brief Bins along the elevation dimension. */
173 std::size_t elevation_bins_;
174
175 /** \brief Bins along the radius dimension. */
176 std::size_t radius_bins_;
177
178 /** \brief Minimal radius value. */
180
181 /** \brief Point density radius. */
183
184 /** \brief Descriptor length. */
186
187 /** \brief Radius to compute local RF. */
189 };
190}
191
192#ifdef PCL_NO_PRECOMPILE
193#include <pcl/features/impl/usc.hpp>
194#endif
Iterator class for point clouds with or without given indices.
Feature represents the base feature class.
Definition feature.h:107
double search_parameter_
The actual search parameter (from either search_radius_ or k_).
Definition feature.h:237
const std::string & getClassName() const
Get a string representation of the name of this class.
Definition feature.h:247
int searchForNeighbors(std::size_t index, double parameter, pcl::Indices &indices, std::vector< float > &distances) const
Search for k-nearest neighbors using the spatial locator from setSearchmethod, and the given surface ...
Definition feature.h:271
double search_radius_
The nearest neighbors search radius for each point.
Definition feature.h:240
std::string feature_name_
The feature name.
Definition feature.h:223
PointCloudInConstPtr surface_
An input point cloud describing the surface that is to be used for nearest neighbors estimation.
Definition feature.h:231
bool fake_surface_
If no surface is given, we use the input PointCloud as the surface.
Definition feature.h:258
FeatureWithLocalReferenceFrames provides a public interface for descriptor extractor classes which ne...
Definition feature.h:449
PointCloudLRFConstPtr frames_
A boost shared pointer to the local reference frames.
Definition feature.h:483
PointCloudConstPtr input_
The input point cloud dataset.
Definition pcl_base.h:147
IndicesPtr indices_
A pointer to the vector of point indices to use.
Definition pcl_base.h:150
UniqueShapeContext implements the Unique Shape Context Descriptor described here:
Definition usc.h:65
void setPointDensityRadius(double radius)
This radius is used to compute local point density density = number of points within this radius.
Definition usc.h:123
UniqueShapeContext()
Constructor.
Definition usc.h:85
std::size_t getAzimuthBins() const
Definition usc.h:98
std::size_t getRadiusBins() const
Definition usc.h:106
std::size_t descriptor_length_
Descriptor length.
Definition usc.h:185
std::size_t azimuth_bins_
Bins along the azimuth dimension.
Definition usc.h:170
std::size_t elevation_bins_
Bins along the elevation dimension.
Definition usc.h:173
double getPointDensityRadius() const
Definition usc.h:127
void setMinimalRadius(double radius)
The minimal radius value for the search sphere (rmin) in the original paper.
Definition usc.h:112
double point_density_radius_
Point density radius.
Definition usc.h:182
std::vector< float > theta_divisions_
Theta divisions interval.
Definition usc.h:161
void computeFeature(PointCloudOut &output) override
The actual feature computation.
Definition usc.hpp:226
std::vector< float > phi_divisions_
Phi divisions interval.
Definition usc.h:164
double getMinimalRadius() const
Definition usc.h:116
double getLocalRadius() const
Definition usc.h:137
double local_radius_
Radius to compute local RF.
Definition usc.h:188
typename Feature< PointInT, PointOutT >::PointCloudIn PointCloudIn
Definition usc.h:79
bool initCompute() override
Initialize computation by allocating all the intervals and the volume lookup table.
Definition usc.hpp:54
void computePointDescriptor(std::size_t index, std::vector< float > &desc)
Compute 3D shape context feature descriptor.
Definition usc.hpp:146
typename Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition usc.h:78
std::vector< float > volume_lut_
Volumes look up table.
Definition usc.h:167
std::vector< float > radii_interval_
values of the radii interval.
Definition usc.h:158
std::size_t getElevationBins() const
Definition usc.h:102
double min_radius_
Minimal radius value.
Definition usc.h:179
std::size_t radius_bins_
Bins along the radius dimension.
Definition usc.h:176
void setLocalRadius(double radius)
Set the local RF radius value.
Definition usc.h:133
Defines all the PCL implemented PointT point type structures.