Formula Student Autonomous Systems
The code for the main driverless system
Loading...
Searching...
No Matches
dbscan.cpp
Go to the documentation of this file.
2
3DBSCAN::DBSCAN(int min_cluster_size, double neighbours_dist_threshold)
4 : min_cluster_size(min_cluster_size), neighbours_dist_threshold(neighbours_dist_threshold) {}
5
6void DBSCAN::clustering(const sensor_msgs::msg::PointCloud2::SharedPtr& input_cloud,
7 std::vector<Cluster>* clusters) const {
8 // pcl::search::KdTree<pcl::PointXYZI>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZI>);
9 // tree->setInputCloud(point_cloud);
10 //
11 // pcl::EuclideanClusterExtraction<pcl::PointXYZI> ec;
12 // ec.setClusterTolerance(neighbours_dist_threshold);
13 // ec.setMinClusterSize(min_cluster_size);
14 //
15 // ec.setSearchMethod(tree);
16 // ec.setInputCloud(point_cloud);
17 //
19 // std::vector<pcl::PointIndices> cluster_indices;
20 // ec.extract(cluster_indices);
21 //
23 // for (const auto& indices : cluster_indices) {
24 // pcl::PointCloud<pcl::PointXYZI>::Ptr cluster(new pcl::PointCloud<pcl::PointXYZI>);
25 // for (const int& index : indices.indices) {
26 // cluster->points.push_back(point_cloud->points[index]);
27 // }
28 // cluster->width = cluster->size();
29 // cluster->height = 1;
30 // cluster->is_dense = true;
31 // clusters->push_back(Cluster(cluster));
32 // }
33}
void clustering(const sensor_msgs::msg::PointCloud2::SharedPtr &point_cloud, std::vector< Cluster > *clusters) const override
Clusters the input point cloud into groups using the DBSCAN algorithm.
Definition dbscan.cpp:6
DBSCAN(int min_cluster_size, double neighbours_dist_threshold)
Constructor for the DBSCAN clustering algorithm.
Definition dbscan.cpp:3