supereight
Loading...
Searching...
No Matches
pinhole_camera.hpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020-2022 Smart Robotics Lab, Imperial College London, Technical University of Munich
3 * SPDX-FileCopyrightText: 2020-2022 Nils Funk
4 * SPDX-FileCopyrightText: 2020-2022 Sotiris Papatheodorou
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8#ifndef SE_PINHOLE_CAMERA_HPP
9#define SE_PINHOLE_CAMERA_HPP
10
11
12
13namespace se {
14
15class PinholeCamera : public SensorBase<PinholeCamera> {
16 public:
17 struct Config : public SensorBase<PinholeCamera>::Config {
20 float fx = std::numeric_limits<float>::quiet_NaN();
21
24 float fy = std::numeric_limits<float>::quiet_NaN();
25
28 float cx = std::numeric_limits<float>::quiet_NaN();
29
32 float cy = std::numeric_limits<float>::quiet_NaN();
33
37 void readYaml(const std::string& filename);
38
40
41 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
42 };
43
58
61 enum {
69 };
70 };
71
72
73
75
77
79
80 int computeIntegrationScaleImpl(const Eigen::Vector3f& block_centre,
81 const float map_res,
82 const int last_scale,
83 const int min_scale,
84 const int max_block_scale) const;
85
86 float nearDistImpl(const Eigen::Vector3f& ray_S) const;
87
88 float farDistImpl(const Eigen::Vector3f& ray_S) const;
89
90 float measurementFromPointImpl(const Eigen::Vector3f& point_S) const;
91
92 bool pointInFrustumImpl(const Eigen::Vector3f& point_S) const;
93
94 bool pointInFrustumInfImpl(const Eigen::Vector3f& point_S) const;
95
96 bool sphereInFrustumImpl(const Eigen::Vector3f& centre_S, const float radius) const;
97
98 bool sphereInFrustumInfImpl(const Eigen::Vector3f& centre_S, const float radius) const;
99
100 static std::string typeImpl();
101
104
105 srl::projection::PinholeCamera<srl::projection::NoDistortion> model;
107
110
113
115 Eigen::Matrix<float, 3, FrustumVertex::Num> frustum_vertices_S;
116
118 Eigen::Matrix<float, 4, FrustumNormal::Num> frustum_normals_S;
119
120 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
121
122 private:
123 void computeFrustumVertices();
124 void computeFrustumNormals();
125};
126
127std::ostream& operator<<(std::ostream& os, const PinholeCamera::Config& c);
128
129} // namespace se
130
131#include "impl/pinhole_camera_impl.hpp"
132
133#endif // SE_PINHOLE_CAMERA_HPP
Definition image.hpp:19
Definition pinhole_camera.hpp:15
int computeIntegrationScaleImpl(const Eigen::Vector3f &block_centre, const float map_res, const int last_scale, const int min_scale, const int max_block_scale) const
static std::string typeImpl()
PinholeCamera(const Config &config, const float downsampling_factor)
Eigen::Matrix< float, 3, FrustumVertex::Num > frustum_vertices_S
The vertices of the camera frustum expressed in the camera frame S.
Definition pinhole_camera.hpp:115
PinholeCamera(const Config &config)
bool sphereInFrustumImpl(const Eigen::Vector3f &centre_S, const float radius) const
Eigen::Matrix< float, 4, FrustumNormal::Num > frustum_normals_S
The inwards-pointing normals of the camera frustum faces expressed in the camera frame S.
Definition pinhole_camera.hpp:118
srl::projection::PinholeCamera< srl::projection::NoDistortion > model
Definition pinhole_camera.hpp:105
float farDistImpl(const Eigen::Vector3f &ray_S) const
bool pointInFrustumImpl(const Eigen::Vector3f &point_S) const
float horizontal_fov
The horizontal field of view in radians.
Definition pinhole_camera.hpp:109
float nearDistImpl(const Eigen::Vector3f &ray_S) const
float vertical_fov
The vertical field of view in radians.
Definition pinhole_camera.hpp:112
static PinholeCamera testInstance()
Return an se::PinholeCamera instance for use in unit tests requiring one.
float measurementFromPointImpl(const Eigen::Vector3f &point_S) const
bool sphereInFrustumInfImpl(const Eigen::Vector3f &centre_S, const float radius) const
PinholeCamera(const PinholeCamera &pinhole_camera, const float downsampling_factor)
float scaled_pixel
Definition pinhole_camera.hpp:106
bool pointInFrustumInfImpl(const Eigen::Vector3f &point_S) const
Base class for all sensor models used for integrating measurements.
Definition sensor.hpp:26
Helper wrapper to allocate and de-allocate octants in the octree.
Definition bounded_vector.hpp:14
std::ostream & operator<<(std::ostream &os, const ColourData< Colour::Off >::Config &c)
Definition pinhole_camera.hpp:17
void readYaml(const std::string &filename)
Reads the struct members from the "sensor" node of a YAML file.
float fy
The sensor's vertical focal length in pixels.
Definition pinhole_camera.hpp:24
Config operator/(const float downsampling_factor) const
float cx
The sensor's optical centre horizontal coordinate in pixels.
Definition pinhole_camera.hpp:28
float cy
The sensor's optical centre vertical coordinate in pixels.
Definition pinhole_camera.hpp:32
float fx
The sensor's horizontal focal length in pixels.
Definition pinhole_camera.hpp:20
Linear indices to se::PinholeCamera::frustum_normals_S and number of frustum normals.
Definition pinhole_camera.hpp:60
@ Left
Definition pinhole_camera.hpp:62
@ Num
Definition pinhole_camera.hpp:68
@ Far
Definition pinhole_camera.hpp:67
@ Top
Definition pinhole_camera.hpp:65
@ Right
Definition pinhole_camera.hpp:63
@ Near
Definition pinhole_camera.hpp:66
@ Bottom
Definition pinhole_camera.hpp:64
Linear indices to se::PinholeCamera::frustum_vertices_S and number of frustum vertices.
Definition pinhole_camera.hpp:45
@ TopLeftFar
Definition pinhole_camera.hpp:51
@ BottomRightFar
Definition pinhole_camera.hpp:53
@ BottomLeftFar
Definition pinhole_camera.hpp:54
@ TopLeftNear
Definition pinhole_camera.hpp:47
@ TopRightNear
Definition pinhole_camera.hpp:48
@ Num
Definition pinhole_camera.hpp:55
@ BottomRightNear
Definition pinhole_camera.hpp:49
@ BottomLeftNear
Definition pinhole_camera.hpp:50
@ TopRightFar
Definition pinhole_camera.hpp:52