ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
mask_selection.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Povl Filip Sonne-Frederiksen
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#pragma once
6
15
16#include "reusex/core/ProjectDB.hpp"
17
18#include <cstddef>
19#include <cstdint>
20#include <optional>
21#include <stdexcept>
22#include <string>
23#include <vector>
24
25namespace cv {
26class Mat;
27} // namespace cv
28
29namespace reusex::core {
30
35class MaskSelectionError : public std::runtime_error {
36 public:
37 using std::runtime_error::runtime_error;
38};
39
43 std::string cloud = "cloud";
46 double depth_tolerance = 0.10;
50 double max_depth = 8.0;
51};
52
77std::vector<std::size_t>
78project_frame_mask(const ProjectDB &db, int frame_id, const cv::Mat &mask,
79 const MaskProjectionOptions &opts = {});
80
84 std::string base_cloud = "cloud";
85 std::string semantic_cloud = "labels"; // pipeline kDefaultSemanticCloud
86 std::string instance_cloud = std::string(kDefaultInstanceCloud);
89 std::string rooms_cloud = "rooms";
98 std::optional<int64_t> type_id;
101 int frame_id = -1;
102};
103
106 std::string resource_code;
107 int64_t type_id = 0;
108 bool type_created = false;
109 uint32_t label_id = 0;
110 bool label_created = false;
111 uint32_t instance_id = 0;
112 std::string instance_guid;
113 int point_count = 0;
115 std::vector<std::pair<uint32_t, int>> shrunk_instances;
116};
117
150apply_mask_selection(ProjectDB &db, const std::vector<std::size_t> &indices,
151 const std::string &class_name,
152 const MaskSelectionOptions &opts = {});
153
154} // namespace reusex::core
A frame cannot be projected (no usable pose, no depth image, no base cloud, degenerate intrinsics) or...
Turn a 2D mask drawn on one sensor frame into a labelled 3D selection and a survey part (Segmentering...
Wire form of one stored report PDF version — the ReportPdfVersion schema in ruxd's API contract (docs...
constexpr std::string_view kDefaultInstanceCloud
Default name of the instance-label cloud sync_survey reads from, and the default SurveySyncOptions::i...
Definition survey.hpp:39
std::vector< std::size_t > project_frame_mask(const ProjectDB &db, int frame_id, const cv::Mat &mask, const MaskProjectionOptions &opts={})
Indices of the base-cloud points that the mask covers in one frame.
MaskSelectionResult apply_mask_selection(ProjectDB &db, const std::vector< std::size_t > &indices, const std::string &class_name, const MaskSelectionOptions &opts={})
Label the selected points as class_name, make them one new instance, and file a survey part for it — ...
Tunables for project_frame_mask() (STANDARDS §4).
double max_depth
Points farther than this from the camera (metres) are ignored; past it a consumer depth sensor's read...
double depth_tolerance
A point is visible when |z - depth(u,v)| <= depth_tolerance (metres), where depth(u,...
std::string cloud
Base cloud the mask selects from (index space of the result).
Tunables for apply_mask_selection().
std::string rooms_cloud
Optional rooms cloud: when present and index-aligned, the new part gets the room most of its points f...
int frame_id
Recorded in the pipeline log entry; -1 when the selection did not come from a frame.
std::string base_cloud
Base cloud the indices refer to; its size sizes a missing label cloud.
std::optional< int64_t > type_id
Survey type for the new part.
What apply_mask_selection() created.
uint32_t label_id
Semantic class (CloudL value, >= 1).
std::vector< std::pair< uint32_t, int > > shrunk_instances
Instances that gave up points to the new one, with their new counts.
bool type_created
True when the type was created here.
std::string resource_code
The new survey part, e.g. "RX-042".
uint32_t instance_id
New instance (CloudL value, >= 1).