Apollo 11.0
自动驾驶开放平台
birdview_img_feature_renderer.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2020 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
22#pragma once
23
24#include <string>
25#include <utility>
26#include <vector>
27
28#include "opencv2/opencv.hpp"
29
30#include "modules/planning/planning_base/proto/learning_data.pb.h"
31#include "modules/planning/planning_base/proto/planning_semantic_map_config.pb.h"
32
33#include "cyber/common/macros.h"
35
36namespace apollo {
37namespace planning {
38
40 public:
44 virtual ~BirdviewImgFeatureRenderer() = default;
45
50 bool Init(const PlanningSemanticMapConfig& config);
51
57 bool RenderMultiChannelEnv(const LearningDataFrame& learning_data_frame,
58 cv::Mat* img_feature);
59
65 bool RenderBGREnv(const LearningDataFrame& learning_data_frame,
66 cv::Mat* img_feature);
67
73 bool RenderCurrentEgoStatus(const LearningDataFrame& learning_data_frame,
74 cv::Mat* img_feature);
75
81 bool RenderCurrentEgoPoint(const LearningDataFrame& learning_data_frame,
82 cv::Mat* img_feature);
83
89 bool RenderCurrentEgoBox(const LearningDataFrame& learning_data_frame,
90 cv::Mat* img_feature);
91
92 private:
97 bool LoadRoadMap(const std::string& map_file);
98
103 bool LoadSpeedlimitMap(const std::string& map_file);
104
112 bool RenderLocalRoadMap(const double ego_current_x,
113 const double ego_current_y,
114 const double ego_current_heading,
115 cv::Mat* img_feature);
116
124 bool RenderLocalSpeedlimitMap(const double ego_current_x,
125 const double ego_current_y,
126 const double ego_current_heading,
127 cv::Mat* img_feature);
128
135 bool RenderEgoCurrentPoint(cv::Mat* img_feature,
136 const cv::Scalar& gray_scale = cv::Scalar(255),
137 const cv::Scalar& bgr_color = cv::Scalar(255, 255,
138 255));
139
146 bool RenderEgoCurrentBox(cv::Mat* img_feature,
147 const cv::Scalar& gray_scale = cv::Scalar(255),
148 const cv::Scalar& bgr_color = cv::Scalar(255, 255,
149 255));
150
162 bool RenderEgoPastPoint(
163 const LearningDataFrame& learning_data_frame,
164 const double current_time_sec, const double ego_current_x,
165 const double ego_current_y, const double ego_current_heading,
166 cv::Mat* img_feature, const cv::Scalar& gray_scale = cv::Scalar(255),
167 const cv::Scalar& bgr_color = cv::Scalar(255, 255, 255));
168
179 bool RenderObsPastBox(const LearningDataFrame& learning_data_frame,
180 const double current_time_sec, cv::Mat* img_feature,
181 const cv::Scalar& gray_scale = cv::Scalar(255),
182 const cv::Scalar& bgr_color = cv::Scalar(0, 255, 0));
183
194 bool RenderObsFutureBox(const LearningDataFrame& learning_data_frame,
195 const double current_time_sec, cv::Mat* img_feature,
196 const cv::Scalar& gray_scale = cv::Scalar(255),
197 const cv::Scalar& bgr_color = cv::Scalar(0, 0, 255));
198
210 bool RenderTrafficLight(
211 const LearningDataFrame& learning_data_frame, const double ego_current_x,
212 const double ego_current_y, const double ego_current_heading,
213 cv::Mat* img_feature, const cv::Scalar& gray_scale = cv::Scalar(255),
214 const cv::Scalar& bgr_color = cv::Scalar(255, 255, 255));
215
226 bool RenderRouting(const LearningDataFrame& learning_data_frame,
227 const double ego_current_x, const double ego_current_y,
228 const double ego_current_heading, cv::Mat* img_feature,
229 const cv::Scalar& gray_scale = cv::Scalar(255),
230 const cv::Scalar& bgr_color = cv::Scalar(255, 255, 255));
231
240 bool CropByPose(const double ego_x, const double ego_y,
241 const double ego_heading, const cv::Mat& base_map,
242 cv::Mat* img_feature);
243
253 cv::Point2i GetPointImgIdx(const double local_point_x,
254 const double local_point_y,
255 const int center_point_idx_x,
256 const int center_point_idx_y);
257
267 cv::Point2i GetAffinedPointImgIdx(const double point_x, const double point_y,
268 const double center_x,
269 const double center_y, const double theta);
270
283 std::vector<cv::Point2i> GetAffinedBoxImgIdx(
284 const double box_center_x, const double box_center_y,
285 const double box_theta,
286 const std::vector<std::pair<double, double>>& box_corner_points,
287 const double center_x, const double center_y, const double theta);
288
290 common::VehicleConfig ego_vehicle_config_;
291 cv::Mat base_roadmap_img_;
292 cv::Mat base_speedlimit_img_;
293 double map_bottom_left_point_x_ = 0.0;
294 double map_bottom_left_point_y_ = 0.0;
295 cv::Mat ego_cur_point_img_;
296 cv::Mat ego_cur_box_img_;
297 cv::Mat stacked_ego_cur_status_img_;
298
300};
301} // namespace planning
302} // namespace apollo
bool RenderBGREnv(const LearningDataFrame &learning_data_frame, cv::Mat *img_feature)
generate bgr img as input feature for certain model
bool RenderCurrentEgoPoint(const LearningDataFrame &learning_data_frame, cv::Mat *img_feature)
generate a single channel img
bool Init(const PlanningSemanticMapConfig &config)
initialize renderer
virtual ~BirdviewImgFeatureRenderer()=default
Destructor
bool RenderCurrentEgoBox(const LearningDataFrame &learning_data_frame, cv::Mat *img_feature)
generate a single channel img
bool RenderMultiChannelEnv(const LearningDataFrame &learning_data_frame, cv::Mat *img_feature)
generate multi-channel img as input feature for certain model
bool RenderCurrentEgoStatus(const LearningDataFrame &learning_data_frame, cv::Mat *img_feature)
generate a two channel img, one for cur box, one for cur point
Planning module main class.
#define DECLARE_SINGLETON(classname)
Definition macros.h:52
class register implement
Definition arena_queue.h:37