38 #ifndef PCL_SEGMENTATION_IMPL_SEGMENT_DIFFERENCES_H_
39 #define PCL_SEGMENTATION_IMPL_SEGMENT_DIFFERENCES_H_
41 #include <pcl/segmentation/segment_differences.h>
42 #include <pcl/common/io.h>
45 template <
typename Po
intT>
void
53 std::vector<int> nn_indices (1);
54 std::vector<float> nn_distances (1);
57 std::vector<int> src_indices;
60 for (
int i = 0; i < static_cast<int> (src.
points.size ()); ++i)
66 if (!tree->nearestKSearch (src.
points[i], 1, nn_indices, nn_distances))
68 PCL_WARN (
"No neighbor found for point %lu (%f %f %f)!\n", i, src.
points[i].x, src.
points[i].y, src.
points[i].z);
72 if (nn_distances[0] > threshold)
73 src_indices.push_back (i);
86 template <
typename Po
intT>
void
89 output.
header = input_->header;
99 if (target_->points.empty ())
108 if (target_->isOrganized ())
114 tree_->setInputCloud (target_);
121 #define PCL_INSTANTIATE_SegmentDifferences(T) template class PCL_EXPORTS pcl::SegmentDifferences<T>;
122 #define PCL_INSTANTIATE_getPointCloudDifference(T) template PCL_EXPORTS void pcl::getPointCloudDifference<T>(const pcl::PointCloud<T> &, double, const boost::shared_ptr<pcl::search::Search<T> > &, pcl::PointCloud<T> &);
124 #endif // PCL_SEGMENTATION_IMPL_SEGMENT_DIFFERENCES_H_
bool isFinite(const PointT &pt)
Tests if the 3D components of a point are all finite param[in] pt point to be tested return true if f...
uint32_t width
The point cloud width (if organized as an image-structure).
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 segment(PointCloud &output)
Segment differences between two input point clouds.
std::vector< PointT, Eigen::aligned_allocator< PointT > > points
The point data.
void getPointCloudDifference(const pcl::PointCloud< PointT > &src, double threshold, const boost::shared_ptr< pcl::search::Search< PointT > > &tree, pcl::PointCloud< PointT > &output)
Obtain the difference between two aligned point clouds as another point cloud, given a distance thres...
uint32_t height
The point cloud height (if organized as an image-structure).
PointCloud represents the base class in PCL for storing collections of 3D points. ...
OrganizedNeighbor is a class for optimized nearest neigbhor search in organized point clouds...
bool is_dense
True if no points are invalid (e.g., have NaN or Inf values in any of their floating point fields)...
pcl::PCLHeader header
The point cloud header.