40 #ifndef PCL_FILTERS_IMPL_RADIUS_OUTLIER_REMOVAL_H_
41 #define PCL_FILTERS_IMPL_RADIUS_OUTLIER_REMOVAL_H_
43 #include <pcl/filters/radius_outlier_removal.h>
44 #include <pcl/common/io.h>
47 template <
typename Po
intT>
void
50 std::vector<int> indices;
53 bool temp = extract_removed_indices_;
54 extract_removed_indices_ =
true;
55 applyFilterIndices (indices);
56 extract_removed_indices_ = temp;
59 for (
int rii = 0; rii < static_cast<int> (removed_indices_->size ()); ++rii)
60 output.
points[(*removed_indices_)[rii]].x = output.
points[(*removed_indices_)[rii]].y = output.
points[(*removed_indices_)[rii]].z = user_filter_value_;
61 if (!pcl_isfinite (user_filter_value_))
66 applyFilterIndices (indices);
72 template <
typename Po
intT>
void
75 if (search_radius_ == 0.0)
77 PCL_ERROR (
"[pcl::%s::applyFilter] No radius defined!\n", getClassName ().c_str ());
79 removed_indices_->clear ();
86 if (input_->isOrganized ())
91 searcher_->setInputCloud (input_);
94 std::vector<int> nn_indices (indices_->size ());
95 std::vector<float> nn_dists (indices_->size ());
96 indices.resize (indices_->size ());
97 removed_indices_->resize (indices_->size ());
100 for (std::vector<int>::const_iterator it = indices_->begin (); it != indices_->end (); ++it)
104 int k = searcher_->radiusSearch (*it, search_radius_, nn_indices, nn_dists);
108 if ((!negative_ && k <= min_pts_radius_) || (negative_ && k > min_pts_radius_))
110 if (extract_removed_indices_)
111 (*removed_indices_)[rii++] = *it;
116 indices[oii++] = *it;
120 indices.resize (oii);
121 removed_indices_->resize (rii);
124 #define PCL_INSTANTIATE_RadiusOutlierRemoval(T) template class PCL_EXPORTS pcl::RadiusOutlierRemoval<T>;
126 #endif // PCL_FILTERS_IMPL_RADIUS_OUTLIER_REMOVAL_H_
PCL_EXPORTS void copyPointCloud(const pcl::PCLPointCloud2 &cloud_in, const std::vector< int > &indices, pcl::PCLPointCloud2 &cloud_out)
Extract the indices of a given point cloud as a new point cloud.
void applyFilterIndices(std::vector< int > &indices)
Filtered results are indexed by an indices array.
std::vector< PointT, Eigen::aligned_allocator< PointT > > points
The point data.
bool is_dense
True if no points are invalid (e.g., have NaN or Inf values).
void applyFilter(PointCloud &output)
Filtered results are stored in a separate point cloud.
OrganizedNeighbor is a class for optimized nearest neigbhor search in organized point clouds...
PointCloud represents the base class in PCL for storing collections of 3D points. ...
search::KdTree is a wrapper class which inherits the pcl::KdTree class for performing search function...