HyperspectralCamera.hpp
Go to the documentation of this file.
1 
2 #ifndef LVR2_IO_YAML_HYPERSPECTRALCAMERAMETA_IO_HPP
3 #define LVR2_IO_YAML_HYPERSPECTRALCAMERAMETA_IO_HPP
4 
5 #include "MatrixIO.hpp"
7 
8 #include <yaml-cpp/yaml.h>
9 
10 namespace YAML
11 {
12 
19 // WRITE HYPERSPECTRALCAMERA PARTIALLY
20 template <>
21 struct convert<lvr2::HyperspectralCamera>
22 {
23 
27  static Node encode(const lvr2::HyperspectralCamera& camera)
28  {
29  Node node;
30 
31  node["sensor_type"] = lvr2::HyperspectralCamera::sensorType;
32 
33  node["focalLength"] = camera.focalLength;
34  node["offsetAngle"] = camera.offsetAngle;
35 
36  node["extrinsics"] = camera.extrinsics;
37  node["extrinsicsEstimate"] = camera.extrinsicsEstimate;
38 
39  node["principal"] = Load("[]");
40  node["principal"].push_back(camera.principal[0]);
41  node["principal"].push_back(camera.principal[1]);
42  node["principal"].push_back(camera.principal[2]);
43 
44  node["distortion"] = Load("[]");
45  node["distortion"].push_back(camera.principal[0]);
46  node["distortion"].push_back(camera.principal[1]);
47  node["distortion"].push_back(camera.principal[2]);
48 
49  return node;
50  }
51 
52  static bool decode(const Node& node, lvr2::HyperspectralCamera& camera)
53  {
54 
55  if (node["sensor_type"].as<std::string>() != lvr2::HyperspectralCamera::sensorType)
56  {
57  return false;
58  }
59 
60  camera.focalLength = node["focalLength"].as<double>();
61  camera.offsetAngle = node["offsetAngle"].as<double>();
62  camera.extrinsics = node["extrinsics"].as<lvr2::Extrinsicsd>();
63  camera.extrinsicsEstimate = node["extrinsicsEstimate"].as<lvr2::Extrinsicsd>();
64 
65  camera.principal[0] = node["principal"][0].as<double>();
66  camera.principal[1] = node["principal"][1].as<double>();
67  camera.principal[2] = node["principal"][1].as<double>();
68 
69  camera.distortion[0] = node["distortion"][0].as<double>();
70  camera.distortion[1] = node["distortion"][1].as<double>();
71  camera.distortion[2] = node["distortion"][1].as<double>();
72 
73  return true;
74  }
75 };
76 
77 } // namespace YAML
78 
79 #endif // LVR2_IO_YAML_HYPERSPECTRALCAMERAMETA_IO_HPP
Vector3d principal
Principal x, y, z.
Definition: ScanTypes.hpp:259
Vector3d distortion
Distortion.
Definition: ScanTypes.hpp:262
static bool decode(const Node &node, lvr2::HyperspectralCamera &camera)
void convert(COORD_SYSTEM from, COORD_SYSTEM to, float *point)
Extrinsicsd extrinsicsEstimate
Extrinsics estimate.
Definition: ScanTypes.hpp:250
double offsetAngle
Offset angle.
Definition: ScanTypes.hpp:256
static constexpr char sensorType[]
Sensor type flag.
Definition: ScanTypes.hpp:241
static Node encode(const lvr2::HyperspectralCamera &camera)
Extrinsicsd extrinsics
Camera model.
Definition: ScanTypes.hpp:247
double focalLength
Focal length.
Definition: ScanTypes.hpp:253
Extrinsics< double > Extrinsicsd
4x4 extrinsic calibration (double precision)
Definition: MatrixTypes.hpp:91


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:06