LargeScaleReconstruction.hpp
Go to the documentation of this file.
1 
28 #ifndef LAS_VEGAS_LARGESCALERECONSTRUCTION_HPP
29 #define LAS_VEGAS_LARGESCALERECONSTRUCTION_HPP
30 
31 #include "lvr2/types/ScanTypes.hpp"
36 
37 
38 namespace lvr2
39 {
40  struct LSROptions
41  {
42  //flag to trigger .ply output of big Mesh
43  bool bigMesh = true;
44 
45  // flag to trigger .ply output of chunks
46  bool debugChunks = false;
47 
48  // flag to trigger GPU usage
49  bool useGPU = false;
50 
51  // voxelsizes for reconstruction.
52  std::vector<float> voxelSizes{0.1};
53 
54  // voxelsize for the BigGrid.
55  float bgVoxelSize = 1;
56 
57  // scale factor.
58  float scale = 1;
59 
60  // Max. Number of Points in a leaf (used to devide pointcloud).
61  uint nodeSize = 1000000;
62 
63  // int flag to trigger partition-method (0 = kd-Tree; 1 = VGrid)
64  int partMethod = 1;
65 
66  //Number of normals used in the normal interpolation process.
67  int ki = 20;
68 
69  //Number of normals used for distance function evaluation.
70  int kd = 20;
71 
72  // Size of k-neighborhood used for normal estimation.
73  int kn = 20;
74 
75  //Set this flag for RANSAC based normal estimation.
76  bool useRansac = false;
77 
78  // FlipPoint for GPU normal computation
79  std::vector<float> flipPoint{10000000, 10000000, 10000000};
80 
81  // Do not extend grid. Can be used to avoid artifacts in dense data sets but. Disabling
82  // will possibly create additional holes in sparse data sets.
83  bool extrude = false;
84 
85  /*
86  * Definition from here on are for the combine-process of partial meshes
87  */
88 
89  // number for the removal of dangling artifacts.
91 
92  //Remove noise artifacts from contours. Same values are between 2 and 4.
93  int cleanContours = 0;
94 
95  //Maximum size for hole filling.
96  int fillHoles = 0;
97 
98  // Shift all triangle vertices of a cluster onto their shared plane.
99  bool optimizePlanes = false;
100 
101  // (Plane Normal Threshold) Normal threshold for plane optimization.
102  float planeNormalThreshold = 0.85;
103 
104  // Number of iterations for plane optimization.
106 
107  // Minimum value for plane optimization.
108  int minPlaneSize = 7;
109 
110  // Threshold for small region removal. If 0 nothing will be deleted.
112 
113  // Retesselate regions that are in a regression plane. Implies --optimizePlanes.
114  bool retesselate = false;
115 
116  // Threshold for fusing line segments while tesselating.
117  float lineFusionThreshold = 0.01;
118 
119  vector<float> getFlipPoint() const
120  {
121  std::vector<float> dest = flipPoint;
122  if(dest.size() != 3)
123  {
124  std::vector<float> dest = std::vector<float>();
125  dest.push_back(10000000);
126  dest.push_back(10000000);
127  dest.push_back(10000000);
128  }
129  return dest;
130  }
131  };
132 
133  template <typename BaseVecT>
135  {
136 
137 
138  public:
143 
144 
148  LargeScaleReconstruction(vector<float> voxelSizes, float bgVoxelSize, float scale,
149  uint nodeSize, int partMethod,int ki, int kd, int kn, bool useRansac, std::vector<float> flipPoint,
150  bool extrude, int removeDanglingArtifacts, int cleanContours, int fillHoles, bool optimizePlanes,
151  float getNormalThreshold, int planeIterations, int minPlaneSize, int smallRegionThreshold,
152  bool retesselate, float lineFusionThreshold, bool bigMesh, bool debugChunks, bool useGPU);
153 
159 
169  int mpiChunkAndReconstruct(ScanProjectEditMarkPtr project, BoundingBox<BaseVecT>& newChunksBB, std::shared_ptr<ChunkHashGrid> chunkManager);
170 
178 
188  HalfEdgeMesh<BaseVecT> getPartialReconstruct(BoundingBox<BaseVecT> newChunksBB, std::shared_ptr<ChunkHashGrid> chunkHashGrid, float voxelSize);
189 
190 
191 
192 
193  private:
194 
203  void addTSDFChunkManager(int x, int y, int z,
205  shared_ptr<ChunkHashGrid> cm,
206  std::string layerName);
207 
208  //flag to trigger .ply output of big Mesh
209  bool m_bigMesh = true;
210 
211  // flag to trigger .ply output of chunks
212  bool m_debugChunks = false;
213 
214  // flag to trigger GPU usage
215  bool m_useGPU = false;
216 
217  // path to hdf5 path containing previously reconstructed scans (or no scans) only
218  string m_filePath;
219 
220  // voxelsize for reconstruction. Default: 10
221  vector <float> m_voxelSizes;
222 
223  // voxelsize for the BigGrid. Default: 10
225 
226  // scale factor. Default: 1
227  float m_scale;
228 
229  //ChunkSize, should be constant through all processes . Default: 20
230  float m_chunkSize;
231 
232  // Max. Number of Points in a leaf (used to devide pointcloud). Default: 1000000
234 
235  // int flag to trigger partition-method (0 = kd-Tree; 1 = VGrid)
237 
238  //Number of normals used in the normal interpolation process. Default: 10
239  int m_ki;
240 
241  //Number of normals used for distance function evaluation. Default: 5
242  int m_kd;
243 
244  // Size of k-neighborhood used for normal estimation. Default: 10
245  int m_kn;
246 
247  // flipPoint for GPU normal computation
248  std::vector<float> m_flipPoint;
249 
250  //Set this flag for RANSAC based normal estimation. Default: false
252 
253  // Do not extend grid. Can be used to avoid artifacts in dense data sets but. Disabling
254  // will possibly create additional holes in sparse data sets. Default: false
255  bool m_extrude;
256 
257  /*
258  * Definition from here on are for the combine-process of partial meshes
259  */
260 
261  // flag to trigger the removal of dangling artifacts. Default: 0
263 
264  //Remove noise artifacts from contours. Same values are between 2 and 4. Default: 0
266 
267  //Maximum size for hole filling. Default: 0
269 
270  // Shift all triangle vertices of a cluster onto their shared plane. Default: false
272 
273  // (Plane Normal Threshold) Normal threshold for plane optimization. Default: 0.85
275 
276  // Number of iterations for plane optimization. Default: 3
278 
279  // Minimum value for plane optimization. Default: 7
281 
282  // Threshold for small region removal. If 0 nothing will be deleted. Default: 0
284 
285  // Retesselate regions that are in a regression plane. Implies --optimizePlanes. Default: false
287 
288  // Threshold for fusing line segments while tesselating. Default: 0.01
290 
291 
292  };
293 } // namespace lvr2
294 
295 #include "lvr2/reconstruction/LargeScaleReconstruction.tcc"
296 
297 #endif // LAS_VEGAS_LARGESCALERECONSTRUCTION_HPP
lvr2::LSROptions::scale
float scale
Definition: LargeScaleReconstruction.hpp:58
lvr2::ScanProjectEditMarkPtr
std::shared_ptr< ScanProjectEditMark > ScanProjectEditMarkPtr
Definition: ScanTypes.hpp:357
lvr2::LargeScaleReconstruction::mpiChunkAndReconstruct
int mpiChunkAndReconstruct(ScanProjectEditMarkPtr project, BoundingBox< BaseVecT > &newChunksBB, std::shared_ptr< ChunkHashGrid > chunkManager)
lvr2::LSROptions::ki
int ki
Definition: LargeScaleReconstruction.hpp:67
lvr2::LargeScaleReconstruction::addTSDFChunkManager
void addTSDFChunkManager(int x, int y, int z, shared_ptr< lvr2::PointsetGrid< BaseVector< float >, lvr2::FastBox< BaseVector< float >>>> ps_grid, shared_ptr< ChunkHashGrid > cm, std::string layerName)
lvr2::BaseVector< float >
lvr2::LargeScaleReconstruction::m_minPlaneSize
int m_minPlaneSize
Definition: LargeScaleReconstruction.hpp:280
lvr2::LargeScaleReconstruction::m_kn
int m_kn
Definition: LargeScaleReconstruction.hpp:245
FastBox.hpp
lvr2::LSROptions::partMethod
int partMethod
Definition: LargeScaleReconstruction.hpp:64
lvr2::LSROptions::lineFusionThreshold
float lineFusionThreshold
Definition: LargeScaleReconstruction.hpp:117
lvr2::LSROptions::kn
int kn
Definition: LargeScaleReconstruction.hpp:73
lvr2::LSROptions::extrude
bool extrude
Definition: LargeScaleReconstruction.hpp:83
lvr2::LSROptions::useGPU
bool useGPU
Definition: LargeScaleReconstruction.hpp:49
lvr2::LargeScaleReconstruction::getPartialReconstruct
HalfEdgeMesh< BaseVecT > getPartialReconstruct(BoundingBox< BaseVecT > newChunksBB, std::shared_ptr< ChunkHashGrid > chunkHashGrid, float voxelSize)
lvr2::LSROptions
Definition: LargeScaleReconstruction.hpp:40
lvr2::FastBox
A volume representation used by the standard Marching Cubes implementation.
Definition: FastBox.hpp:65
lvr2::LSROptions::bgVoxelSize
float bgVoxelSize
Definition: LargeScaleReconstruction.hpp:55
lvr2::LargeScaleReconstruction::m_voxelSizes
vector< float > m_voxelSizes
Definition: LargeScaleReconstruction.hpp:221
lvr2::LSROptions::smallRegionThreshold
int smallRegionThreshold
Definition: LargeScaleReconstruction.hpp:111
lvr2::LargeScaleReconstruction::m_cleanContours
int m_cleanContours
Definition: LargeScaleReconstruction.hpp:265
HalfEdgeMesh.hpp
lvr2::LSROptions::debugChunks
bool debugChunks
Definition: LargeScaleReconstruction.hpp:46
lvr2::LargeScaleReconstruction::LargeScaleReconstruction
LargeScaleReconstruction()
lvr2::LSROptions::voxelSizes
std::vector< float > voxelSizes
Definition: LargeScaleReconstruction.hpp:52
lvr2::LargeScaleReconstruction::m_debugChunks
bool m_debugChunks
Definition: LargeScaleReconstruction.hpp:212
ScanTypes.hpp
lvr2::LSROptions::cleanContours
int cleanContours
Definition: LargeScaleReconstruction.hpp:93
lvr2::LargeScaleReconstruction::m_ki
int m_ki
Definition: LargeScaleReconstruction.hpp:239
options
const kaboom::Options * options
Definition: src/tools/lvr2_kaboom/Main.cpp:45
lvr2::LSROptions::fillHoles
int fillHoles
Definition: LargeScaleReconstruction.hpp:96
lvr2::LargeScaleReconstruction::m_scale
float m_scale
Definition: LargeScaleReconstruction.hpp:227
lvr2::LargeScaleReconstruction::m_bgVoxelSize
float m_bgVoxelSize
Definition: LargeScaleReconstruction.hpp:224
lvr2::LSROptions::useRansac
bool useRansac
Definition: LargeScaleReconstruction.hpp:76
lvr2::LargeScaleReconstruction::m_kd
int m_kd
Definition: LargeScaleReconstruction.hpp:242
lvr2::LargeScaleReconstruction::m_planeNormalThreshold
float m_planeNormalThreshold
Definition: LargeScaleReconstruction.hpp:274
lvr2::LargeScaleReconstruction::m_optimizePlanes
bool m_optimizePlanes
Definition: LargeScaleReconstruction.hpp:271
PointsetGrid.hpp
lvr2::LargeScaleReconstruction::m_smallRegionThreshold
int m_smallRegionThreshold
Definition: LargeScaleReconstruction.hpp:283
lvr2::LargeScaleReconstruction::m_lineFusionThreshold
float m_lineFusionThreshold
Definition: LargeScaleReconstruction.hpp:289
lvr2::LSROptions::planeNormalThreshold
float planeNormalThreshold
Definition: LargeScaleReconstruction.hpp:102
lvr2::LSROptions::planeIterations
int planeIterations
Definition: LargeScaleReconstruction.hpp:105
lvr2::BoundingBox
A dynamic bounding box class.
Definition: BoundingBox.hpp:49
lvr2::LargeScaleReconstruction::m_chunkSize
float m_chunkSize
Definition: LargeScaleReconstruction.hpp:230
lvr2::LSROptions::retesselate
bool retesselate
Definition: LargeScaleReconstruction.hpp:114
lvr2::LSROptions::removeDanglingArtifacts
int removeDanglingArtifacts
Definition: LargeScaleReconstruction.hpp:90
lvr2::LargeScaleReconstruction::m_nodeSize
uint m_nodeSize
Definition: LargeScaleReconstruction.hpp:233
lvr2::LargeScaleReconstruction::m_partMethod
int m_partMethod
Definition: LargeScaleReconstruction.hpp:236
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::LSROptions::nodeSize
uint nodeSize
Definition: LargeScaleReconstruction.hpp:61
lvr2::LargeScaleReconstruction::m_planeIterations
int m_planeIterations
Definition: LargeScaleReconstruction.hpp:277
lvr2::LargeScaleReconstruction::m_retesselate
bool m_retesselate
Definition: LargeScaleReconstruction.hpp:286
lvr2::LargeScaleReconstruction::mpiAndReconstruct
int mpiAndReconstruct(ScanProjectEditMarkPtr project)
lvr2::LargeScaleReconstruction::m_filePath
string m_filePath
Definition: LargeScaleReconstruction.hpp:218
lvr2::LargeScaleReconstruction
Definition: LargeScaleReconstruction.hpp:134
lvr2::LargeScaleReconstruction::m_flipPoint
std::vector< float > m_flipPoint
Definition: LargeScaleReconstruction.hpp:248
uint
unsigned int uint
Definition: Model.hpp:46
lvr2::LSROptions::optimizePlanes
bool optimizePlanes
Definition: LargeScaleReconstruction.hpp:99
ChunkManager.hpp
lvr2::PointsetGrid
Definition: PointsetGrid.hpp:47
lvr2::LargeScaleReconstruction::m_useGPU
bool m_useGPU
Definition: LargeScaleReconstruction.hpp:215
lvr2::LargeScaleReconstruction::m_useRansac
bool m_useRansac
Definition: LargeScaleReconstruction.hpp:251
lvr2::LargeScaleReconstruction::m_bigMesh
bool m_bigMesh
Definition: LargeScaleReconstruction.hpp:209
lvr2::LargeScaleReconstruction::m_fillHoles
int m_fillHoles
Definition: LargeScaleReconstruction.hpp:268
lvr2::LargeScaleReconstruction::m_extrude
bool m_extrude
Definition: LargeScaleReconstruction.hpp:255
lvr2::LSROptions::bigMesh
bool bigMesh
Definition: LargeScaleReconstruction.hpp:43
lvr2::LSROptions::getFlipPoint
vector< float > getFlipPoint() const
Definition: LargeScaleReconstruction.hpp:119
lvr2::cleanContours
void cleanContours(BaseMesh< BaseVecT > &mesh, int iterations, float areaThreshold)
Removes faces with a high number of boundary edges.
lvr2::LSROptions::minPlaneSize
int minPlaneSize
Definition: LargeScaleReconstruction.hpp:108
lvr2::LSROptions::kd
int kd
Definition: LargeScaleReconstruction.hpp:70
lvr2::LSROptions::flipPoint
std::vector< float > flipPoint
Definition: LargeScaleReconstruction.hpp:79
lvr2::LargeScaleReconstruction::m_removeDanglingArtifacts
int m_removeDanglingArtifacts
Definition: LargeScaleReconstruction.hpp:262
lvr2::HalfEdgeMesh
Half-edge data structure implementing the BaseMesh interface.
Definition: HalfEdgeMesh.hpp:70


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