ModelToImage.hpp
Go to the documentation of this file.
1 
28 /*
29  * ModelToImage.h
30  *
31  * Created on: Jan 25, 2017
32  * Author: Thomas Wiemann (twiemann@uos.de)
33  */
34 
35 #ifndef SRC_LIBLVR2_RECONSTRUCTION_MODELTOIMAGE_HPP_
36 #define SRC_LIBLVR2_RECONSTRUCTION_MODELTOIMAGE_HPP_
37 
38 #include "lvr2/io/Model.hpp"
39 #include <opencv2/core.hpp>
40 #include <algorithm>
41 #include <vector>
42 #include <tuple>
43 using std::vector;
44 using std::tuple;
45 
46 namespace lvr2
47 {
48 
49 class Projection;
50 
55 class ModelToImage {
56 public:
57 
59  typedef struct
60  {
61  int i;
62  int j;
63  float depth;
64  } DepthPixel;
65 
66  typedef struct PanoPoint
67  {
68  PanoPoint(size_t index_) : index(index_) {}
69  size_t index;
70  } PanoramaPoint;
71 
73  typedef struct DI
74  {
75  vector<vector<float> > pixels;
76  float maxRange;
77  float minRange;
78  DI() :
79  maxRange(std::numeric_limits<float>::lowest()),
80  minRange(std::numeric_limits<float>::max()) {}
81 
82  } DepthImage;
83 
85  typedef struct PLI
86  {
87  vector<vector<vector<PanoramaPoint> > > pixels;
88  float maxRange;
89  float minRange;
90  PLI() :
91  maxRange(std::numeric_limits<float>::lowest()),
92  minRange(std::numeric_limits<float>::max()) {}
94 
95 
103  };
104 
106  {
108  };
109 
111  {
113  };
114 
115 
135  ModelToImage(
136  PointBufferPtr buffer,
137  ProjectionType projection,
138  int width, int height,
139  float minZ, float maxZ,
140  int minHorizontenAngle, int maxHorizontalAngle,
141  int mainVerticalAngle, int maxVerticalAngle,
142  bool imageOptimization = true,
143  CoordinateSystem system = NATIVE);
144 
152  void writePGM(string filename, float cutoff);
153 
155  virtual ~ModelToImage();
156 
158  void getCVMatrix(cv::Mat& image);
159 
160 
171  void computeDepthImage(DepthImage& img, ProjectionPolicy policy = LAST);
172 
181 
182 
187 
188 private:
189 
190 
193 
196 
198  int m_width;
199 
201  int m_height;
202 
205 
208 
211 
214 
217 
220 
222  float m_maxZ;
223 
225  float m_minZ;
226 
227 
228 };
229 
230 } /* namespace lvr2 */
231 
232 #endif /* SRC_LIBLVR2_RECONSTRUCTION_MODELTOIMAGE_HPP_ */
struct lvr2::ModelToImage::DI DepthImage
Image with single depth information.
void getCVMatrix(cv::Mat &image)
float m_maxZ
Maximal z value that will be projected.
void computeDepthListMatrix(DepthListMatrix &mat)
Computes a DepthListMatrix, i.e., an image matrix where each entry holds a vector of all points that ...
ProjectionType
The ProjectionType enum.
Image with list of projected points at each pixel.
virtual ~ModelToImage()
Destructor.
The ModelToImage class provides methods to re-project 3D laser scans to image planes.
struct lvr2::ModelToImage::PLI DepthListMatrix
Image with list of projected points at each pixel.
struct lvr2::ModelToImage::PanoPoint PanoramaPoint
Projection * m_projection
Pointer to projection.
CoordinateSystem m_coordinateSystem
Set this to true if you are using a left-handed coordinate system.
std::shared_ptr< PointBuffer > PointBufferPtr
ModelToImage(PointBufferPtr buffer, ProjectionType projection, int width, int height, float minZ, float maxZ, int minHorizontenAngle, int maxHorizontalAngle, int mainVerticalAngle, int maxVerticalAngle, bool imageOptimization=true, CoordinateSystem system=NATIVE)
Constructor.
int m_maxHAngle
Max horizontal opening angle.
vector< vector< float > > pixels
float m_minZ
Minimal z value that will be projected.
int m_height
Image height.
int m_maxVAngle
Max horizontal opening angle.
void computeDepthImage(DepthImage &img, ProjectionPolicy policy=LAST)
Computes a depth image from the given scan using the specified policy.
int m_minHAngle
Min horizontal opening angle.
void writePGM(string filename, float cutoff)
Writes the scan panaroma to an pgm file.
Pixelcoordinates with depth value.
vector< vector< vector< PanoramaPoint > > > pixels
bool m_optimize
Image optimization flag.
PointBufferPtr m_points
Pointer to the initial point cloud.
int m_minVAngle
Min horizontal opening angle.
Image with single depth information.
int m_width
Image width.
PointBufferPtr pointBuffer()
Retruns the point buffer.


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:08