Apollo 11.0
自动驾驶开放平台
apollo::perception::algorithm::GraphSegmentor类 参考

#include <graph_segmentor.h>

apollo::perception::algorithm::GraphSegmentor 的协作图:

Public 成员函数

 GraphSegmentor ()=default
 
 ~GraphSegmentor ()=default
 
void Init (const float initial_threshold)
 
void SegmentGraph (const int num_vertices, const int num_edges, Edge *edges, bool need_sort=true)
 
Universe * mutable_universe ()
 
const Universe & universe ()
 

详细描述

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

构造及析构函数说明

◆ GraphSegmentor()

apollo::perception::algorithm::GraphSegmentor::GraphSegmentor ( )
default

◆ ~GraphSegmentor()

apollo::perception::algorithm::GraphSegmentor::~GraphSegmentor ( )
default

成员函数说明

◆ Init()

void apollo::perception::algorithm::GraphSegmentor::Init ( const float  initial_threshold)

在文件 graph_segmentor.cc 第 33 行定义.

33 {
34 initial_threshold_ = initial_threshold;
35 thresholds_.reserve(kMaxVerticesNum);
36
37 thresholds_table_.resize(kMaxThresholdsNum);
38 thresholds_table_[0] = std::numeric_limits<float>::max();
39 for (size_t i = 1; i < kMaxThresholdsNum; ++i) {
40 thresholds_table_[i] = GetThreshold(i, initial_threshold_);
41 }
42}

◆ mutable_universe()

Universe * apollo::perception::algorithm::GraphSegmentor::mutable_universe ( )
inline

在文件 graph_segmentor.h 第 55 行定义.

55{ return &universe_; }

◆ SegmentGraph()

void apollo::perception::algorithm::GraphSegmentor::SegmentGraph ( const int  num_vertices,
const int  num_edges,
Edge *  edges,
bool  need_sort = true 
)

在文件 graph_segmentor.cc 第 44 行定义.

45 {
46 if (edges == nullptr) {
47 AERROR << "Input Null Edges.";
48 return;
49 }
50
51 if (need_sort) {
52 std::sort(edges, edges + num_edges);
53 }
54
55 universe_.Reset(num_vertices);
56
57 thresholds_.assign(num_vertices, initial_threshold_);
58 for (int i = 0; i < num_edges; ++i) {
59 Edge& edge = edges[i];
60 int a = universe_.Find(edge.a);
61 int b = universe_.Find(edge.b);
62 if (a == b) {
63 continue;
64 }
65 if (edge.w <= thresholds_[a] && edge.w <= thresholds_[b]) {
66 universe_.Join(a, b);
67 a = universe_.Find(a);
68 int size_a = universe_.GetSize(a);
69 thresholds_[a] =
70 edge.w + (size_a < static_cast<int>(kMaxThresholdsNum)
71 ? thresholds_table_[size_a]
72 : GetThreshold(size_a, initial_threshold_));
73 }
74 }
75}
void Join(const int x, const int y)
void Reset(const int elements_num)
#define AERROR
Definition log.h:44

◆ universe()

const Universe & apollo::perception::algorithm::GraphSegmentor::universe ( )
inline

在文件 graph_segmentor.h 第 57 行定义.

57{ return universe_; }

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