39 #ifndef PCL_GPU_SEGMENTATION_IMPL_SEEDED_HUE_SEGMENTATION_H_
40 #define PCL_GPU_SEGMENTATION_IMPL_SEEDED_HUE_SEGMENTATION_H_
42 #include <pcl/gpu/segmentation/gpu_seeded_hue_segmentation.h>
49 PointIndices &indices_in,
50 PointIndices &indices_out,
56 std::vector<bool> processed (host_cloud_->
size (),
false);
58 const auto max_answers = host_cloud_->
size();
61 for (std::size_t k = 0; k < indices_in.indices.size (); ++k)
63 int i = indices_in.indices[k];
71 p = (*host_cloud_)[i];
80 queries_host.
push_back ((*host_cloud_)[i]);
82 unsigned int found_points = queries_host.
size ();
83 unsigned int previous_found_points = 0;
88 std::vector<int> sizes, data;
91 while (previous_found_points < found_points)
94 queries_device.
upload(queries_host);
96 tree->radiusSearch(queries_device, tolerance, max_answers, result_device);
99 previous_found_points = found_points;
102 sizes.clear (); data.clear ();
108 for(std::size_t qp = 0; qp < sizes.size (); qp++)
110 for(
int qp_r = 0; qp_r < sizes[qp]; qp_r++)
112 if(processed[data[qp_r + qp * max_answers]])
116 p_l = (*host_cloud_)[data[qp_r + qp * max_answers]];
120 if (std::abs(h_l.h - h.h) < delta_hue)
122 processed[data[qp_r + qp * max_answers]] =
true;
123 queries_host.
push_back ((*host_cloud_)[data[qp_r + qp * max_answers]]);
129 for(std::size_t qp = 0; qp < sizes.size (); qp++)
131 for(
int qp_r = 0; qp_r < sizes[qp]; qp_r++)
133 indices_out.indices.push_back(data[qp_r + qp * max_answers]);
150 if (!
tree_->isBuild())
void push_back(const PointT &pt)
Insert a new point in the cloud, at the end of the container.
std::vector< PointT, Eigen::aligned_allocator< PointT > > VectorType
shared_ptr< PointCloud< PointT > > Ptr
void upload(const T *host_ptr, std::size_t size)
Uploads data to internal buffer in GPU memory.
void download(T *host_ptr) const
Downloads data from internal buffer to CPU memory.
Octree implementation on GPU.
shared_ptr< Octree > Ptr
Types.
PointCloudHostPtr host_cloud_
the original cloud the Host
CloudDevice input_
the input cloud on the GPU
float delta_hue_
The allowed difference on the hue.
double cluster_tolerance_
The spatial cluster tolerance as a measure in the L2 Euclidean space.
void segment(PointIndices &indices_in, PointIndices &indices_out)
Cluster extraction in a PointCloud given by <setInputCloud (), setIndices ()>
GPUTreePtr tree_
A pointer to the spatial search object.
void seededHueSegmentation(const PointCloud< PointXYZRGB > &cloud, const search::Search< PointXYZRGB >::Ptr &tree, float tolerance, PointIndices &indices_in, PointIndices &indices_out, float delta_hue=0.0)
Decompose a region of space into clusters based on the Euclidean distance between points.
void seededHueSegmentation(const pcl::PointCloud< pcl::PointXYZRGB >::Ptr &host_cloud_, const pcl::gpu::Octree::Ptr &tree, float tolerance, PointIndices &clusters_in, PointIndices &clusters_out, float delta_hue=0.0)
void PointXYZRGBtoXYZHSV(const PointXYZRGB &in, PointXYZHSV &out)
Convert a XYZRGB point type to a XYZHSV.