Apollo 11.0
自动驾驶开放平台
graph_segmentation.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2023 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17#pragma once
18
19#include <limits>
20#include <map>
21#include <memory>
22#include <string>
23#include <utility>
24#include <vector>
25
26#include "modules/perception/lidar_segmentation/segmentor/graph_segmentation/proto/graph_segmentation_config.pb.h"
27
28#include "cyber/common/file.h"
29#include "cyber/common/log.h"
37
38namespace apollo {
39namespace perception {
40namespace lidar {
41
43public:
44 GraphSegmentation() = default;
45 ~GraphSegmentation() = default;
53 bool Init(const LidarDetectorInitOptions& options = LidarDetectorInitOptions()) override;
62 bool Detect(const LidarDetectorOptions& options, LidarFrame* frame) override;
68 std::string Name() const override {
69 return "GraphSegmentation";
70 }
78 bool Segment(LidarFrame* frame);
90 float NodeDistance(BgNode n1, int x1, int y1, BgNode n2, int x2, int y2);
97
105 bool Split(LidarFrame* frame);
106
114 bool NeedSplit(std::shared_ptr<base::Object> object);
115
121 bool SetBgObjectDefaulVal(LidarFrame* frame);
122
123private:
124 int grid_width_;
125 int grid_height_;
126 float resolution_;
127 float threshold_;
128 size_t min_pt_number_;
129 int search_radius_;
130 float height_threshold_;
131 float semantic_cost_ = 2.0;
132 BackgroundMap bg_map_;
133 algorithm::GraphSegmentor graph_segmentor_;
134 SppClusterList clusters_;
135 GraphSegmentationConfig bg_config_;
136 std::vector<std::shared_ptr<base::Object>> bg_objects_;
137};
138
139} // namespace lidar
140} // namespace perception
141} // namespace apollo
bool SetBgObjectDefaulVal(LidarFrame *frame)
Set the Bacground Object Defaul Value
float NodeDistance(BgNode n1, int x1, int y1, BgNode n2, int x2, int y2)
Compute node distance
bool Segment(LidarFrame *frame)
Graph segment
bool NeedSplit(std::shared_ptr< base::Object > object)
judge if the object need to split
bool Detect(const LidarDetectorOptions &options, LidarFrame *frame) override
Segment pointcloud into objects
bool Split(LidarFrame *frame)
background filter
void GetObjectsFromClusters(LidarFrame *frame)
Get the Objects From Clusters
std::string Name() const override
Get class name
bool Init(const LidarDetectorInitOptions &options=LidarDetectorInitOptions()) override
Init graph segmentation
class register implement
Definition arena_queue.h:37