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_ */
lvr2::ModelToImage::DI
Image with single depth information.
Definition: ModelToImage.hpp:73
lvr2::ModelToImage::~ModelToImage
virtual ~ModelToImage()
Destructor.
Definition: ModelToImage.cpp:86
lvr2::ModelToImage::DepthImage
struct lvr2::ModelToImage::DI DepthImage
Image with single depth information.
lvr2::ModelToImage::MAXRANGE
@ MAXRANGE
Definition: ModelToImage.hpp:107
lvr2::ModelToImage::ProjectionPolicy
ProjectionPolicy
Definition: ModelToImage.hpp:105
lvr2::ModelToImage::m_projection
Projection * m_projection
Pointer to projection.
Definition: ModelToImage.hpp:192
lvr2::ModelToImage::DI::maxRange
float maxRange
Definition: ModelToImage.hpp:76
lvr2::ModelToImage::m_points
PointBufferPtr m_points
Pointer to the initial point cloud.
Definition: ModelToImage.hpp:195
lvr2::ModelToImage::PanoPoint
Definition: ModelToImage.hpp:66
lvr2::ModelToImage::PLI::pixels
vector< vector< vector< PanoramaPoint > > > pixels
Definition: ModelToImage.hpp:87
lvr2::PointBufferPtr
std::shared_ptr< PointBuffer > PointBufferPtr
Definition: PointBuffer.hpp:130
lvr2::ModelToImage::DI::pixels
vector< vector< float > > pixels
Definition: ModelToImage.hpp:75
lvr2::ModelToImage::m_minVAngle
int m_minVAngle
Min horizontal opening angle.
Definition: ModelToImage.hpp:210
lvr2::Projection
Definition: Projection.hpp:37
lvr2::ModelToImage::PLI
Image with list of projected points at each pixel.
Definition: ModelToImage.hpp:85
lvr2::ModelToImage::DepthPixel::i
int i
Definition: ModelToImage.hpp:61
lvr2::ModelToImage::m_maxVAngle
int m_maxVAngle
Max horizontal opening angle.
Definition: ModelToImage.hpp:213
lvr2::ModelToImage::getCVMatrix
void getCVMatrix(cv::Mat &image)
lvr2::ModelToImage::FIRST
@ FIRST
Definition: ModelToImage.hpp:107
lvr2::ModelToImage::m_coordinateSystem
CoordinateSystem m_coordinateSystem
Set this to true if you are using a left-handed coordinate system.
Definition: ModelToImage.hpp:219
lvr2::ModelToImage::NATIVE
@ NATIVE
Definition: ModelToImage.hpp:112
lvr2::ModelToImage::CYLINDRICAL
@ CYLINDRICAL
Definition: ModelToImage.hpp:100
lvr2::ModelToImage::EQUALAREACYLINDRICAL
@ EQUALAREACYLINDRICAL
Definition: ModelToImage.hpp:100
lvr2::ModelToImage::MINRANGE
@ MINRANGE
Definition: ModelToImage.hpp:107
lvr2::ModelToImage::m_minHAngle
int m_minHAngle
Min horizontal opening angle.
Definition: ModelToImage.hpp:204
lvr2::ModelToImage::UOS
@ UOS
Definition: ModelToImage.hpp:112
lvr2::ModelToImage::DI::minRange
float minRange
Definition: ModelToImage.hpp:77
scripts.normalize_multiple.filename
filename
Definition: normalize_multiple.py:60
lvr2::ModelToImage::STEREOGRAPHIC
@ STEREOGRAPHIC
Definition: ModelToImage.hpp:101
lvr2::ModelToImage::m_maxHAngle
int m_maxHAngle
Max horizontal opening angle.
Definition: ModelToImage.hpp:207
lvr2::ModelToImage::DepthPixel
Pixelcoordinates with depth value.
Definition: ModelToImage.hpp:59
lvr2::ModelToImage::CONICAL
@ CONICAL
Definition: ModelToImage.hpp:100
lvr2::ModelToImage::ModelToImage
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.
Definition: ModelToImage.cpp:52
lvr2::ModelToImage::CoordinateSystem
CoordinateSystem
Definition: ModelToImage.hpp:110
Model.hpp
lvr2::ModelToImage::COLOR
@ COLOR
Definition: ModelToImage.hpp:107
lvr2::ModelToImage::DepthPixel::depth
float depth
Definition: ModelToImage.hpp:63
lvr2::ModelToImage::ZAXIS
@ ZAXIS
Definition: ModelToImage.hpp:102
lvr2::ModelToImage
The ModelToImage class provides methods to re-project 3D laser scans to image planes.
Definition: ModelToImage.hpp:55
lvr2::ModelToImage::PanoPoint::index
size_t index
Definition: ModelToImage.hpp:69
lvr2::ModelToImage::writePGM
void writePGM(string filename, float cutoff)
Writes the scan panaroma to an pgm file.
Definition: ModelToImage.cpp:192
lvr2::ModelToImage::SLAM6D
@ SLAM6D
Definition: ModelToImage.hpp:112
lvr2::ModelToImage::pointBuffer
PointBufferPtr pointBuffer()
Retruns the point buffer.
Definition: ModelToImage.hpp:186
lvr2::ModelToImage::AZIMUTHAL
@ AZIMUTHAL
Definition: ModelToImage.hpp:102
lvr2::ModelToImage::PanoPoint::PanoPoint
PanoPoint(size_t index_)
Definition: ModelToImage.hpp:68
std
Definition: HalfEdge.hpp:124
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::ModelToImage::ProjectionType
ProjectionType
The ProjectionType enum.
Definition: ModelToImage.hpp:99
lvr2::ModelToImage::LAST
@ LAST
Definition: ModelToImage.hpp:107
lvr2::ModelToImage::m_width
int m_width
Image width.
Definition: ModelToImage.hpp:198
lvr2::ModelToImage::m_maxZ
float m_maxZ
Maximal z value that will be projected.
Definition: ModelToImage.hpp:222
lvr2::ModelToImage::INTENSITY
@ INTENSITY
Definition: ModelToImage.hpp:107
lvr2::ModelToImage::PLI::maxRange
float maxRange
Definition: ModelToImage.hpp:88
lvr2::ModelToImage::m_height
int m_height
Image height.
Definition: ModelToImage.hpp:201
lvr2::ModelToImage::AVERAGE
@ AVERAGE
Definition: ModelToImage.hpp:107
lvr2::ModelToImage::DepthPixel::j
int j
Definition: ModelToImage.hpp:62
lvr2::ModelToImage::PanoramaPoint
struct lvr2::ModelToImage::PanoPoint PanoramaPoint
lvr2::ModelToImage::computeDepthImage
void computeDepthImage(DepthImage &img, ProjectionPolicy policy=LAST)
Computes a depth image from the given scan using the specified policy.
Definition: ModelToImage.cpp:143
lvr2::ModelToImage::DepthListMatrix
struct lvr2::ModelToImage::PLI DepthListMatrix
Image with list of projected points at each pixel.
lvr2::ModelToImage::DI::DI
DI()
Definition: ModelToImage.hpp:78
lvr2::ModelToImage::RECTILINEAR
@ RECTILINEAR
Definition: ModelToImage.hpp:101
lvr2::ModelToImage::computeDepthListMatrix
void computeDepthListMatrix(DepthListMatrix &mat)
Computes a DepthListMatrix, i.e., an image matrix where each entry holds a vector of all points that ...
Definition: ModelToImage.cpp:91
lvr2::ModelToImage::PLI::minRange
float minRange
Definition: ModelToImage.hpp:89
lvr2::ModelToImage::m_minZ
float m_minZ
Minimal z value that will be projected.
Definition: ModelToImage.hpp:225
lvr2::ModelToImage::PANNINI
@ PANNINI
Definition: ModelToImage.hpp:101
lvr2::ModelToImage::PLI::PLI
PLI()
Definition: ModelToImage.hpp:90
lvr2::ModelToImage::m_optimize
bool m_optimize
Image optimization flag.
Definition: ModelToImage.hpp:216


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