39#ifndef PCL_SEGMENTATION_PROGRESSIVE_MORPHOLOGICAL_FILTER_HPP_
40#define PCL_SEGMENTATION_PROGRESSIVE_MORPHOLOGICAL_FILTER_HPP_
43#include <pcl/common/io.h>
44#include <pcl/filters/morphological_filter.h>
45#include <pcl/segmentation/progressive_morphological_filter.h>
46#include <pcl/point_cloud.h>
50template <
typename Po
intT>
63template <
typename Po
intT>
69template <
typename Po
intT>
void
73 if (!segmentation_is_possible)
80 std::vector<float> height_thresholds;
81 std::vector<float> window_sizes;
83 float window_size = 0.0f;
84 float height_threshold = 0.0f;
104 window_sizes.push_back (window_size);
105 height_thresholds.push_back (height_threshold);
115 for (std::size_t i = 0; i < window_sizes.size (); ++i)
117 PCL_DEBUG (
" Iteration %d (height threshold = %f, window size = %f)...",
118 i, height_thresholds[i], window_sizes[i]);
132 for (std::size_t p_idx = 0; p_idx < ground.size (); ++p_idx)
134 float diff = (*cloud)[p_idx].z - (*cloud_f)[p_idx].z;
135 if (diff < height_thresholds[i])
136 pt_indices.push_back (ground[p_idx]);
140 ground.swap (pt_indices);
142 PCL_DEBUG (
"ground now has %d points\n", ground.size ());
148#define PCL_INSTANTIATE_ProgressiveMorphologicalFilter(T) template class pcl::ProgressiveMorphologicalFilter<T>;
PointCloudConstPtr input_
The input point cloud dataset.
IndicesPtr indices_
A pointer to the vector of point indices to use.
bool initCompute()
This method should get called before starting the actual computation.
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.
shared_ptr< PointCloud< PointT > > Ptr
~ProgressiveMorphologicalFilter()
virtual void extract(Indices &ground)
This method launches the segmentation algorithm and returns indices of points determined to be ground...
float slope_
Slope value to be used in computing the height threshold.
float base_
Base to be used in computing progressive window sizes.
float max_distance_
Maximum height above the parameterized ground surface to be considered a ground return.
float initial_distance_
Initial height above the parameterized ground surface to be considered a ground return.
bool exponential_
Exponentially grow window sizes?
ProgressiveMorphologicalFilter()
Constructor that sets default values for member variables.
int max_window_size_
Maximum window size to be used in filtering ground returns.
float cell_size_
Cell size.
Define standard C methods and C++ classes that are common to all methods.
Defines all the PCL implemented PointT point type structures.
void copyPointCloud(const pcl::PointCloud< PointInT > &cloud_in, pcl::PointCloud< PointOutT > &cloud_out)
Copy all the fields from a given point cloud into a new point cloud.
void applyMorphologicalOperator(const typename pcl::PointCloud< PointT >::ConstPtr &cloud_in, float resolution, const int morphological_operator, pcl::PointCloud< PointT > &cloud_out)
Apply morphological operator to the z dimension of the input point cloud.
IndicesAllocator<> Indices
Type used for indices in PCL.