UosIO.hpp
Go to the documentation of this file.
1 
35 #ifndef UOSIO_H_
36 #define UOSIO_H_
37 
38 #define _USE_MATH_DEFINES
39 
40 #include <string>
41 #include <iomanip>
42 #include <iostream>
43 #include <math.h>
44 #include <fstream>
45 #include <sstream>
46 #include <vector>
47 
48 #include "lvr2/io/BaseIO.hpp"
49 #include "lvr2/io/AsciiIO.hpp"
50 
53 
54 using std::string;
55 using std::fstream;
56 using std::stringstream;
57 
58 namespace lvr2
59 {
60 
61 using Vec = BaseVector<float>;
62 
74 class UosIO : public BaseIO
75 {
76 
77 public:
78 
82  UosIO() :
83  m_firstScan(-1),
84  m_lastScan(-1),
85  m_saveToDisk(false),
87  m_numScans(0),
88  m_saveRemission(false),
89  m_saveRemissionColor(false){}
90 
98  ModelPtr read(string dir);
99 
100 
105  void setFirstScan(int n) { m_firstScan = n;}
106 
107 
112  void setLastScan(int n) {m_lastScan = n;}
113 
114 
123  void reduce(string dir, string target, int reduction = 1);
124 
125 
130  void save(string filename) {}
131 
132 
133 
138 
139 
143  void saveRemission(bool yes) { m_saveRemission= yes;}
144 
145 
153  Matrix4<Vec> parseFrameFile(ifstream& frameFile);
154 
155 private:
156 
164  void readNewFormat(ModelPtr &m, string dir, int first, int last, size_t &n);
165 
166 
174  void readOldFormat(ModelPtr &m, string dir, int first, int last, size_t &n);
175 
176 
177  inline std::string to_string(const int& t, int width)
178  {
179  stringstream ss;
180  ss << std::setfill('0') << std::setw(width) << t;
181  return ss.str();
182  }
183 
184 
185  inline std::string to_string(const int& t)
186  {
187  stringstream ss;
188  ss << t;
189  return ss.str();
190  }
191 
192 
202  inline float rad(const float deg)
203  {
204  return (float)((2 * M_PI * deg) / 360);
205  }
206 
207 
214  inline float deg(const float rad)
215  {
216  return (float)((rad * 360) / (2 * M_PI));
217  }
218 
219 
222 
225 
228 
230  ofstream m_outputFile;
231 
234 
237 
240 
243 
244 };
245 
246 } // namespace lvr2
247 
248 #endif /* UOSIO_H_ */
lvr2::UosIO::setLastScan
void setLastScan(int n)
Defines the last scan to read.
Definition: UosIO.hpp:112
lvr2::UosIO::to_string
std::string to_string(const int &t)
Definition: UosIO.hpp:185
BaseVector.hpp
lvr2::UosIO::m_saveRemissionColor
bool m_saveRemissionColor
If true, remission values will be converted to color.
Definition: UosIO.hpp:239
lvr2::Matrix4
A 4x4 matrix class implementation for use with the provided vertex types.
Definition: Matrix4.hpp:64
lvr2::UosIO::readOldFormat
void readOldFormat(ModelPtr &m, string dir, int first, int last, size_t &n)
Reads scans from first} to last} in old UOS format.
Definition: UosIO.cpp:517
lvr2::UosIO::m_reductionTarget
int m_reductionTarget
Number of targeted points for reduction.
Definition: UosIO.hpp:236
lvr2::UosIO::setFirstScan
void setFirstScan(int n)
Defines the first scan to read.
Definition: UosIO.hpp:105
lvr2::UosIO::saveRemissionAsColor
void saveRemissionAsColor(bool convert)
Convert remission value to pseudo RGB values while saving.
Definition: UosIO.hpp:137
lvr2::UosIO::m_saveRemission
bool m_saveRemission
If true, the original remission information will be saved.
Definition: UosIO.hpp:242
AsciiIO.hpp
Read and write pointclouds from .pts and .3d files.
lvr2::UosIO::m_firstScan
int m_firstScan
The first scan to read (or -1 if all scans should be processed)
Definition: UosIO.hpp:221
lvr2::UosIO::m_lastScan
int m_lastScan
The last scan to read (or -1 if all scans should be processed)
Definition: UosIO.hpp:224
lvr2::UosIO::saveRemission
void saveRemission(bool yes)
Save remission (if present)
Definition: UosIO.hpp:143
lvr2::UosIO::m_saveToDisk
bool m_saveToDisk
If true, the read point will not be stored in local memory.
Definition: UosIO.hpp:227
lvr2::UosIO::reduce
void reduce(string dir, string target, int reduction=1)
Definition: UosIO.cpp:180
lvr2::UosIO::UosIO
UosIO()
Contructor.
Definition: UosIO.hpp:82
lvr2::UosIO::rad
float rad(const float deg)
Definition: UosIO.hpp:202
M_PI
#define M_PI
Definition: Matrix4.hpp:52
lvr2::UosIO::to_string
std::string to_string(const int &t, int width)
Definition: UosIO.hpp:177
lvr2::UosIO
An input class for laser scans in UOS 3d format.
Definition: UosIO.hpp:74
lvr2::UosIO::save
void save(string filename)
Definition: UosIO.hpp:130
scripts.normalize_multiple.filename
filename
Definition: normalize_multiple.py:60
lvr2::convert
void convert(COORD_SYSTEM from, COORD_SYSTEM to, float *point)
Definition: CoordinateTransform.cpp:46
lvr2::UosIO::m_numScans
int m_numScans
Number of loaded scans.
Definition: UosIO.hpp:233
Vec
BaseVector< float > Vec
Definition: src/tools/lvr2_cuda_normals/Main.cpp:57
lvr2::UosIO::deg
float deg(const float rad)
Definition: UosIO.hpp:214
lvr2::UosIO::parseFrameFile
Matrix4< Vec > parseFrameFile(ifstream &frameFile)
Creates a transformation matrix from given frame file.
Definition: UosIO.cpp:708
BaseIO.hpp
Base interface for all I/O related classes.
Matrix4.hpp
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::ModelPtr
std::shared_ptr< Model > ModelPtr
Definition: Model.hpp:80
lvr2::UosIO::readNewFormat
void readNewFormat(ModelPtr &m, string dir, int first, int last, size_t &n)
Reads scans from first} to last} in new UOS format.
Definition: UosIO.cpp:201
first
void first(int id)
Definition: example.cpp:7
lvr2::UosIO::m_outputFile
ofstream m_outputFile
Filestream to save reduced data.
Definition: UosIO.hpp:230
lvr2::BaseIO
Interface specification for low-level io. All read elements are stored in linear arrays.
Definition: BaseIO.hpp:57
lvr2::UosIO::read
ModelPtr read(string dir)
Reads all scans or an specified range of scans from the given directory.
Definition: UosIO.cpp:59


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