39 #ifndef PCL_SEGMENTATION_PROGRESSIVE_MORPHOLOGICAL_FILTER_HPP_ 40 #define PCL_SEGMENTATION_PROGRESSIVE_MORPHOLOGICAL_FILTER_HPP_ 42 #include <pcl/common/common.h> 43 #include <pcl/common/io.h> 44 #include <pcl/filters/morphological_filter.h> 45 #include <pcl/filters/extract_indices.h> 46 #include <pcl/segmentation/progressive_morphological_filter.h> 47 #include <pcl/point_cloud.h> 48 #include <pcl/point_types.h> 51 template <
typename Po
intT>
53 max_window_size_ (33),
55 max_distance_ (10.0f),
56 initial_distance_ (0.15f),
64 template <
typename Po
intT>
70 template <
typename Po
intT>
void 74 if (!segmentation_is_possible)
81 std::vector<float> height_thresholds;
82 std::vector<float> window_sizes;
84 float window_size = 0.0f;
85 float height_threshold = 0.0f;
105 window_sizes.push_back (window_size);
106 height_thresholds.push_back (height_threshold);
116 for (
size_t i = 0; i < window_sizes.size (); ++i)
118 PCL_DEBUG (
" Iteration %d (height threshold = %f, window size = %f)...",
119 i, height_thresholds[i], window_sizes[i]);
123 pcl::copyPointCloud<PointT> (*
input_, ground, *cloud);
128 pcl::applyMorphologicalOperator<PointT> (cloud, window_sizes[i],
MORPH_OPEN, *cloud_f);
132 std::vector<int> pt_indices;
133 for (
size_t p_idx = 0; p_idx < ground.size (); ++p_idx)
135 float diff = cloud->points[p_idx].z - cloud_f->points[p_idx].z;
136 if (diff < height_thresholds[i])
137 pt_indices.push_back (ground[p_idx]);
141 ground.swap (pt_indices);
143 PCL_DEBUG (
"ground now has %d points\n", ground.size ());
149 #define PCL_INSTANTIATE_ProgressiveMorphologicalFilter(T) template class pcl::ProgressiveMorphologicalFilter<T>; 151 #endif // PCL_SEGMENTATION_PROGRESSIVE_MORPHOLOGICAL_FILTER_HPP_ float base_
Base to be used in computing progressive window sizes.
float slope_
Slope value to be used in computing the height threshold.
int max_window_size_
Maximum window size to be used in filtering ground returns.
virtual ~ProgressiveMorphologicalFilter()
IndicesPtr indices_
A pointer to the vector of point indices to use.
float initial_distance_
Initial height above the parameterized ground surface to be considered a ground return.
bool exponential_
Exponentially grow window sizes?
bool initCompute()
This method should get called before starting the actual computation.
boost::shared_ptr< PointCloud< PointT > > Ptr
ProgressiveMorphologicalFilter()
Constructor that sets default values for member variables.
float cell_size_
Cell size.
bool deinitCompute()
This method should get called after finishing the actual computation.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
float max_distance_
Maximum height above the parameterized ground surface to be considered a ground return.
PointCloudConstPtr input_
The input point cloud dataset.
virtual void extract(std::vector< int > &ground)
This method launches the segmentation algorithm and returns indices of points determined to be ground...