Point Cloud Library (PCL)  1.9.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  typedef boost::shared_ptr<IntensitySpinEstimation<PointInT, PointOutT> > Ptr;
62  typedef boost::shared_ptr<const IntensitySpinEstimation<PointInT, PointOutT> > ConstPtr;
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
93  computeIntensitySpinImage (const PointCloudIn &cloud,
94  float radius, float sigma, int k,
95  const std::vector<int> &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 (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 (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_;
145  };
146 }
147 
148 #ifdef PCL_NO_PRECOMPILE
149 #include <pcl/features/impl/intensity_spin.hpp>
150 #endif
151 
152 
153 
154 
void setNrDistanceBins(size_t nr_distance_bins)
Set the number of bins to use in the distance dimension of the spin image.
pcl::PointCloud< PointInT > PointCloudIn
void computeIntensitySpinImage(const PointCloudIn &cloud, float radius, float sigma, int k, const std::vector< int > &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...
boost::shared_ptr< const IntensitySpinEstimation< PointInT, PointOutT > > ConstPtr
std::string feature_name_
The feature name.
Definition: feature.h:221
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:44
void setNrIntensityBins(size_t nr_intensity_bins)
Set the number of bins to use in the intensity dimension of the spin image.
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...
IntensitySpinEstimation()
Empty constructor.
int nr_distance_bins_
The number of distance bins in the descriptor.
void computeFeature(PointCloudOut &output) override
Estimate the intensity-domain descriptors at a set of points given by <setInputCloud ()...
IntensitySpinEstimation estimates the intensity-domain spin image descriptors for a given point cloud...
int getNrDistanceBins()
Returns the number of bins in the distance dimension of the spin image.
int nr_intensity_bins_
The number of intensity bins in the descriptor.
int getNrIntensityBins()
Returns the number of bins in the intensity dimension of the spin image.
Feature represents the base feature class.
Definition: feature.h:104
float getSmoothingBandwith()
Returns the standard deviation of the Gaussian smoothing kernel used to construct the spin images...
boost::shared_ptr< IntensitySpinEstimation< PointInT, PointOutT > > Ptr
Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut