Apollo 10.0
自动驾驶开放平台
distortion_model.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 <memory>
19#include <string>
20
22
23namespace apollo {
24namespace perception {
25namespace base {
26
28 public:
30 virtual ~BaseCameraDistortionModel() = default;
31
32 // @brief: project a point from camera space to image plane
33 // @params[IN] point3d: 3d point in camera space;
34 // @return: 2d point in image plane
35 // @note: the input point should be in front of the camera,
36 // i.e. point3d[2] > 0
37 virtual Eigen::Vector2f Project(const Eigen::Vector3f& point3d) = 0;
38
39 virtual std::shared_ptr<BaseCameraModel> get_camera_model() = 0;
40 virtual std::string name() const = 0;
41 virtual bool set_params(size_t width, size_t height,
42 const Eigen::VectorXf& params) = 0;
43
44 size_t get_height() const { return height_; }
45 size_t get_width() const { return width_; }
46
47 protected:
48 size_t width_ = 0;
49 size_t height_ = 0;
50};
51
52/* TODO(all): to remove
53typedef std::shared_ptr<BaseCameraDistortionModel> BaseCameraDistortionModelPtr;
54typedef std::shared_ptr<const BaseCameraDistortionModel>
55 BaseCameraDistortionModelConstPtr;
56*/
57
59 public:
60 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
61
62 public:
65
66 Eigen::Vector2f Project(const Eigen::Vector3f& point3d) override;
67
68 std::shared_ptr<BaseCameraModel> get_camera_model() override;
69
70 std::string name() const override { return "BrownCameraDistortionModel"; }
71
72 bool set_params(size_t width, size_t height,
73 const Eigen::VectorXf& params) override;
74
75 inline Eigen::Matrix3f get_intrinsic_params() const {
76 return intrinsic_params_;
77 }
78
79 inline Eigen::Matrix<float, 8, 1> get_distort_params() const {
80 return distort_params_;
81 }
82
83 protected:
84 Eigen::Matrix3f intrinsic_params_;
85 Eigen::Matrix<float, 8, 1> distort_params_;
86};
87
89 std::shared_ptr<BrownCameraDistortionModel>;
90
92 std::shared_ptr<const BrownCameraDistortionModel>;
93
94} // namespace base
95} // namespace perception
96} // namespace apollo
virtual bool set_params(size_t width, size_t height, const Eigen::VectorXf &params)=0
virtual std::shared_ptr< BaseCameraModel > get_camera_model()=0
virtual Eigen::Vector2f Project(const Eigen::Vector3f &point3d)=0
Eigen::Vector2f Project(const Eigen::Vector3f &point3d) override
std::shared_ptr< BaseCameraModel > get_camera_model() override
Eigen::Matrix< float, 8, 1 > get_distort_params() const
bool set_params(size_t width, size_t height, const Eigen::VectorXf &params) override
std::shared_ptr< const BrownCameraDistortionModel > BrownCameraDistortionModelConstPtr
std::shared_ptr< BrownCameraDistortionModel > BrownCameraDistortionModelPtr
class register implement
Definition arena_queue.h:37