ReUseX
0.0.5
3D Point Cloud Processing for Building Reuse
Toggle main menu visibility
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
23
namespace
reusex::vision
{
24
57
std::size_t
clip_labels_to_prompt_boxes
(cv::Mat &labels,
58
const
std::vector<Sam3Prompt> &prompts);
59
61
struct
SegmentImageInfo
{
67
bool
geometry_prompts_used
=
false
;
68
};
69
72
cv::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
reusex::vision::IModel
Definition
IModel.hpp:14
reusex::vision
Definition
annotate.hpp:12
reusex::vision::segment_image
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).
reusex::vision::clip_labels_to_prompt_boxes
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.
reusex::info
void info(fmt::format_string< Args... > format, Args &&...args)
Definition
logging.hpp:86
reusex::vision::SegmentImageInfo
What segment_image() can report beyond the label map.
Definition
segment_image.hpp:61
reusex::vision::SegmentImageInfo::geometry_prompts_used
bool geometry_prompts_used
True when at least one prompt carried a box or point and the geometry reached SAM3's geometry encoder...
Definition
segment_image.hpp:67
libs
reusex
include
vision
segment_image.hpp
Generated by
1.18.0