72 bool segmentation_is_possible = initCompute ();
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;
86 while (window_size < max_window_size_)
90 window_size = cell_size_ * (2.0f * std::pow (base_, iteration) + 1.0f);
92 window_size = cell_size_ * (2.0f * (iteration+1) * base_ + 1.0f);
96 height_threshold = initial_distance_;
98 height_threshold = slope_ * (window_size - window_sizes[iteration-1]) * cell_size_ + initial_distance_;
101 if (height_threshold > max_distance_)
102 height_threshold = max_distance_;
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 ());
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.