ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
segment_image.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// Single-frame SAM3 segmentation — the per-image building block factored out
6// of segment_panorama so the GUI endpoint and CLI can call it directly (#409).
7//
8// Backend dispatch: tries TensorRT first (most common), then ONNX Runtime.
9// Detection is runtime, via the IData subtype returned by forward(). At least
10// one of REUSEX_USE_TENSORRT / REUSEX_USE_ONNX_RUNTIME must be compiled into
11// the vision library for any result to be produced.
12
13#pragma once
14
15#include "reusex/vision/IModel.hpp"
16#include "reusex/vision/sam3_prompt.hpp"
17
18#include <opencv2/core.hpp>
19
20#include <cstddef>
21#include <vector>
22
23namespace reusex::vision {
24
57std::size_t clip_labels_to_prompt_boxes(cv::Mat &labels,
58 const std::vector<Sam3Prompt> &prompts);
59
68};
69
72cv::Mat segment_image(IModel &model, const cv::Mat &image_bgr,
73 const std::vector<Sam3Prompt> &prompts = {},
74 float confidence = 0.5f,
75 SegmentImageInfo *info = nullptr);
76
77} // namespace reusex::vision
cv::Mat segment_image(IModel &model, const cv::Mat &image_bgr, const std::vector< Sam3Prompt > &prompts={}, float confidence=0.5f, SegmentImageInfo *info=nullptr)
Segment a single BGR image with a SAM3 model (see the parameters above).
std::size_t clip_labels_to_prompt_boxes(cv::Mat &labels, const std::vector< Sam3Prompt > &prompts)
Segment a single BGR image with a SAM3 model.
void info(fmt::format_string< Args... > format, Args &&...args)
Definition logging.hpp:86
What segment_image() can report beyond the label map.
bool geometry_prompts_used
True when at least one prompt carried a box or point and the geometry reached SAM3's geometry encoder...