Apollo  6.0
Open source self driving car software
frame.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2019 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 <set>
19 #include <string>
20 #include <vector>
23 
24 namespace apollo {
25 namespace perception {
26 namespace benchmark {
27 
28 class Frame : protected SensorObjects {
29  public:
31 
32  // Four elements should be loaded
33  // 1. point cloud: _point_cloud
34  // 2. result_objects: objects
35  // 3. ground truth objects: gt_objects
36  // 4. pose: sensor2world_pose
37  bool load(const std::vector<std::string>& filenames);
38 
39  inline std::string get_name() const { return name; }
40 
41  inline const PointCloudConstPtr get_point_cloud() const {
42  return _point_cloud;
43  }
44 
45  inline const std::vector<ObjectPtr>& get_objects() const { return objects; }
46 
47  inline const std::vector<ObjectPtr>& get_gt_objects() const {
48  return gt_objects;
49  }
50 
51  inline const std::vector<std::vector<Eigen::Vector3d>>&
53  return objects_box_vertices;
54  }
55 
56  inline const std::vector<std::vector<Eigen::Vector3d>>&
59  }
60  inline const std::vector<PointCloud>& get_left_boundary() const {
61  return _left_boundary;
62  }
63  inline const std::vector<PointCloud>& get_right_boundary() const {
64  return _right_boundary;
65  }
66  inline const std::vector<PointCloud>& get_left_lane_boundary() const {
67  return _left_lane_boundary;
68  }
69  inline const std::vector<PointCloud>& get_right_lane_boundary() const {
70  return _right_lane_boundary;
71  }
72  inline const std::vector<PointCloud>& get_road_polygon() const {
73  return _road_polygon;
74  }
75  inline void release() {
76  _point_cloud = nullptr;
77  objects.clear();
78  gt_objects.clear();
79  _left_boundary.clear();
80  _right_boundary.clear();
81  _left_lane_boundary.clear();
82  _right_lane_boundary.clear();
83  _road_polygon.clear();
84  }
85 
86  static void set_black_list(const std::set<std::string>& black_list);
87 
88  static void set_is_for_visualization(bool for_visualization);
89 
90  static void set_visible_threshold(float threshold);
91 
92  static void set_min_confidence(float confidence);
93 
94  protected:
95  // Two things should be done,
96  // 1. transform points in objects to indices
97  // 2. calculate points and indices in each gt objects if not exist;
98  void build_indices();
99 
100  void build_points();
101 
102  private:
103  void build_objects_indices(const pcl::KdTreeFLANN<Point>& point_cloud_kdtree,
104  std::vector<ObjectPtr>* objects_out);
105 
106  void build_objects_points(std::vector<ObjectPtr>* objects_out);
107 
108  protected:
110  std::vector<PointCloud> _left_boundary;
111  std::vector<PointCloud> _right_boundary;
112  std::vector<PointCloud> _left_lane_boundary;
113  std::vector<PointCloud> _right_lane_boundary;
114  std::vector<PointCloud> _road_polygon;
115  std::vector<PointCloud> _lane_polygon;
116  static std::set<std::string> _s_black_list;
119  static float _s_visible_threshold;
120  static float _s_min_confidence;
121 };
122 
123 } // namespace benchmark
124 } // namespace perception
125 } // namespace apollo
static float _s_min_confidence
Definition: frame.h:120
static float _s_visible_threshold
Definition: frame.h:119
const std::vector< std::vector< Eigen::Vector3d > > & get_objects_box_vertices() const
Definition: frame.h:52
std::string get_name() const
Definition: frame.h:39
static void set_visible_threshold(float threshold)
std::vector< PointCloud > _right_lane_boundary
Definition: frame.h:113
const PointCloudConstPtr get_point_cloud() const
Definition: frame.h:41
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
pcl::PointCloud< Point >::ConstPtr PointCloudConstPtr
Definition: types.h:66
SensorType type
Definition: object.h:169
const std::vector< PointCloud > & get_right_lane_boundary() const
Definition: frame.h:69
static bool _s_is_for_visualization
Definition: frame.h:117
std::vector< PointCloud > _left_boundary
Definition: frame.h:110
std::vector< std::vector< Eigen::Vector3d > > objects_box_vertices
Definition: object.h:174
std::vector< PointCloud > _left_lane_boundary
Definition: frame.h:112
const std::vector< PointCloud > & get_road_polygon() const
Definition: frame.h:72
const std::vector< ObjectPtr > & get_objects() const
Definition: frame.h:45
Frame()
Definition: frame.h:30
pcl::PointCloud< Point >::Ptr PointCloudPtr
Definition: types.h:65
const std::vector< PointCloud > & get_left_lane_boundary() const
Definition: frame.h:66
std::vector< ObjectPtr > objects
Definition: object.h:173
std::vector< PointCloud > _right_boundary
Definition: frame.h:111
const std::vector< std::vector< Eigen::Vector3d > > & get_gt_objects_box_vertices() const
Definition: frame.h:57
bool load(const std::vector< std::string > &filenames)
PointCloudPtr _point_cloud
Definition: frame.h:109
static std::set< std::string > _s_black_list
Definition: frame.h:116
static void set_is_for_visualization(bool for_visualization)
static float _s_distance_to_roi_boundary
Definition: frame.h:118
void release()
Definition: frame.h:75
std::vector< std::vector< Eigen::Vector3d > > gt_objects_box_vertices
Definition: object.h:176
static void set_min_confidence(float confidence)
std::string name
Definition: object.h:170
std::vector< ObjectPtr > gt_objects
Definition: object.h:175
Image< uchar > * threshold(Image< T > *src, int t)
Definition: imutil.h:63
const std::vector< PointCloud > & get_left_boundary() const
Definition: frame.h:60
std::vector< PointCloud > _lane_polygon
Definition: frame.h:115
static void set_black_list(const std::set< std::string > &black_list)
const std::vector< PointCloud > & get_right_boundary() const
Definition: frame.h:63
std::vector< PointCloud > _road_polygon
Definition: frame.h:114
const std::vector< ObjectPtr > & get_gt_objects() const
Definition: frame.h:47