Apollo 11.0
自动驾驶开放平台
darkSCNN_lane_postprocessor.h
浏览该文件的文档.
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 <string>
19#include <vector>
20
21#include <opencv2/opencv.hpp>
22
23#include "modules/perception/lane_detection/proto/darkSCNN.pb.h"
24#include "modules/perception/lane_detection/proto/darkSCNN_postprocessor.pb.h"
25
33
34namespace apollo {
35namespace perception {
36namespace camera {
37
39 public:
40 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
41
42 template <class EigenType>
44
45 public:
47
48 virtual ~DarkSCNNLanePostprocessor() = default;
49
50 bool Init(const LanePostprocessorInitOptions& options =
52
53 // @brief: detect lane from image.
54 // @param [in]: options
55 // @param [in/out]: frame
56 // detected lanes should be filled, required,
57 // 3D information of lane can be filled, optional.
58 bool Process2D(const LanePostprocessorOptions& options,
59 CameraFrame* frame) override;
60 // convert image point to the camera coordinate
61 // & fit the line using polynomial
62 bool Process3D(const LanePostprocessorOptions& options,
63 CameraFrame* frame) override;
64
65 void SetIm2CarHomography(const Eigen::Matrix3d& homography_im2car) override {
66 Eigen::Matrix3d im2car = homography_im2car;
67 trans_mat_ = im2car.cast<float>();
68 trans_mat_inv = trans_mat_.inverse();
69 }
70
71 // Todo(daohu527): Need define!
72 std::vector<std::vector<LanePointInfo>> GetLanelinePointSet();
73 std::vector<LanePointInfo> GetAllInferLinePointSet();
74
75 std::string Name() const override;
76
77 private:
78 void ConvertImagePoint2Camera(CameraFrame* frame);
79 // @brief: fit camera lane line using polynomial
80 void PolyFitCameraLaneline(CameraFrame* frame);
81
82 private:
83 int input_offset_x_ = 0;
84 int input_offset_y_ = 312;
85 int lane_map_width_ = 640;
86 int lane_map_height_ = 480;
87
88 // this is actually the search range at the original image resolution
89 int roi_height_ = 768;
90 int roi_start_ = 312;
91 int roi_width_ = 1920;
92
93 // minimum number to fit a curve
94 size_t minNumPoints_ = 8;
95
96 int64_t time_1 = 0;
97 int64_t time_2 = 0;
98 int64_t time_3 = 0;
99 int time_num = 0;
100
101 float max_longitudinal_distance_ = 300.0f;
102 float min_longitudinal_distance_ = 0.0f;
103
104 // number of lane type (13)
105 int lane_type_num_;
106
107 lane::DarkSCNNLanePostprocessorParam lane_postprocessor_param_;
108
109 private:
110 Eigen::Matrix<float, 3, 3> trans_mat_;
111 Eigen::Matrix<float, 3, 3> trans_mat_inv;
112 // xy points for the ground plane, uv points for image plane
115};
116
117} // namespace camera
118} // namespace perception
119} // namespace apollo
void SetIm2CarHomography(const Eigen::Matrix3d &homography_im2car) override
bool Init(const LanePostprocessorInitOptions &options=LanePostprocessorInitOptions()) override
bool Process2D(const LanePostprocessorOptions &options, CameraFrame *frame) override
bool Process3D(const LanePostprocessorOptions &options, CameraFrame *frame) override
std::vector< std::vector< LanePointInfo > > GetLanelinePointSet()
std::vector< LanePointInfo > GetAllInferLinePointSet()
std::vector< EigenType, Eigen::aligned_allocator< EigenType > > EigenVector
Definition eigen_defs.h:33
class register implement
Definition arena_queue.h:37