Apollo 11.0
自动驾驶开放平台
apollo::perception::algorithm::ConditionClustering< PointT > 模板类 参考

#include <conditional_clustering.h>

apollo::perception::algorithm::ConditionClustering< PointT > 的协作图:

Public 类型

using IndicesClusters = std::vector< base::PointIndices >
 

Public 成员函数

 ConditionClustering ()=default
 
 ConditionClustering (bool extract_removed_clusters=false)
 
virtual ~ConditionClustering ()=default
 
void set_cloud (typename std::shared_ptr< base::PointCloud< PointT > > cloud)
 
void set_candidate_param (void *param)
 
void set_candidate_function (int(*candidate_function)(const PointT &, void *, std::vector< int > *))
 
void set_condition_param (void *param)
 
void set_condition_function (bool(*condition_function)(const PointT &, const PointT &, void *param))
 
void set_min_cluster_size (size_t size)
 
void set_max_cluster_size (size_t size)
 
void Segment (IndicesClusters *xy_clusters)
 

详细描述

template<typename PointT>
class apollo::perception::algorithm::ConditionClustering< PointT >

在文件 conditional_clustering.h 第 32 行定义.

成员类型定义说明

◆ IndicesClusters

template<typename PointT >
using apollo::perception::algorithm::ConditionClustering< PointT >::IndicesClusters = std::vector<base::PointIndices>

在文件 conditional_clustering.h 第 34 行定义.

构造及析构函数说明

◆ ConditionClustering() [1/2]

template<typename PointT >
apollo::perception::algorithm::ConditionClustering< PointT >::ConditionClustering ( )
default

◆ ConditionClustering() [2/2]

template<typename PointT >
apollo::perception::algorithm::ConditionClustering< PointT >::ConditionClustering ( bool  extract_removed_clusters = false)
inlineexplicit

在文件 conditional_clustering.h 第 37 行定义.

38 : min_cluster_size_(1),
39 max_cluster_size_(std::numeric_limits<int>::max()),
40 extract_removed_clusters_(extract_removed_clusters),
41 small_clusters_(new IndicesClusters),
42 large_clusters_(new IndicesClusters) {}

◆ ~ConditionClustering()

template<typename PointT >
virtual apollo::perception::algorithm::ConditionClustering< PointT >::~ConditionClustering ( )
virtualdefault

成员函数说明

◆ Segment()

template<typename PointT >
void apollo::perception::algorithm::ConditionClustering< PointT >::Segment ( IndicesClusters *  xy_clusters)

在文件 conditional_clustering.h 第 89 行定义.

89 {
90 std::vector<int> nn_indices;
91 nn_indices.reserve(200);
92 std::vector<bool> processed(cloud_->size(), false);
93 // Process all points indexed by indices_
94 for (std::size_t iii = 0; iii < cloud_->size(); ++iii) {
95 if (processed[iii]) {
96 continue;
97 }
98 // Set up a new growing cluster
99 std::vector<int> current_cluster;
100 current_cluster.reserve(200);
101 std::size_t cii = 0;
102 current_cluster.push_back(static_cast<int>(iii));
103 processed[iii] = true;
104 // Process the current cluster
105 // (it can be growing in size as it is being processed)
106 while (cii < current_cluster.size()) {
107 nn_indices.clear();
108 if (candidate_function_(cloud_->at(current_cluster[cii]),
109 candidate_param_, &nn_indices) < 1) {
110 cii++;
111 continue;
112 }
113 for (std::size_t nii = 1; nii < nn_indices.size(); ++nii) {
114 if (nn_indices[nii] < 0 ||
115 nn_indices[nii] >= static_cast<int>(processed.size()) ||
116 processed[nn_indices[nii]]) {
117 continue;
118 }
119 if (condition_function_(cloud_->at(current_cluster[cii]),
120 cloud_->at(nn_indices[nii]),
121 condition_param_)) {
122 current_cluster.push_back(nn_indices[nii]);
123 processed[nn_indices[nii]] = true;
124 }
125 }
126 cii++;
127 }
128
129 if (extract_removed_clusters_ ||
130 (current_cluster.size() >= min_cluster_size_ &&
131 current_cluster.size() <= max_cluster_size_)) {
132 base::PointIndices pi;
133 pi.indices.resize(current_cluster.size());
134 for (int ii = 0; ii < static_cast<int>(current_cluster.size()); ++ii) {
135 pi.indices[ii] = current_cluster[ii];
136 }
137
138 if (extract_removed_clusters_ &&
139 current_cluster.size() < min_cluster_size_) {
140 small_clusters_->push_back(pi);
141 } else if (extract_removed_clusters_ &&
142 current_cluster.size() > max_cluster_size_) {
143 large_clusters_->push_back(pi);
144 } else {
145 xy_clusters->push_back(pi);
146 }
147 }
148 }
149}

◆ set_candidate_function()

template<typename PointT >
void apollo::perception::algorithm::ConditionClustering< PointT >::set_candidate_function ( int(*)(const PointT &, void *, std::vector< int > *)  candidate_function)
inline

在文件 conditional_clustering.h 第 53 行定义.

54 {
55 candidate_function_ = candidate_function;
56 }

◆ set_candidate_param()

template<typename PointT >
void apollo::perception::algorithm::ConditionClustering< PointT >::set_candidate_param ( void *  param)
inline

在文件 conditional_clustering.h 第 51 行定义.

51{ candidate_param_ = param; }

◆ set_cloud()

template<typename PointT >
void apollo::perception::algorithm::ConditionClustering< PointT >::set_cloud ( typename std::shared_ptr< base::PointCloud< PointT > >  cloud)
inline

在文件 conditional_clustering.h 第 46 行定义.

47 {
48 cloud_ = cloud;
49 }

◆ set_condition_function()

template<typename PointT >
void apollo::perception::algorithm::ConditionClustering< PointT >::set_condition_function ( bool(*)(const PointT &, const PointT &, void *param)  condition_function)
inline

在文件 conditional_clustering.h 第 60 行定义.

62 {
63 condition_function_ = condition_function;
64 }

◆ set_condition_param()

template<typename PointT >
void apollo::perception::algorithm::ConditionClustering< PointT >::set_condition_param ( void *  param)
inline

在文件 conditional_clustering.h 第 58 行定义.

58{ condition_param_ = param; }

◆ set_max_cluster_size()

template<typename PointT >
void apollo::perception::algorithm::ConditionClustering< PointT >::set_max_cluster_size ( size_t  size)
inline

在文件 conditional_clustering.h 第 68 行定义.

68{ max_cluster_size_ = size; }

◆ set_min_cluster_size()

template<typename PointT >
void apollo::perception::algorithm::ConditionClustering< PointT >::set_min_cluster_size ( size_t  size)
inline

在文件 conditional_clustering.h 第 66 行定义.

66{ min_cluster_size_ = size; }

该类的文档由以下文件生成: