Point Cloud Library (PCL) 1.14.0
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 SHOTEstimationOMP (unsigned int nr_threads = 0) : SHOTEstimation<PointInT, PointNT, PointOutT, PointRFT> ()
99 {
100 setNumberOfThreads(nr_threads);
101 };
102
103 /** \brief Initialize the scheduler and set the number of threads to use.
104 * \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
105 */
106 void
107 setNumberOfThreads (unsigned int nr_threads = 0);
108
109 protected:
110
111 /** \brief Estimate the Signatures of Histograms of OrienTations (SHOT) descriptors at a set of points given by
112 * <setInputCloud (), setIndices ()> using the surface in setSearchSurface () and the spatial locator in
113 * setSearchMethod ()
114 * \param output the resultant point cloud model dataset that contains the SHOT feature estimates
115 */
116 void
117 computeFeature (PointCloudOut &output) override;
118
119 /** \brief This method should get called before starting the actual computation. */
120 bool
121 initCompute () override;
122
123 /** \brief The number of threads the scheduler should use. */
124 unsigned int threads_;
125 };
126
127 /** \brief SHOTColorEstimationOMP estimates the Signature of Histograms of OrienTations (SHOT) descriptor for a given point cloud dataset
128 * containing points, normals and colors, in parallel, using the OpenMP standard.
129 *
130 * The suggested PointOutT is pcl::SHOT1344.
131 *
132 * \note If you use this code in any academic work, please cite:
133 *
134 * - F. Tombari, S. Salti, L. Di Stefano
135 * Unique Signatures of Histograms for Local Surface Description.
136 * In Proceedings of the 11th European Conference on Computer Vision (ECCV),
137 * Heraklion, Greece, September 5-11 2010.
138 * - F. Tombari, S. Salti, L. Di Stefano
139 * A Combined Texture-Shape Descriptor For Enhanced 3D Feature Matching.
140 * In Proceedings of the 18th International Conference on Image Processing (ICIP),
141 * Brussels, Belgium, September 11-14 2011.
142 *
143 * \author Samuele Salti
144 * \ingroup features
145 */
146
147 template <typename PointInT, typename PointNT, typename PointOutT = pcl::SHOT1344, typename PointRFT = pcl::ReferenceFrame>
148 class SHOTColorEstimationOMP : public SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>
149 {
150 public:
151 using Ptr = shared_ptr<SHOTColorEstimationOMP<PointInT, PointNT, PointOutT, PointRFT> >;
152 using ConstPtr = shared_ptr<const SHOTColorEstimationOMP<PointInT, PointNT, PointOutT, PointRFT> >;
153 using Feature<PointInT, PointOutT>::feature_name_;
154 using Feature<PointInT, PointOutT>::getClassName;
155 using Feature<PointInT, PointOutT>::input_;
156 using Feature<PointInT, PointOutT>::indices_;
157 using Feature<PointInT, PointOutT>::k_;
158 using Feature<PointInT, PointOutT>::search_parameter_;
159 using Feature<PointInT, PointOutT>::search_radius_;
160 using Feature<PointInT, PointOutT>::surface_;
161 using Feature<PointInT, PointOutT>::fake_surface_;
162 using FeatureFromNormals<PointInT, PointNT, PointOutT>::normals_;
163 using FeatureWithLocalReferenceFrames<PointInT, PointRFT>::frames_;
164 using SHOTEstimationBase<PointInT, PointNT, PointOutT, PointRFT>::lrf_radius_;
165 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::descLength_;
166 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::nr_grid_sector_;
167 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::nr_shape_bins_;
168 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::sqradius_;
169 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::radius3_4_;
170 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::radius1_4_;
171 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::radius1_2_;
172 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::b_describe_shape_;
173 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::b_describe_color_;
174 using SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>::nr_color_bins_;
175
178
179 /** \brief Empty constructor. */
180 SHOTColorEstimationOMP (bool describe_shape = true,
181 bool describe_color = true,
182 unsigned int nr_threads = 0)
183 : SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT> (describe_shape, describe_color)
184 {
185 setNumberOfThreads(nr_threads);
186 }
187
188 /** \brief Initialize the scheduler and set the number of threads to use.
189 * \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
190 */
191 void
192 setNumberOfThreads (unsigned int nr_threads = 0);
193
194 protected:
195
196 /** \brief Estimate the Signatures of Histograms of OrienTations (SHOT) descriptors at a set of points given by
197 * <setInputCloud (), setIndices ()> using the surface in setSearchSurface () and the spatial locator in
198 * setSearchMethod ()
199 * \param output the resultant point cloud model dataset that contains the SHOT feature estimates
200 */
201 void
202 computeFeature (PointCloudOut &output) override;
203
204 /** \brief This method should get called before starting the actual computation. */
205 bool
206 initCompute () override;
207
208 /** \brief The number of threads the scheduler should use. */
209 unsigned int threads_;
210 };
211
212}
213
214#ifdef PCL_NO_PRECOMPILE
215#include <pcl/features/impl/shot_omp.hpp>
216#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:149
void setNumberOfThreads(unsigned int nr_threads=0)
Initialize the scheduler and set the number of threads to use.
Definition shot_omp.hpp:209
typename Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition shot_omp.h:176
unsigned int threads_
The number of threads the scheduler should use.
Definition shot_omp.h:209
SHOTColorEstimationOMP(bool describe_shape=true, bool describe_color=true, unsigned int nr_threads=0)
Empty constructor.
Definition shot_omp.h:180
typename Feature< PointInT, PointOutT >::PointCloudIn PointCloudIn
Definition shot_omp.h:177
shared_ptr< SHOTColorEstimationOMP< PointInT, PointNT, PointOutT, PointRFT > > Ptr
Definition shot_omp.h:151
shared_ptr< const SHOTColorEstimationOMP< PointInT, PointNT, PointOutT, PointRFT > > ConstPtr
Definition shot_omp.h:152
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:223
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:124
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
SHOTEstimationOMP(unsigned int nr_threads=0)
Empty constructor.
Definition shot_omp.h:98
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.