SyB3R - Synthetic Benchmark for 3D Reconstruction
Image.h
1 #ifndef IMAGE_H
2 #define IMAGE_H
3 
4 #include "Camera.h"
5 
6 #include <string>
7 #include <boost/optional.hpp>
8 #include <boost/filesystem.hpp>
9 
10 #include <Eigen/Dense>
11 
12 #include <cstdint>
13 
14 namespace tinyxml2 {
15  class XMLElement;
16 }
17 
18 namespace syb3r {
19 namespace data {
20 
21 class Image
22 {
23  public:
24  static Image readFromSceneXML(const tinyxml2::XMLElement *imageNode, const boost::filesystem::path &sceneRoot);
25 
26  Image(const Camera &camera, const boost::filesystem::path &hdrFilename, const boost::filesystem::path &attribFilename);
27 
28  inline const Camera &getCamera() const { return m_camera; }
29  inline unsigned getFrameIdx() const { return m_frameIdx; }
30  inline const std::string &getCameraName() const { return m_cameraName; }
31 
32  inline const boost::filesystem::path &getHDRFilename() const { return m_hdrFilename; }
33  inline const boost::filesystem::path &getAttribFilename() const { return m_attribFilename; }
34 
35  typedef Eigen::Array<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> FloatArray;
36  typedef Eigen::Array<std::uint32_t, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> UIntArray;
37  FloatArray readDistanceMap() const;
38  FloatArray readZBuffer(unsigned subsamplingStride = 1) const;
39  FloatArray computeZBuffer(const FloatArray &distanceMap, unsigned subsamplingStride = 1) const;
40  UIntArray readObjectID() const;
41 
42  void extractPointcloud(std::vector<Eigen::Vector3f> &position, std::vector<unsigned> *objectId = nullptr, unsigned subsamplingStride = 1) const;
43  protected:
44  Camera m_camera;
45  unsigned m_frameIdx = ~0u;
46  std::string m_cameraName;
47 
48  boost::filesystem::path m_hdrFilename;
49  boost::filesystem::path m_attribFilename;
50 
51  boost::optional<float> m_focalLength;
52  boost::optional<float> m_sensorWidth;
53  boost::optional<float> m_fNumber;
54 };
55 
56 }
57 }
58 
59 #endif // IMAGE_H
Definition: CameraPathEvaluation.cpp:10
Definition: Image.h:21
Definition: Camera.h:6
Internal and external camera parameters.
Definition: Camera.h:17