Point Cloud Library (PCL) 1.15.1-dev
Loading...
Searching...
No Matches
shot_omp.h
1/*
2 * Software License Agreement (BSD License)
3 *
4 * Point Cloud Library (PCL) - www.pointclouds.org
5 * Copyright (c) 2009, 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 *
38 */
39
40#pragma once
41
42#include <pcl/point_types.h>
43#include <pcl/features/feature.h>
44#include <pcl/features/shot.h>
45
46namespace pcl
47{
48 /** \brief SHOTEstimationOMP estimates the Signature of Histograms of OrienTations (SHOT) descriptor for a given point cloud dataset
49 * containing points and normals, in parallel, using the OpenMP standard.
50 *
51 * The suggested PointOutT is pcl::SHOT352.
52 *
53 * \note If you use this code in any academic work, please cite:
54 *
55 * - F. Tombari, S. Salti, L. Di Stefano
56 * Unique Signatures of Histograms for Local Surface Description.
57 * In Proceedings of the 11th European Conference on Computer Vision (ECCV),
58 * Heraklion, Greece, September 5-11 2010.
59 * - F. Tombari, S. Salti, L. Di Stefano
60 * A Combined Texture-Shape Descriptor For Enhanced 3D Feature Matching.
61 * In Proceedings of the 18th International Conference on Image Processing (ICIP),
62 * Brussels, Belgium, September 11-14 2011.
63 *
64 * \author Samuele Salti
65 * \ingroup features
66 */
67
68 template <typename PointInT, typename PointNT, typename PointOutT = pcl::SHOT352, typename PointRFT = pcl::ReferenceFrame>
69 class SHOTEstimationOMP : public SHOTEstimation<PointInT, PointNT, PointOutT, PointRFT>
70 {
71 public:
72 using Ptr = shared_ptr<SHOTEstimationOMP<PointInT, PointNT, PointOutT, PointRFT> >;
73 using ConstPtr = shared_ptr<const SHOTEstimationOMP<PointInT, PointNT, PointOutT, PointRFT> >;
74 using Feature<PointInT, PointOutT>::feature_name_;
75 using Feature<PointInT, PointOutT>::getClassName;
76 using Feature<PointInT, PointOutT>::input_;
77 using Feature<PointInT, PointOutT>::indices_;
78 using Feature<PointInT, PointOutT>::k_;
79 using Feature<PointInT, PointOutT>::search_parameter_;
80 using Feature<PointInT, PointOutT>::search_radius_;
81 using Feature<PointInT, PointOutT>::surface_;
82 using Feature<PointInT, PointOutT>::fake_surface_;
83 using FeatureFromNormals<PointInT, PointNT, PointOutT>::normals_;
84 using FeatureWithLocalReferenceFrames<PointInT, PointRFT>::frames_;
85 using SHOTEstimationBase<PointInT, PointNT, PointOutT, PointRFT>::lrf_radius_;
86 using SHOTEstimation<PointInT, PointNT, PointOutT, PointRFT>::descLength_;
87 using SHOTEstimation<PointInT, PointNT, PointOutT, PointRFT>::nr_grid_sector_;
88 using SHOTEstimation<PointInT, PointNT, PointOutT, PointRFT>::nr_shape_bins_;
89 using SHOTEstimation<PointInT, PointNT, PointOutT, PointRFT>::sqradius_;
90 using SHOTEstimation<PointInT, PointNT, PointOutT, PointRFT>::radius3_4_;
91 using SHOTEstimation<PointInT, PointNT, PointOutT, PointRFT>::radius1_4_;
92 using SHOTEstimation<PointInT, PointNT, PointOutT, PointRFT>::radius1_2_;
93
96
97 /** \brief Empty constructor.
98 * \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
99 * \param chunk_size PCL will use dynamic scheduling with this chunk size. Setting it too low will lead to more parallelization overhead. Setting it too high will lead to a worse balancing between the threads.
100 */
101 SHOTEstimationOMP (unsigned int nr_threads = 0, int chunk_size = 256)
102 : SHOTEstimation<PointInT, PointNT, PointOutT, PointRFT> (), chunk_size_(chunk_size)
103 {
104 setNumberOfThreads(nr_threads);
105 };
106
107 /** \brief Initialize the scheduler and set the number of threads to use.
108 * \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
109 */
110 void
111 setNumberOfThreads (unsigned int nr_threads = 0);
112
113 protected:
114
115 /** \brief Estimate the Signatures of Histograms of OrienTations (SHOT) descriptors at a set of points given by
116 * <setInputCloud (), setIndices ()> using the surface in setSearchSurface () and the spatial locator in
117 * setSearchMethod ()
118 * \param output the resultant point cloud model dataset that contains the SHOT feature estimates
119 */
120 void
121 computeFeature (PointCloudOut &output) override;
122
123 /** \brief This method should get called before starting the actual computation. */
124 bool
125 initCompute () override;
126
127 /** \brief The number of threads the scheduler should use. */
128 unsigned int threads_;
129
130 /** \brief Chunk size for (dynamic) scheduling. */
132 };
133
134 /** \brief SHOTColorEstimationOMP estimates the Signature of Histograms of OrienTations (SHOT) descriptor for a given point cloud dataset
135 * containing points, normals and colors, in parallel, using the OpenMP standard.
136 *
137 * The suggested PointOutT is pcl::SHOT1344.
138 *
139 * \note If you use this code in any academic work, please cite:
140 *
141 * - F. Tombari, S. Salti, L. Di Stefano
142 * Unique Signatures of Histograms for Local Surface Description.
143 * In Proceedings of the 11th European Conference on Computer Vision (ECCV),
144 * Heraklion, Greece, September 5-11 2010.
145 * - F. Tombari, S. Salti, L. Di Stefano
146 * A Combined Texture-Shape Descriptor For Enhanced 3D Feature Matching.
147 * In Proceedings of the 18th International Conference on Image Processing (ICIP),
148 * Brussels, Belgium, September 11-14 2011.
149 *
150 * \author Samuele Salti
151 * \ingroup features
152 */
153
154 template <typename PointInT, typename PointNT, typename PointOutT = pcl::SHOT1344, typename PointRFT = pcl::ReferenceFrame>
155 class SHOTColorEstimationOMP : public SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>
156 {
157 public:
158 using Ptr = shared_ptr<SHOTColorEstimationOMP<PointInT, PointNT, PointOutT, PointRFT> >;
159 using ConstPtr = shared_ptr<const SHOTColorEstimationOMP<PointInT, PointNT, PointOutT, PointRFT> >;
160 using Feature<PointInT, PointOutT>::feature_name_;
161 using Feature<PointInT, PointOutT>::getClassName;
162 using Feature<PointInT, PointOutT>::input_;
163 using Feature<PointInT, PointOutT>::indices_;
164 using Feature<PointInT, PointOutT>::k_;
165 using Feature<PointInT, PointOutT>::search_parameter_;
166 using Feature<PointInT, PointOutT>::search_radius_;
167 using Feature<PointInT, PointOutT>::surface_;
168 using Feature<PointInT, PointOutT>::fake_surface_;
169 using FeatureFromNormals<PointInT, PointNT, PointOutT>::normals_;
170 using FeatureWithLocalReferenceFrames<PointInT, PointRFT>::frames_;
171 using SHOTEstimationBase<PointInT, PointNT, PointOutT, PointRFT>::lrf_radius_;
172 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::descLength_;
173 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::nr_grid_sector_;
174 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::nr_shape_bins_;
175 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::sqradius_;
176 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::radius3_4_;
177 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::radius1_4_;
178 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::radius1_2_;
179 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::b_describe_shape_;
180 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::b_describe_color_;
181 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::nr_color_bins_;
182
185
186 /** \brief Empty constructor.
187 * \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
188 * \param chunk_size PCL will use dynamic scheduling with this chunk size. Setting it too low will lead to more parallelization overhead. Setting it too high will lead to a worse balancing between the threads.
189 */
190 SHOTColorEstimationOMP (bool describe_shape = true,
191 bool describe_color = true,
192 unsigned int nr_threads = 0,
193 int chunk_size = 64)
194 : SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT> (describe_shape, describe_color),
195 chunk_size_(chunk_size)
196 {
197 setNumberOfThreads(nr_threads);
198 }
199
200 /** \brief Initialize the scheduler and set the number of threads to use.
201 * \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
202 */
203 void
204 setNumberOfThreads (unsigned int nr_threads = 0);
205
206 protected:
207
208 /** \brief Estimate the Signatures of Histograms of OrienTations (SHOT) descriptors at a set of points given by
209 * <setInputCloud (), setIndices ()> using the surface in setSearchSurface () and the spatial locator in
210 * setSearchMethod ()
211 * \param output the resultant point cloud model dataset that contains the SHOT feature estimates
212 */
213 void
214 computeFeature (PointCloudOut &output) override;
215
216 /** \brief This method should get called before starting the actual computation. */
217 bool
218 initCompute () override;
219
220 /** \brief The number of threads the scheduler should use. */
221 unsigned int threads_;
222
223 /** \brief Chunk size for (dynamic) scheduling. */
225 };
226
227}
228
229#ifdef PCL_NO_PRECOMPILE
230#include <pcl/features/impl/shot_omp.hpp>
231#endif
PointCloudNConstPtr normals_
A pointer to the input dataset that contains the point normals of the XYZ dataset.
Definition feature.h:349
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:234
const std::string & getClassName() const
Get a string representation of the name of this class.
Definition feature.h:244
double search_radius_
The nearest neighbors search radius for each point.
Definition feature.h:237
int k_
The number of K nearest neighbors to use for each point.
Definition feature.h:240
std::string feature_name_
The feature name.
Definition feature.h:220
PointCloudInConstPtr surface_
An input point cloud describing the surface that is to be used for nearest neighbors estimation.
Definition feature.h:228
bool fake_surface_
If no surface is given, we use the input PointCloud as the surface.
Definition feature.h:255
FeatureWithLocalReferenceFrames provides a public interface for descriptor extractor classes which ne...
Definition feature.h:440
PointCloudLRFConstPtr frames_
A boost shared pointer to the local reference frames.
Definition feature.h:475
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
SHOTColorEstimation estimates the Signature of Histograms of OrienTations (SHOT) descriptor for a giv...
Definition shot.h:290
bool b_describe_color_
Compute color descriptor.
Definition shot.h:376
bool b_describe_shape_
Compute shape descriptor.
Definition shot.h:373
int nr_color_bins_
The number of bins in each color histogram.
Definition shot.h:379
SHOTColorEstimationOMP estimates the Signature of Histograms of OrienTations (SHOT) descriptor for a ...
Definition shot_omp.h:156
void setNumberOfThreads(unsigned int nr_threads=0)
Initialize the scheduler and set the number of threads to use.
Definition shot_omp.hpp:210
typename Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition shot_omp.h:183
unsigned int threads_
The number of threads the scheduler should use.
Definition shot_omp.h:221
typename Feature< PointInT, PointOutT >::PointCloudIn PointCloudIn
Definition shot_omp.h:184
shared_ptr< SHOTColorEstimationOMP< PointInT, PointNT, PointOutT, PointRFT > > Ptr
Definition shot_omp.h:158
int chunk_size_
Chunk size for (dynamic) scheduling.
Definition shot_omp.h:224
shared_ptr< const SHOTColorEstimationOMP< PointInT, PointNT, PointOutT, PointRFT > > ConstPtr
Definition shot_omp.h:159
void computeFeature(PointCloudOut &output) override
Estimate the Signatures of Histograms of OrienTations (SHOT) descriptors at a set of points given by ...
Definition shot_omp.hpp:224
SHOTColorEstimationOMP(bool describe_shape=true, bool describe_color=true, unsigned int nr_threads=0, int chunk_size=64)
Empty constructor.
Definition shot_omp.h:190
bool initCompute() override
This method should get called before starting the actual computation.
Definition shot_omp.hpp:88
SHOTEstimation estimates the Signature of Histograms of OrienTations (SHOT) descriptor for a given po...
Definition shot.h:71
double radius1_2_
1/2 of the search radius.
Definition shot.h:180
const int nr_grid_sector_
Number of azimuthal sectors.
Definition shot.h:183
double radius3_4_
3/4 of the search radius.
Definition shot.h:174
int descLength_
One SHOT length.
Definition shot.h:189
double sqradius_
The squared search radius.
Definition shot.h:171
float lrf_radius_
The radius used for the LRF computation.
Definition shot.h:168
int nr_shape_bins_
The number of bins in each shape histogram.
Definition shot.h:165
double radius1_4_
1/4 of the search radius.
Definition shot.h:177
SHOTEstimation estimates the Signature of Histograms of OrienTations (SHOT) descriptor for a given po...
Definition shot.h:213
SHOTEstimationOMP estimates the Signature of Histograms of OrienTations (SHOT) descriptor for a given...
Definition shot_omp.h:70
unsigned int threads_
The number of threads the scheduler should use.
Definition shot_omp.h:128
void setNumberOfThreads(unsigned int nr_threads=0)
Initialize the scheduler and set the number of threads to use.
Definition shot_omp.hpp:126
bool initCompute() override
This method should get called before starting the actual computation.
Definition shot_omp.hpp:50
void computeFeature(PointCloudOut &output) override
Estimate the Signatures of Histograms of OrienTations (SHOT) descriptors at a set of points given by ...
Definition shot_omp.hpp:140
int chunk_size_
Chunk size for (dynamic) scheduling.
Definition shot_omp.h:131
SHOTEstimationOMP(unsigned int nr_threads=0, int chunk_size=256)
Empty constructor.
Definition shot_omp.h:101
shared_ptr< SHOTEstimationOMP< PointInT, PointNT, PointOutT, PointRFT > > Ptr
Definition shot_omp.h:72
typename Feature< PointInT, PointOutT >::PointCloudIn PointCloudIn
Definition shot_omp.h:95
shared_ptr< const SHOTEstimationOMP< PointInT, PointNT, PointOutT, PointRFT > > ConstPtr
Definition shot_omp.h:73
typename Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition shot_omp.h:94
Defines all the PCL implemented PointT point type structures.