9#include <boost/graph/adjacency_list.hpp>
10#include <boost/graph/graph_traits.hpp>
11#include <boost/graph/graphviz.hpp>
12#include <boost/iterator/filter_iterator.hpp>
13#include <boost/property_map/dynamic_property_map.hpp>
14#include <boost/serialization/shared_ptr.hpp>
17#include <spdlog/spdlog.h>
19#include <fmt/format.h>
25#include <Eigen/StdVector>
27#include <pcl/pcl_base.h>
28#include <pcl/point_cloud.h>
29#include <pcl/point_types.h>
31#include <range/v3/range/concepts.hpp>
32#include <range/v3/view/zip.hpp>
53 std::variant<PointCluster, Plane>
data;
74 :
public boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS,
75 VertexData, EdgeData>,
78 using Graph = boost::adjacency_list<boost::vecS, boost::vecS,
82 using Vertex = boost::graph_traits<Graph>::vertex_descriptor;
87 std::map<int, std::string> label_map_ = {};
88 std::filesystem::path database_path_ =
"";
107 std::vector<CloudConstPtr>
extract(
int label)
const;
114 std::vector<CloudConstPtr>
ectract(std::string
const label_name)
const;
134 int save(
const std::filesystem::path &path)
const;
141 int export(
const std::filesystem::path &path)
const;
158 void patch_segmentation();
169 void planar_region_growing();
181 void project_labels_from_database();
193 void segment_rooms();
197template <>
struct fmt::formatter<
ReUseX::geometry::SceneGraph> {
199 template <
typename ParseContext>
constexpr auto parse(ParseContext &ctx) {
204 template <
typename FormatContext>
206 FormatContext &ctx)
const {
207 return fmt::format_to(ctx.out(),
"SceneGraph");
SceneGraph(CloudConstPtr cloud, CloudNConstPtr normals)
Construct a scene graph from a point cloud and its normals.
boost::graph_traits< Graph >::vertex_descriptor Vertex
int export(const std::filesystem::path &path) const
Export the scene graph to differnet formats.
boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, VertexData, EdgeData > Graph
void set_database_path(std::filesystem::path db_path)
Set the database path.
std::set< int > get_labels() const
Get all unique labels in the scene graph.
int save(const std::filesystem::path &path) const
Save the scene graph to a file.
static SceneGraph load(const std::filesystem::path &path)
Load the scene graph from a file.
std::vector< CloudConstPtr > ectract(std::string const label_name) const
Extract point clouds corresponding to a specific label name.
std::vector< CloudConstPtr > extract(int label) const
Extract point clouds corresponding to a specific label.
typename CloudN::ConstPtr CloudNConstPtr
typename Cloud::ConstPtr CloudConstPtr
Eigen::Vector4d coefficients
std::vector< int > point_indices
std::variant< PointCluster, Plane > data