ReUseX  0.0.1
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
segment_rooms.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 Povl Filip Sonne-Frederiksen
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#pragma once
7#include <ReUseX/types.hpp>
9#include <pcl/markov_clustering.hpp>
10#include <spdmon/spdmon.hpp>
11
12// GraphBLAS imports complex.h which defines a macro named 'I' that conflicts
13// with the type in CLI11
14#ifdef I
15#undef I
16#endif
17
18#include <fmt/format.h>
19
20#include <spdlog/sinks/stdout_color_sinks.h>
21#include <spdlog/spdlog.h>
22#include <spdlog/stopwatch.h>
23
24#include <pcl/common/pca.h>
25#include <pcl/correspondence.h>
26#include <pcl/filters/filter.h>
27#include <pcl/filters/uniform_sampling.h>
28#include <pcl/io/auto_io.h>
29#include <pcl/io/pcd_io.h>
30#include <pcl/point_types.h>
31#include <pcl/search/kdtree.h>
32#include <pcl/visualization/pcl_visualizer.h>
33
34#include <boost/parameter.hpp>
35#include <boost/parameter/keyword.hpp>
36#include <boost/parameter/name.hpp>
37
38namespace parameter = boost::parameter;
39
40namespace ReUseX::geometry {
42 CloudLConstPtr planes, const float grid_size,
43 const float inflation, const float expansion,
44 const float pruning_threshold,
45 const float convergence_threshold, const int max_iter,
46 const bool visualize) -> CloudLPtr;
47
48BOOST_PARAMETER_NAME(cloud)
49BOOST_PARAMETER_NAME(normals)
50BOOST_PARAMETER_NAME(planes)
51BOOST_PARAMETER_NAME(grid_size)
52BOOST_PARAMETER_NAME(inflation)
53BOOST_PARAMETER_NAME(expansion)
54BOOST_PARAMETER_NAME(pruning_threshold)
55BOOST_PARAMETER_NAME(convergence_threshold)
56BOOST_PARAMETER_NAME(max_iter)
57BOOST_PARAMETER_NAME(visualize)
58
59BOOST_PARAMETER_FUNCTION((CloudLPtr), // 1. parenthesized return type
60 segment_rooms, // 2. name of the function template
61 tag, // 3. namespace of tag types
62 (required //
63 (cloud, (CloudConstPtr)) //
64 (normals, (CloudNConstPtr)) //
65 (planes, (CloudLConstPtr)) //
66 ) //
67 (optional //
68 (grid_size, (double), 0.5) //
69 (inflation, (double), 2.0) //
70 (expansion, (int), 2) //
71 (pruning_threshold, (double), 0.0001) //
72 (convergence_threshold, (double), 1e-8) //
73 (max_iter, (int), 100) //
74 (visualize, (bool), false) //
75 )) {
76 return segment_rooms_impl(cloud, normals, planes, grid_size, inflation,
77 expansion, pruning_threshold, convergence_threshold,
78 max_iter, visualize);
79}
80
81} // namespace ReUseX::geometry
auto segment_rooms_impl(CloudConstPtr cloud, CloudNConstPtr normals, CloudLConstPtr planes, const float grid_size, const float inflation, const float expansion, const float pruning_threshold, const float convergence_threshold, const int max_iter, const bool visualize) -> CloudLPtr
BOOST_PARAMETER_FUNCTION((std::tuple< CloudLPtr, CloudLocPtr, CloudNPtr >), segment_planes, tag,(required(cloud,(CloudConstPtr))(normals,(CloudNConstPtr)))(optional(angle_threshold,(float), 25.0)(plane_dist_threshold,(float), 0.07)(min_inliers,(int), 1000)(radius,(float), 0.5)(interval_0,(int), 16)(interval_factor,(float), 1.5)(visualize,(bool), false)))
typename CloudL::ConstPtr CloudLConstPtr
Definition types.hpp:31
typename CloudN::ConstPtr CloudNConstPtr
Definition types.hpp:27
typename CloudL::Ptr CloudLPtr
Definition types.hpp:30
typename Cloud::ConstPtr CloudConstPtr
Definition types.hpp:23