Apollo 10.0
自动驾驶开放平台
obstacle_reference.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 <map>
19#include <string>
20#include <vector>
21
22#include "modules/perception/camera_tracking/proto/omt.pb.h"
23
28
29namespace apollo {
30namespace perception {
31namespace camera {
32
33struct Reference {
34 float area = 0.0f;
35 float k = 0.0f;
36 float ymax = 0.0f;
37};
38
40 public:
41 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
42 void Init(const ReferenceParam &ref_param, float width, float height);
43 void UpdateReference(const CameraTrackingFrame *frame,
46
47 private:
48 void SyncGroundEstimator(const std::string &sensor,
49 const Eigen::Matrix3f &camera_k_matrix,
50 int img_width, int img_height) {
51 if (ground_estimator_mapper_.find(sensor) ==
52 ground_estimator_mapper_.end()) {
53 auto &ground_estimator = ground_estimator_mapper_[sensor];
54 const float fx = camera_k_matrix(0, 0);
55 const float fy = camera_k_matrix(1, 1);
56 const float cx = camera_k_matrix(0, 2);
57 const float cy = camera_k_matrix(1, 2);
58 std::vector<float> k_mat = {fx, 0, cx, 0, fy, cy, 0, 0, 1};
59 ground_estimator.Init(k_mat, img_width, img_height, algorithm::IRec(fx));
60 }
61 }
62
63 private:
64 ReferenceParam ref_param_;
65 std::map<std::string, std::vector<Reference>> reference_;
66 std::map<std::string, std::vector<std::vector<int>>> ref_map_;
67 std::vector<std::vector<int>> init_ref_map_;
68 float img_width_;
69 float img_height_;
70 int ref_width_;
71 int ref_height_;
72
73 // ground estimator W.R.T different cameras
74 std::map<std::string, CameraGroundPlaneDetector> ground_estimator_mapper_;
75
76 protected:
78};
79} // namespace camera
80} // namespace perception
81} // namespace apollo
EIGEN_MAKE_ALIGNED_OPERATOR_NEW void Init(const ReferenceParam &ref_param, float width, float height)
void UpdateReference(const CameraTrackingFrame *frame, const apollo::common::EigenVector< Target > &targets)
std::vector< EigenType, Eigen::aligned_allocator< EigenType > > EigenVector
Definition eigen_defs.h:33
class register implement
Definition arena_queue.h:37