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
28
29namespace apollo {
30namespace perception {
31namespace lidar {
32
33class 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
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
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
void Init(size_t width, size_t height, float range, const SppParams &param=SppParams(), const std::string &sensor_name="velodyne64")
Definition spp_engine.cc:26
size_t RemoveGroundPointsInForegroundCluster(const base::PointFCloudConstPtr full_point_cloud, const base::PointIndices &roi_indices, const base::PointIndices &roi_non_ground_indices)
const SppClusterList & clusters() const
Definition spp_engine.h:60
const SppData & GetSppData() const
Definition spp_engine.h:67
size_t ProcessForegroundSegmentation(const base::PointFCloudConstPtr point_cloud)
std::shared_ptr< const PointFCloud > PointFCloudConstPtr
class register implement
Definition arena_queue.h:37