Point Cloud Library (PCL)  1.14.1-dev
intensity_spin.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/features/feature.h>
44 
45 namespace pcl
46 {
47  /** \brief IntensitySpinEstimation estimates the intensity-domain spin image descriptors for a given point cloud
48  * dataset containing points and intensity. For more information about the intensity-domain spin image descriptor,
49  * see:
50  *
51  * Svetlana Lazebnik, Cordelia Schmid, and Jean Ponce.
52  * A sparse texture representation using local affine regions.
53  * In IEEE Transactions on Pattern Analysis and Machine Intelligence, volume 27, pages 1265-1278, August 2005.
54  * \author Michael Dixon
55  * \ingroup features
56  */
57  template <typename PointInT, typename PointOutT>
58  class IntensitySpinEstimation: public Feature<PointInT, PointOutT>
59  {
60  public:
61  using Ptr = shared_ptr<IntensitySpinEstimation<PointInT, PointOutT> >;
62  using ConstPtr = shared_ptr<const IntensitySpinEstimation<PointInT, PointOutT> >;
65 
69 
72 
75 
76  /** \brief Empty constructor. */
78  {
79  feature_name_ = "IntensitySpinEstimation";
80  }
81 
82  /** \brief Estimate the intensity-domain spin image descriptor for a given point based on its spatial
83  * neighborhood of 3D points and their intensities.
84  * \param[in] cloud the dataset containing the Cartesian coordinates and intensity values of the points
85  * \param[in] radius the radius of the feature
86  * \param[in] sigma the standard deviation of the Gaussian smoothing kernel to use during the soft histogram update
87  * \param[in] k the number of neighbors to use from \a indices and \a squared_distances
88  * \param[in] indices the indices of the points that comprise the query point's neighborhood
89  * \param[in] squared_distances the squared distances from the query point to each point in the neighborhood
90  * \param[out] intensity_spin_image the resultant intensity-domain spin image descriptor
91  */
92  void
94  float radius, float sigma, int k,
95  const pcl::Indices &indices,
96  const std::vector<float> &squared_distances,
97  Eigen::MatrixXf &intensity_spin_image);
98 
99  /** \brief Set the number of bins to use in the distance dimension of the spin image
100  * \param[in] nr_distance_bins the number of bins to use in the distance dimension of the spin image
101  */
102  inline void
103  setNrDistanceBins (std::size_t nr_distance_bins) { nr_distance_bins_ = static_cast<int> (nr_distance_bins); };
104 
105  /** \brief Returns the number of bins in the distance dimension of the spin image. */
106  inline int
108 
109  /** \brief Set the number of bins to use in the intensity dimension of the spin image.
110  * \param[in] nr_intensity_bins the number of bins to use in the intensity dimension of the spin image
111  */
112  inline void
113  setNrIntensityBins (std::size_t nr_intensity_bins) { nr_intensity_bins_ = static_cast<int> (nr_intensity_bins); };
114 
115  /** \brief Returns the number of bins in the intensity dimension of the spin image. */
116  inline int
118 
119  /** \brief Set the standard deviation of the Gaussian smoothing kernel to use when constructing the spin images.
120  * \param[in] sigma the standard deviation of the Gaussian smoothing kernel to use when constructing the spin images
121  */
122  inline void
123  setSmoothingBandwith (float sigma) { sigma_ = sigma; };
124 
125  /** \brief Returns the standard deviation of the Gaussian smoothing kernel used to construct the spin images. */
126  inline float
127  getSmoothingBandwith () { return (sigma_); };
128 
129 
130  /** \brief Estimate the intensity-domain descriptors at a set of points given by <setInputCloud (), setIndices ()>
131  * using the surface in setSearchSurface (), and the spatial locator in setSearchMethod ().
132  * \param[out] output the resultant point cloud model dataset that contains the intensity-domain spin image features
133  */
134  void
135  computeFeature (PointCloudOut &output) override;
136 
137  /** \brief The number of distance bins in the descriptor. */
139 
140  /** \brief The number of intensity bins in the descriptor. */
142 
143  /** \brief The standard deviation of the Gaussian smoothing kernel used to construct the spin images. */
144  float sigma_{1.0};
145  };
146 }
147 
148 #ifdef PCL_NO_PRECOMPILE
149 #include <pcl/features/impl/intensity_spin.hpp>
150 #endif
151 
152 
153 
154 
Feature represents the base feature class.
Definition: feature.h:107
shared_ptr< Feature< PointInT, PointOutT > > Ptr
Definition: feature.h:114
std::string feature_name_
The feature name.
Definition: feature.h:220
shared_ptr< const Feature< PointInT, PointOutT > > ConstPtr
Definition: feature.h:115
IntensitySpinEstimation estimates the intensity-domain spin image descriptors for a given point cloud...
typename Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
float getSmoothingBandwith()
Returns the standard deviation of the Gaussian smoothing kernel used to construct the spin images.
pcl::PointCloud< PointInT > PointCloudIn
void computeFeature(PointCloudOut &output) override
Estimate the intensity-domain descriptors at a set of points given by <setInputCloud (),...
int nr_distance_bins_
The number of distance bins in the descriptor.
float sigma_
The standard deviation of the Gaussian smoothing kernel used to construct the spin images.
void setSmoothingBandwith(float sigma)
Set the standard deviation of the Gaussian smoothing kernel to use when constructing the spin images.
int getNrDistanceBins()
Returns the number of bins in the distance dimension of the spin image.
void computeIntensitySpinImage(const PointCloudIn &cloud, float radius, float sigma, int k, const pcl::Indices &indices, const std::vector< float > &squared_distances, Eigen::MatrixXf &intensity_spin_image)
Estimate the intensity-domain spin image descriptor for a given point based on its spatial neighborho...
int getNrIntensityBins()
Returns the number of bins in the intensity dimension of the spin image.
int nr_intensity_bins_
The number of intensity bins in the descriptor.
void setNrIntensityBins(std::size_t nr_intensity_bins)
Set the number of bins to use in the intensity dimension of the spin image.
void setNrDistanceBins(std::size_t nr_distance_bins)
Set the number of bins to use in the distance dimension of the spin image.
IntensitySpinEstimation()
Empty constructor.
IndicesAllocator<> Indices
Type used for indices in PCL.
Definition: types.h:133