blob: cbad8bf3d2c3da603a67da71f2ee3bc1b420c398 [file] [log] [blame]
Parker Schuhe9a549a2019-02-24 16:29:22 -08001#ifndef _Y2019_VISION_CONSTANTS_H_
2#define _Y2019_VISION_CONSTANTS_H_
3
4#include <math.h>
5#include <array>
6#include <string>
7
8namespace y2019 {
9namespace vision {
10
11// Position of the idealized camera in 3d space.
12struct CameraGeometry {
13 // In Meters from floor under imu center.
14 std::array<double, 3> location{{0, 0, 0}};
15 double heading = 0.0;
16
17 void set(double *data) {
18 location[0] = data[0];
19 location[1] = data[1];
20 location[2] = data[2];
21 heading = data[3];
22 }
23 static CameraGeometry get(const double *data) {
24 CameraGeometry out;
25 out.location[0] = data[0];
26 out.location[1] = data[1];
27 out.location[2] = data[2];
28 out.heading = data[3];
29 return out;
30 }
31};
32
33struct IntrinsicParams {
34 static constexpr size_t kNumParams = 3;
35
36 double mount_angle = 0.819433 / 180.0 * M_PI; // 9.32615 / 180.0 * M_PI;
37 double focal_length = 666.763; // 734.328;
38 // This is a final rotation where the camera isn't straight.
39 double barrel_mount = 2.72086 / 180.0 * M_PI;
40
41 void set(double *data) {
42 data[0] = mount_angle;
43 data[1] = focal_length;
44 data[2] = barrel_mount;
45 }
46 static IntrinsicParams get(const double *data) {
47 IntrinsicParams out;
48 out.mount_angle = data[0];
49 out.focal_length = data[1];
50 out.barrel_mount = data[2];
51 return out;
52 }
53};
54
55// Metadata about the calibration results (Should be good enough to reproduce).
56struct DatasetInfo {
57 int camera_id;
58 // In meters from IMU start.
59 std::array<double, 2> to_tape_measure_start;
60 // In meters,
61 std::array<double, 2> tape_measure_direction;
62 // This will multiply tape_measure_direction and thus has no units.
63 double beginning_tape_measure_reading;
64 const char *filename_prefix;
65};
66
67struct CameraCalibration {
68 IntrinsicParams intrinsics;
69 CameraGeometry geometry;
70 DatasetInfo dataset;
71};
72
73const CameraCalibration *GetCamera(int camera_id);
74
75} // namespace vision
76} // namespace y2019
77
78#endif // _Y2019_VISION_CONSTANTS_H_