region_growing.h
Go to the documentation of this file.
1 /**************************************************************************************************
2  Software License Agreement (BSD License)
3 
4  Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without modification, are permitted
8  provided that the following conditions are met:
9 
10  *Redistributions of source code must retain the above copyright notice, this list of
11  conditions and the following disclaimer.
12  *Redistributions in binary form must reproduce the above copyright notice, this list of
13  conditions and the following disclaimer in the documentation and/or other materials provided
14  with the distribution.
15  *Neither the name of the University of Aveiro nor the names of its contributors may be used to
16  endorse or promote products derived from this software without specific prior written permission.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
19  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***************************************************************************************************/
27 
28 #ifndef _PCL_REGION_GROWING_H_
29 #define _PCL_REGION_GROWING_H_
30 
38 #include <iostream>
39 #include <vector>
40 #include <algorithm>
41 
42 #include <pcl/common/common.h>
43 #include <pcl/point_cloud.h>
44 #include <pcl/point_types.h>
45 #include <pcl/octree/octree.h>
46 #include <pcl/kdtree/kdtree_flann.h>
47 #include <pcl/filters/extract_indices.h>
48 #include <pcl/octree/octree.h>
49 
50 using namespace pcl;
51 using namespace std;
52 
62 typedef struct
63 {
66  bool ok_to_run;
68 }TYPE_flags;
69 
70 
74 template<class T, class T1>
76 {
77 public:
79  {
80  // reset the variables
81  min_neighbors=5;
82 
83  // reset flags
84  flags.cloud_in_set=false;
85  flags.seeds_in_set=false;
86  flags.run_finished=false;
87  flags.ok_to_run=false;
88  };
89 
91  {
92 
93  }
94 
98 
99  float radius;
100 
103 
107 
108  void set_input_cloud(typename PointCloud<T>::Ptr cloud_in);
109 
111  void set_input_seeds(typename PointCloud<T1>::Ptr seeds_in);
112 
114  void filter ();
115 
117  vector<int> get_region_indices(void);
118 
120  PointIndices get_region_point_indices(void);
121 
122 private:
126 
128 
130  std::vector<int> region_indices;
131 
133  PointIndices region_point_indices;
134 
136  std::vector<int> search_list;
137 
139  typename PointCloud<T>::Ptr cloud;
140 
142  typename PointCloud<T1>::Ptr seeds;
143 
145  PointCloud<T> region;
146 
147 // KdTreeFLANN<T> tree;
148 
152 
154  void process_flags();
155 
157  void extract_region_indices();
158 };
159 
160 #include "region_growing.hpp"
161 #endif
int min_neighbors
Number of neighbors to consider the point.
PointIndices region_point_indices
Point indices from a region.
TYPE_flags flags
Flags set.
std::vector< int > search_list
search indices list
PointCloud< T1 >::Ptr seeds
Input seeds for starting points.
bool seeds_in_set
bool cloud_in_set
some flags to check status
PointCloud< T > region
Output region cloud data.
float radius
The radius for search.
PointCloud< T >::Ptr cloud
Input cloud data for searching.
std::vector< int > region_indices
indices from a region
region growing based algorithm.
bool run_finished
File of function implementation of c++ class.


pointcloud_segmentation
Author(s): Tiago Talhada
autogenerated on Mon Mar 2 2015 01:32:39