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/concatenate.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)
65 if (!tree->nearestKSearch (src.
points[i], 1, nn_indices, nn_distances))
67 PCL_WARN (
"No neighbor found for point %zu (%f %f %f)!\n", i, src.
points[i].x, src.
points[i].y, src.
points[i].z);
71 if (nn_distances[0] > threshold)
72 src_indices.push_back (i);
76 output.
points.resize (src_indices.size ());
78 output.
width =
static_cast<uint32_t
> (src_indices.size ());
90 for (
size_t i = 0; i < src_indices.size (); ++i)
98 template <
typename Po
intT>
void
101 output.
header = input_->header;
111 if (target_->points.empty ())
120 if (target_->isOrganized ())
126 tree_->setInputCloud (target_);
133 #define PCL_INSTANTIATE_SegmentDifferences(T) template class PCL_EXPORTS pcl::SegmentDifferences<T>;
134 #define PCL_INSTANTIATE_getPointCloudDifference(T) template PCL_EXPORTS void pcl::getPointCloudDifference<T>(const pcl::PointCloud<T> &, const pcl::PointCloud<T> &, double, const boost::shared_ptr<pcl::search::Search<T> > &, pcl::PointCloud<T> &);
136 #endif // PCL_SEGMENTATION_IMPL_SEGMENT_DIFFERENCES_H_
void getPointCloudDifference(const pcl::PointCloud< PointT > &src, const pcl::PointCloud< PointT > &tgt, 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...
pcl::PCLHeader header
The point cloud header.
uint32_t height
The point cloud height (if organized as an image-structure).
bool is_dense
True if no points are invalid (e.g., have NaN or Inf values).
bool isFinite(const PointT &pt)
Tests if the 3D components of a point are all finite param[in] pt point to be tested.
uint32_t width
The point cloud width (if organized as an image-structure).
OrganizedNeighbor is a class for optimized nearest neigbhor search in organized point clouds...
std::vector< PointT, Eigen::aligned_allocator< PointT > > points
The point data.
void segment(PointCloud &output)
Segment differences between two input point clouds.
Helper functor structure for concatenate.
search::KdTree is a wrapper class which inherits the pcl::KdTree class for performing search function...