Apollo 11.0
自动驾驶开放平台
multi_camera_projection.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
26
27namespace apollo {
28namespace perception {
29namespace trafficlight {
30
32 explicit ProjectOption(const std::string& name) : camera_name(name) {}
33 std::string camera_name;
34};
35
37 std::vector<std::string> camera_names;
38};
39
40// @brief Camera Projection project the Light into the image.
42 public:
60 bool Init(const MultiCamerasInitOption& options);
70 bool Project(const camera::CarPose& pose, const ProjectOption& option,
71 base::TrafficLight* light) const;
79 bool HasCamera(const std::string& camera_name) const;
86 int getImageWidth(const std::string& camera_name) const;
93 int getImageHeight(const std::string& camera_name) const;
99 const std::vector<std::string>& getCameraNamesByDescendingFocalLen() const {
100 return camera_names_;
101 }
102
103 private:
104 bool BoundaryBasedProject(
105 const base::BrownCameraDistortionModelPtr camera_model,
106 const Eigen::Matrix4d& c2w_pose,
107 const std::vector<base::PointXYZID>& point,
108 base::TrafficLight* light) const;
109
110 private:
111 // sorted by focal length in descending order
112 std::vector<std::string> camera_names_;
113 // camera_name -> camera_model
114 std::map<std::string, base::BrownCameraDistortionModelPtr> camera_models_;
115};
116
117} // namespace trafficlight
118} // namespace perception
119} // namespace apollo
bool Project(const camera::CarPose &pose, const ProjectOption &option, base::TrafficLight *light) const
Boundary projection based on vehicle position and traffic lights.
bool Init(const MultiCamerasInitOption &options)
multicamera project initialization parameters.
bool HasCamera(const std::string &camera_name) const
Determine whether the camera exists.
int getImageWidth(const std::string &camera_name) const
Get the image width object.
MultiCamerasProjection()
Construct a new multi cameras projection object.
~MultiCamerasProjection()=default
Destroy the multi cameras projection object.
int getImageHeight(const std::string &camera_name) const
Get the image height object.
const std::vector< std::string > & getCameraNamesByDescendingFocalLen() const
Get the camera names by descending focal len object.
std::shared_ptr< BrownCameraDistortionModel > BrownCameraDistortionModelPtr
class register implement
Definition arena_queue.h:37