Apollo
11.0
自动驾驶开放平台
spp_engine.h
浏览该文件的文档.
1
/******************************************************************************
2
* Copyright 2018 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
#pragma once
17
18
#include <string>
19
20
#include "Eigen/Dense"
21
22
#include "
modules/perception/common/lib/thread/thread_worker.h
"
23
#include "
modules/perception/common/lidar/common/cloud_mask.h
"
24
#include "
modules/perception/lidar_detection/detector/cnn_segmentation/spp_engine/spp_cluster.h
"
25
#include "
modules/perception/lidar_detection/detector/cnn_segmentation/spp_engine/spp_cluster_list.h
"
26
#include "
modules/perception/lidar_detection/detector/cnn_segmentation/spp_engine/spp_seg_cc_2d.h
"
27
#include "
modules/perception/lidar_detection/detector/cnn_segmentation/spp_engine/spp_struct.h
"
28
29
namespace
apollo
{
30
namespace
perception {
31
namespace
lidar {
32
33
class
SppEngine
{
34
public
:
35
SppEngine
() =
default
;
36
~SppEngine
() =
default
;
37
// @brief: initialize spp engine
38
// @param [in]: feature map width
39
// @param [in]: feature map height
40
// @param [in]: feature map range
41
// @param [in]: sensor name
42
void
Init
(
size_t
width,
size_t
height,
float
range,
43
const
SppParams
& param =
SppParams
(),
44
const
std::string& sensor_name =
"velodyne64"
);
45
// @brief: process foreground segmentation
46
// @param [in]: point cloud
47
// @return: size of foreground clusters
48
size_t
ProcessForegroundSegmentation
(
49
const
base::PointFCloudConstPtr
point_cloud);
50
// @brief: remove ground points in foreground cluster
51
// @param [in]: point cloud
52
// @param [in]: roi indices of point cloud
53
// @param [in]: non ground indices in roi of point cloud
54
size_t
RemoveGroundPointsInForegroundCluster
(
55
const
base::PointFCloudConstPtr
full_point_cloud,
56
const
base::PointIndices
& roi_indices,
57
const
base::PointIndices
& roi_non_ground_indices);
58
// @brief: get cluster list, const version
59
// @return: cluster list
60
inline
const
SppClusterList
&
clusters
()
const
{
return
clusters_; }
61
// @brief: get cluster list, const version
62
// @return: cluster list
63
inline
SppClusterList
&
clusters
() {
return
clusters_; }
64
// @brief: get feature data, need to filled first
65
inline
SppData
&
GetSppData
() {
return
data_; }
66
// @brief: get feature data, need to filled first, const version
67
inline
const
SppData
&
GetSppData
()
const
{
return
data_; }
68
69
private
:
70
// @brief: process clustering on input feature map
71
// @param [in]: point cloud
72
// @param [in]: point cloud mask
73
size_t
ProcessConnectedComponentCluster(
74
const
base::PointFCloudConstPtr
point_cloud,
const
CloudMask
& mask);
75
76
private
:
77
// feature size
78
size_t
width_ = 0;
79
size_t
height_ = 0;
80
float
range_ = 0.f;
81
// label image
82
SppLabelImage
labels_2d_;
83
// clusters
84
SppClusterList
clusters_;
85
// cloud mask
86
CloudMask
mask_;
87
CloudMask
roi_mask_;
88
// clustering method
89
SppCCDetector
detector_2d_cc_;
90
// global parameters
91
SppParams
params_;
92
// const spp data pointer
93
SppData
data_;
94
// thread worker for sync data
95
lib::ThreadWorker
worker_;
96
};
97
98
}
// namespace lidar
99
}
// namespace perception
100
}
// namespace apollo
apollo::perception::lib::ThreadWorker
Definition
thread_worker.h:27
apollo::perception::lidar::CloudMask
Definition
cloud_mask.h:26
apollo::perception::lidar::SppCCDetector
Definition
spp_seg_cc_2d.h:28
apollo::perception::lidar::SppClusterList
Definition
spp_cluster_list.h:29
apollo::perception::lidar::SppEngine
Definition
spp_engine.h:33
apollo::perception::lidar::SppEngine::~SppEngine
~SppEngine()=default
apollo::perception::lidar::SppEngine::Init
void Init(size_t width, size_t height, float range, const SppParams ¶m=SppParams(), const std::string &sensor_name="velodyne64")
Definition
spp_engine.cc:26
apollo::perception::lidar::SppEngine::RemoveGroundPointsInForegroundCluster
size_t RemoveGroundPointsInForegroundCluster(const base::PointFCloudConstPtr full_point_cloud, const base::PointIndices &roi_indices, const base::PointIndices &roi_non_ground_indices)
Definition
spp_engine.cc:133
apollo::perception::lidar::SppEngine::SppEngine
SppEngine()=default
apollo::perception::lidar::SppEngine::clusters
const SppClusterList & clusters() const
Definition
spp_engine.h:60
apollo::perception::lidar::SppEngine::GetSppData
const SppData & GetSppData() const
Definition
spp_engine.h:67
apollo::perception::lidar::SppEngine::ProcessForegroundSegmentation
size_t ProcessForegroundSegmentation(const base::PointFCloudConstPtr point_cloud)
Definition
spp_engine.cc:125
apollo::perception::lidar::SppEngine::GetSppData
SppData & GetSppData()
Definition
spp_engine.h:65
apollo::perception::lidar::SppEngine::clusters
SppClusterList & clusters()
Definition
spp_engine.h:63
apollo::perception::lidar::SppLabelImage
Definition
spp_label_image.h:32
cloud_mask.h
apollo::perception::base::PointFCloudConstPtr
std::shared_ptr< const PointFCloud > PointFCloudConstPtr
Definition
point_cloud.h:518
apollo
class register implement
Definition
arena_queue.h:37
spp_cluster.h
spp_cluster_list.h
spp_seg_cc_2d.h
spp_struct.h
apollo::perception::base::PointIndices
Definition
point.h:72
apollo::perception::lidar::SppData
Definition
spp_struct.h:24
apollo::perception::lidar::SppParams
Definition
spp_struct.h:58
thread_worker.h
modules
perception
lidar_detection
detector
cnn_segmentation
spp_engine
spp_engine.h