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