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 
YAML::convert< lvr2::ScanImage >::encode
static Node encode(const lvr2::ScanImage &scanImage)
Definition: ScanImage.hpp:20
YAML
Definition: LSROptionsYamlExtensions.hpp:42
lvr2::Extrinsicsd
Extrinsics< double > Extrinsicsd
4x4 extrinsic calibration (double precision)
Definition: MatrixTypes.hpp:91
ScanTypes.hpp
lvr2::ScanImage::image
cv::Mat image
OpenCV representation.
Definition: ScanTypes.hpp:126
lvr2::ScanImage::extrinsicsEstimate
Extrinsicsd extrinsicsEstimate
Extrinsics estimate.
Definition: ScanTypes.hpp:120
lvr2::convert
void convert(COORD_SYSTEM from, COORD_SYSTEM to, float *point)
Definition: CoordinateTransform.cpp:46
lvr2::ScanImage
Definition: ScanTypes.hpp:107
YAML::convert< lvr2::ScanImage >::decode
static bool decode(const Node &node, lvr2::ScanImage &scanImage)
Definition: ScanImage.hpp:33
MatrixIO.hpp
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::ScanImage::imageFile
boost::filesystem::path imageFile
Path to stored image.
Definition: ScanTypes.hpp:123
lvr2::ScanImage::extrinsics
Extrinsicsd extrinsics
Extrinsics.
Definition: ScanTypes.hpp:117
lvr2::ScanImage::sensorType
static constexpr char sensorType[]
Sensor type flag.
Definition: ScanTypes.hpp:114


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 Wed Mar 2 2022 00:37:25