39 #ifndef PCL_GPU_SEGMENTATION_IMPL_EXTRACT_CLUSTERS_H_
40 #define PCL_GPU_SEGMENTATION_IMPL_EXTRACT_CLUSTERS_H_
42 #include <pcl/gpu/segmentation/gpu_extract_clusters.h>
48 std::vector<PointIndices> &clusters,
49 unsigned int min_pts_per_cluster,
50 unsigned int max_pts_per_cluster)
55 std::vector<bool> processed (host_cloud_->
size (),
false);
59 if(max_pts_per_cluster > host_cloud_->
size())
60 max_answers = host_cloud_->
size();
62 max_answers = max_pts_per_cluster;
63 std::cout <<
"Max_answers: " << max_answers << std::endl;
69 queries_device_buffer.
create(max_answers);
72 for (std::size_t i = 0; i < host_cloud_->
size (); ++i)
85 queries_host.
push_back ((*host_cloud_)[i]);
91 unsigned int found_points = queries_host.
size ();
92 unsigned int previous_found_points = 0;
100 std::vector<int> sizes, data;
103 if(queries_host.
size () <= 10)
105 std::cout <<
" CPU: ";
106 for(std::size_t p = 0; p < queries_host.
size (); p++)
109 tree->radiusSearchHost(queries_host[p], tolerance, data, max_answers);
112 previous_found_points = found_points;
114 queries_host.
clear();
117 if(data.size () == 1)
121 for(std::size_t i = 0; i < data.size (); i++)
123 if(processed[data[i]])
125 processed[data[i]] =
true;
126 queries_host.
push_back ((*host_cloud_)[data[i]]);
135 std::cout <<
" GPU: ";
139 queries_device.
upload(queries_host);
141 tree->radiusSearch(queries_device, tolerance, max_answers, result_device);
146 previous_found_points = found_points;
148 queries_host.
clear();
149 for(std::size_t qp = 0; qp < sizes.size (); qp++)
151 for(
int qp_r = 0; qp_r < sizes[qp]; qp_r++)
153 if(processed[data[qp_r + qp * max_answers]])
155 processed[data[qp_r + qp * max_answers]] =
true;
156 queries_host.
push_back ((*host_cloud_)[data[qp_r + qp * max_answers]]);
158 r.
indices.push_back(data[qp_r + qp * max_answers]);
162 std::cout <<
" data.size: " << data.size() <<
" foundpoints: " << found_points <<
" previous: " << previous_found_points;
163 std::cout <<
" new points: " << found_points - previous_found_points <<
" next queries size: " << queries_host.
size() << std::endl;
165 while (previous_found_points < found_points);
167 if (found_points >= min_pts_per_cluster && found_points <= max_pts_per_cluster)
174 clusters.push_back (r);
188 tree_.setCloud(input_);
191 if (!
tree_->isBuilt())
204 std::cout <<
"INFO: end of extractEuclideanClusters " << std::endl;
209 #endif //PCL_GPU_SEGMENTATION_IMPL_EXTRACT_CLUSTERS_H_