ClusterAlgorithms.hpp
Go to the documentation of this file.
1 
28 /*
29  * ClusterAlgorithms.hpp
30  *
31  * Collection of algorithms for cluster modification.
32  *
33  * @date 24.07.2017
34  * @author Johan M. von Behren <johan@vonbehren.eu>
35  * @author Jan Philipp Vogtherr <jvogtherr@uni-osnabrueck.de>
36  * @author Kristin Schmidt <krschmidt@uni-osnabrueck.de>
37  */
38 
39 #ifndef LVR2_ALGORITHM_CLUSTERALGORITHMS_H_
40 #define LVR2_ALGORITHM_CLUSTERALGORITHMS_H_
41 
46 #include "lvr2/geometry/Plane.hpp"
47 #include "lvr2/io/MeshBuffer.hpp"
48 #include "lvr2/util/Cluster.hpp"
51 #include "lvr2/geometry/Line.hpp"
52 
53 #include <vector>
54 
55 using std::vector;
56 
57 
58 namespace lvr2
59 {
60 
67 template<typename BaseVecT>
68 void removeDanglingCluster(BaseMesh<BaseVecT>& mesh, size_t sizeThreshold);
69 
79 template<typename BaseVecT>
80 vector<vector<VertexHandle>> findContours(
81  BaseMesh<BaseVecT>& mesh,
82  const ClusterBiMap<FaceHandle>& clusters,
83  ClusterHandle clusterH
84 );
85 
94 template<typename BaseVecT>
95 vector<VertexHandle> simplifyContour(const BaseMesh<BaseVecT>& mesh,
96  const vector<VertexHandle>& contour,
97  float threshold
98 );
99 
100 
113 template<typename BaseVecT>
114 vector<VertexHandle> calculateClusterContourVertices(
115  ClusterHandle clusterH,
116  const BaseMesh<BaseVecT>& mesh,
117  const ClusterBiMap<FaceHandle>& clusterBiMap
118 );
119 
138 template<typename BaseVecT>
139 BoundingRectangle<typename BaseVecT::CoordType> calculateBoundingRectangle(
140  const vector<VertexHandle>& contour,
141  const BaseMesh<BaseVecT>& mesh,
142  const Cluster<FaceHandle>& cluster,
143  const FaceMap<Normal<typename BaseVecT::CoordType>>& normals,
144  float texelSize,
145  ClusterHandle clusterH
146 );
147 
157 template<typename BaseVecT, typename Pred>
158 ClusterBiMap<FaceHandle> clusterGrowing(const BaseMesh<BaseVecT>& mesh, Pred pred);
159 
165 template<typename BaseVecT>
166 ClusterBiMap<FaceHandle> planarClusterGrowing(
167  const BaseMesh<BaseVecT>& mesh,
168  const FaceMap<Normal<typename BaseVecT::CoordType>>& normals,
169  float minSinAngle
170 );
171 
181 template<typename BaseVecT>
182 ClusterBiMap<FaceHandle> iterativePlanarClusterGrowing(
183  BaseMesh<BaseVecT>& mesh,
184  FaceMap<Normal<typename BaseVecT::CoordType>>& normals,
185  float minSinAngle,
186  int numIterations,
187  int minClusterSize
188 );
189 
199 template<typename BaseVecT>
200 ClusterBiMap<FaceHandle> iterativePlanarClusterGrowingRANSAC(
201  BaseMesh<BaseVecT>& mesh,
202  FaceMap<Normal<typename BaseVecT::CoordType>>& normals,
203  float minSinAngle,
204  int numIterations,
205  int minClusterSize,
206  int ransacIterations = 100,
207  int ransacSamples = 10
208 );
209 
211 template<typename BaseVecT>
212 Plane<BaseVecT> calcRegressionPlane(
213  const BaseMesh<BaseVecT>& mesh,
214  const Cluster<FaceHandle>& cluster,
215  const FaceMap<Normal<typename BaseVecT::CoordType>>& normals
216 );
217 
219 template<typename BaseVecT>
220 Plane<BaseVecT> calcRegressionPlaneRANSAC(
221  const BaseMesh<BaseVecT>& mesh,
222  const Cluster<FaceHandle>& cluster,
223  const FaceMap<Normal<typename BaseVecT::CoordType>>& normals,
224  const int num_iterations = 100,
225  const int num_samples = 10
226 );
227 
229 template<typename BaseVecT>
230 Plane<BaseVecT> calcRegressionPlanePCA(
231  const BaseMesh<BaseVecT>& mesh,
232  const Cluster<FaceHandle>& cluster,
233  const FaceMap<Normal<typename BaseVecT::CoordType>>& normals,
234  const int num_iterations = 100,
235  const int num_samples = 10
236 );
237 
243 template<typename BaseVecT>
244 DenseClusterMap<Plane<BaseVecT>> calcRegressionPlanes(
245  const BaseMesh<BaseVecT>& mesh,
246  const ClusterBiMap<FaceHandle>& clusters,
247  const FaceMap<Normal<typename BaseVecT::CoordType>>& normals,
248  int minClusterSize
249 );
250 
256 template<typename BaseVecT>
257 DenseClusterMap<Plane<BaseVecT>> calcRegressionPlanesRANSAC(
258  const BaseMesh<BaseVecT>& mesh,
259  const ClusterBiMap<FaceHandle>& clusters,
260  const FaceMap<Normal<typename BaseVecT::CoordType>>& normals,
261  int minClusterSize,
262  int iterations = 100,
263  int samples = 10
264 );
265 
267 template<typename BaseVecT>
269  BaseMesh<BaseVecT>& mesh,
270  const Cluster<FaceHandle>& cluster,
271  const Plane<BaseVecT>& plane,
272  FaceMap<Normal<typename BaseVecT::CoordType>>& normals
273 );
274 
276 template<typename BaseVecT>
278  BaseMesh<BaseVecT>& mesh,
279  const ClusterBiMap<FaceHandle>& clusters,
280  const ClusterMap<Plane<BaseVecT>>& planes,
281  FaceMap<Normal<typename BaseVecT::CoordType>>& normals
282 );
283 
288 template<typename BaseVecT>
290  BaseMesh<BaseVecT>& mesh,
291  const ClusterBiMap<FaceHandle>& clusters,
292  const ClusterMap<Plane<BaseVecT>>& planes
293 );
294 
296 template<typename BaseVecT>
298  BaseMesh<BaseVecT>& mesh,
299  const ClusterBiMap<FaceHandle>& clusters,
300  const ClusterHandle& clusterH,
301  const ClusterHandle& neighbourClusterH,
302  const Line<BaseVecT>& intersection
303 );
304 
311 template<typename BaseVecT>
312 void debugPlanes(
313  const BaseMesh<BaseVecT>& mesh,
314  const ClusterBiMap<FaceHandle>& clusters,
315  const ClusterMap<Plane<BaseVecT>>& planes,
316  string filename,
317  size_t minClusterSize
318 );
319 
324 template<typename BaseVecT>
326  BaseMesh<BaseVecT>& mesh,
327  ClusterBiMap<FaceHandle>& clusters,
328  size_t smallClusterThreshold
329 );
330 
331 } // namespace lvr2
332 
333 #include "lvr2/algorithm/ClusterAlgorithms.tcc"
334 
335 #endif /* LVR2_ALGORITHM_CLUSTERALGORITHMS_H_ */
Handles.hpp
lvr2::FaceMap
AttributeMap< FaceHandle, ValueT > FaceMap
Definition: AttrMaps.hpp:93
lvr2::planarClusterGrowing
ClusterBiMap< FaceHandle > planarClusterGrowing(const BaseMesh< BaseVecT > &mesh, const FaceMap< Normal< typename BaseVecT::CoordType >> &normals, float minSinAngle)
Algorithm which generates plane clusters from the given mesh.
lvr2::removeDanglingCluster
void removeDanglingCluster(BaseMesh< BaseVecT > &mesh, size_t sizeThreshold)
lvr2::dragToRegressionPlanes
void dragToRegressionPlanes(BaseMesh< BaseVecT > &mesh, const ClusterBiMap< FaceHandle > &clusters, const ClusterMap< Plane< BaseVecT >> &planes, FaceMap< Normal< typename BaseVecT::CoordType >> &normals)
Drags all points from the given clusters into their regression planes.
lvr2::iterativePlanarClusterGrowingRANSAC
ClusterBiMap< FaceHandle > iterativePlanarClusterGrowingRANSAC(BaseMesh< BaseVecT > &mesh, FaceMap< Normal< typename BaseVecT::CoordType >> &normals, float minSinAngle, int numIterations, int minClusterSize, int ransacIterations=100, int ransacSamples=10)
Algorithm which generates planar clusters from the given mesh, drags points in clusters into regressi...
lvr2::calculateClusterContourVertices
vector< VertexHandle > calculateClusterContourVertices(ClusterHandle clusterH, const BaseMesh< BaseVecT > &mesh, const ClusterBiMap< FaceHandle > &clusterBiMap)
Calculates contour vertices for a given cluster.
AttrMaps.hpp
Cluster.hpp
BaseMesh.hpp
HalfEdgeMesh.hpp
lvr2::dragOntoIntersection
void dragOntoIntersection(BaseMesh< BaseVecT > &mesh, const ClusterBiMap< FaceHandle > &clusters, const ClusterHandle &clusterH, const ClusterHandle &neighbourClusterH, const Line< BaseVecT > &intersection)
Drags all points between two clusters (planes) into their intersection.
lvr2::ClusterMap
AttributeMap< ClusterHandle, ValueT > ClusterMap
Definition: AttrMaps.hpp:91
ClusterBiMap.hpp
Materializer.hpp
scripts.normalize_multiple.filename
filename
Definition: normalize_multiple.py:60
lvr2::calcRegressionPlaneRANSAC
Plane< BaseVecT > calcRegressionPlaneRANSAC(const BaseMesh< BaseVecT > &mesh, const Cluster< FaceHandle > &cluster, const FaceMap< Normal< typename BaseVecT::CoordType >> &normals, const int num_iterations=100, const int num_samples=10)
Calcs a regression plane for the given cluster.
lvr2::optimizePlaneIntersections
void optimizePlaneIntersections(BaseMesh< BaseVecT > &mesh, const ClusterBiMap< FaceHandle > &clusters, const ClusterMap< Plane< BaseVecT >> &planes)
MeshBuffer.hpp
lvr2::calculateBoundingRectangle
BoundingRectangle< typename BaseVecT::CoordType > calculateBoundingRectangle(const vector< VertexHandle > &contour, const BaseMesh< BaseVecT > &mesh, const Cluster< FaceHandle > &cluster, const FaceMap< Normal< typename BaseVecT::CoordType >> &normals, float texelSize, ClusterHandle clusterH)
Calculates bounding rectangle for a given cluster.
lvr2::dragToRegressionPlane
void dragToRegressionPlane(BaseMesh< BaseVecT > &mesh, const Cluster< FaceHandle > &cluster, const Plane< BaseVecT > &plane, FaceMap< Normal< typename BaseVecT::CoordType >> &normals)
Drags all points from the given cluster into the given plane.
lvr2::findContours
vector< vector< VertexHandle > > findContours(BaseMesh< BaseVecT > &mesh, const ClusterBiMap< FaceHandle > &clusters, ClusterHandle clusterH)
Line.hpp
lvr2::iterativePlanarClusterGrowing
ClusterBiMap< FaceHandle > iterativePlanarClusterGrowing(BaseMesh< BaseVecT > &mesh, FaceMap< Normal< typename BaseVecT::CoordType >> &normals, float minSinAngle, int numIterations, int minClusterSize)
Algorithm which generates planar clusters from the given mesh, drags points in clusters into regressi...
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::calcRegressionPlanesRANSAC
DenseClusterMap< Plane< BaseVecT > > calcRegressionPlanesRANSAC(const BaseMesh< BaseVecT > &mesh, const ClusterBiMap< FaceHandle > &clusters, const FaceMap< Normal< typename BaseVecT::CoordType >> &normals, int minClusterSize, int iterations=100, int samples=10)
Calcs regression planes for all cluster in clusters.
lvr2::calcRegressionPlanes
DenseClusterMap< Plane< BaseVecT > > calcRegressionPlanes(const BaseMesh< BaseVecT > &mesh, const ClusterBiMap< FaceHandle > &clusters, const FaceMap< Normal< typename BaseVecT::CoordType >> &normals, int minClusterSize)
Calcs regression planes for all cluster in clusters.
lvr2::deleteSmallPlanarCluster
void deleteSmallPlanarCluster(BaseMesh< BaseVecT > &mesh, ClusterBiMap< FaceHandle > &clusters, size_t smallClusterThreshold)
Removes all clusters and their cotained faces from the given mesh which are smaller than the given sm...
Plane.hpp
lvr2::clusterGrowing
ClusterBiMap< FaceHandle > clusterGrowing(const BaseMesh< BaseVecT > &mesh, Pred pred)
Algorithm which generates clusters from the given mesh. The given predicate decides which faces will ...
lvr2::simplifyContour
vector< VertexHandle > simplifyContour(const BaseMesh< BaseVecT > &mesh, const vector< VertexHandle > &contour, float threshold)
lvr2::debugPlanes
void debugPlanes(const BaseMesh< BaseVecT > &mesh, const ClusterBiMap< FaceHandle > &clusters, const ClusterMap< Plane< BaseVecT >> &planes, string filename, size_t minClusterSize)
Creates a mesh containing the given regression planes (which match the given minimum cluster size) as...
lvr2::calcRegressionPlane
Plane< BaseVecT > calcRegressionPlane(const BaseMesh< BaseVecT > &mesh, const Cluster< FaceHandle > &cluster, const FaceMap< Normal< typename BaseVecT::CoordType >> &normals)
Calcs a regression plane for the given cluster.
lvr2::calcRegressionPlanePCA
Plane< BaseVecT > calcRegressionPlanePCA(const BaseMesh< BaseVecT > &mesh, const Cluster< FaceHandle > &cluster, const FaceMap< Normal< typename BaseVecT::CoordType >> &normals, const int num_iterations=100, const int num_samples=10)
Calcs a regression plane for the given cluster.
mesh
HalfEdgeMesh< Vec > mesh
Definition: src/tools/lvr2_gs_reconstruction/Main.cpp:26


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