ScanImage.hpp
Go to the documentation of this file.
1 
2 #ifndef LVR2_IO_YAML_SCANIMAGE_IO_HPP
3 #define LVR2_IO_YAML_SCANIMAGE_IO_HPP
4 
5 #include <sstream>
6 
7 #include <yaml-cpp/yaml.h>
10 
11 namespace YAML {
12 
13 template<>
14 struct convert<lvr2::ScanImage>
15 {
16 
20  static Node encode(const lvr2::ScanImage& scanImage) {
21 
22  Node node;
23  node["sensor_type"] = lvr2::ScanImage::sensorType;
24  node["extrinsics"] = scanImage.extrinsics;
25  node["extrinsics_estimate"] = scanImage.extrinsicsEstimate;
26  node["width"] = scanImage.image.cols;
27  node["height"] = scanImage.image.rows;
28  node["image_file"] = scanImage.imageFile.string();
29 
30  return node;
31  }
32 
33  static bool decode(const Node& node, lvr2::ScanImage& scanImage)
34  {
35  if(node["sensor_type"].as<std::string>() != lvr2::ScanImage::sensorType)
36  {
37  return false;
38  }
39 
40  // Get fields
41  if(node["extrinsics"])
42  {
43  scanImage.extrinsics = node["extrinsics"].as<lvr2::Extrinsicsd>();
44  }
45  else
46  {
47  scanImage.extrinsics = lvr2::Extrinsicsd::Identity();
48  }
49 
50  if(node["extrinsics_estimate"])
51  {
52  scanImage.extrinsicsEstimate = node["extrinsics"].as<lvr2::Extrinsicsd>();
53  }
54  else
55  {
56  scanImage.extrinsicsEstimate = lvr2::Extrinsicsd::Identity();
57  }
58 
59  // Makes no sense to read with and height here...
60 
61  return true;
62  }
63 
64 };
65 
66 } // namespace YAML
67 
68 #endif // LVR2_IO_YAML_PINHOLECAMERAMODEL_IO_HPP
69 
static bool decode(const Node &node, lvr2::ScanImage &scanImage)
Definition: ScanImage.hpp:33
boost::filesystem::path imageFile
Path to stored image.
Definition: ScanTypes.hpp:119
void convert(COORD_SYSTEM from, COORD_SYSTEM to, float *point)
Extrinsicsd extrinsicsEstimate
Extrinsics estimate.
Definition: ScanTypes.hpp:116
static constexpr char sensorType[]
Sensor type flag.
Definition: ScanTypes.hpp:110
static Node encode(const lvr2::ScanImage &scanImage)
Definition: ScanImage.hpp:20
cv::Mat image
OpenCV representation.
Definition: ScanTypes.hpp:122
Extrinsicsd extrinsics
Extrinsics.
Definition: ScanTypes.hpp:113
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:09