Point Cloud Library (PCL)  1.7.1
statistical_multiscale_interest_region_extraction.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2011, Alexandru-Eugen Ichim
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 #ifndef STATISTICAL_MULTISCALE_INTEREST_REGION_EXTRACTION_H_
41 #define STATISTICAL_MULTISCALE_INTEREST_REGION_EXTRACTION_H_
42 
43 #include <pcl/pcl_base.h>
44 #include <list>
45 
46 namespace pcl
47 {
48  /** \brief Class for extracting interest regions from unstructured point clouds, based on a multi scale
49  * statistical approach.
50  * Please refer to the following publications for more details:
51  * Ranjith Unnikrishnan and Martial Hebert
52  * Multi-Scale Interest Regions from Unorganized Point Clouds
53  * Workshop on Search in 3D (S3D), IEEE Conf. on Computer Vision and Pattern Recognition (CVPR)
54  * June, 2008
55  *
56  * Statistical Approaches to Multi-scale Point Cloud Processing
57  * Ranjith Unnikrishnan
58  * PhD Thesis
59  * The Robotics Institute Carnegie Mellon University
60  * May, 2008
61  *
62  * \author Alexandru-Eugen Ichim
63  */
64  template <typename PointT>
66  {
67  public:
68  typedef boost::shared_ptr <std::vector<int> > IndicesPtr;
69  typedef typename boost::shared_ptr<StatisticalMultiscaleInterestRegionExtraction<PointT> > Ptr;
70  typedef typename boost::shared_ptr<const StatisticalMultiscaleInterestRegionExtraction<PointT> > ConstPtr;
71 
72 
73  /** \brief Empty constructor */
75  scale_values_ (), geodesic_distances_ (), F_scales_ ()
76  {};
77 
78  /** \brief Method that generates the underlying nearest neighbor graph based on the
79  * input point cloud
80  */
81  void
83 
84  /** \brief The method to be called in order to run the algorithm and produce the resulting
85  * set of regions of interest
86  */
87  void
88  computeRegionsOfInterest (std::list<IndicesPtr>& rois);
89 
90  /** \brief Method for setting the scale parameters for the algorithm
91  * \param scale_values vector of scales to determine the size of each scaling step
92  */
93  inline void
94  setScalesVector (std::vector<float> &scale_values) { scale_values_ = scale_values; }
95 
96  /** \brief Method for getting the scale parameters vector */
97  inline std::vector<float>
98  getScalesVector () { return scale_values_; }
99 
100 
101  private:
102  /** \brief Checks if all the necessary input was given and the computations can successfully start */
103  bool
104  initCompute ();
105 
106  void
107  geodesicFixedRadiusSearch (size_t &query_index,
108  float &radius,
109  std::vector<int> &result_indices);
110 
111  void
112  computeF ();
113 
114  void
115  extractExtrema (std::list<IndicesPtr>& rois);
116 
119  std::vector<float> scale_values_;
120  std::vector<std::vector<float> > geodesic_distances_;
121  std::vector<std::vector<float> > F_scales_;
122  };
123 }
124 
125 
126 #ifdef PCL_NO_PRECOMPILE
127 #include <pcl/features/impl/statistical_multiscale_interest_region_extraction.hpp>
128 #endif
129 
130 #endif /* STATISTICAL_MULTISCALE_INTEREST_REGION_EXTRACTION_H_ */
boost::shared_ptr< const StatisticalMultiscaleInterestRegionExtraction< PointT > > ConstPtr
boost::shared_ptr< StatisticalMultiscaleInterestRegionExtraction< PointT > > Ptr
void setScalesVector(std::vector< float > &scale_values)
Method for setting the scale parameters for the algorithm.
void generateCloudGraph()
Method that generates the underlying nearest neighbor graph based on the input point cloud...
PCL base class.
Definition: pcl_base.h:68
std::vector< float > getScalesVector()
Method for getting the scale parameters vector.
Class for extracting interest regions from unstructured point clouds, based on a multi scale statisti...
void computeRegionsOfInterest(std::list< IndicesPtr > &rois)
The method to be called in order to run the algorithm and produce the resulting set of regions of int...