ReUseX
0.0.5
3D Point Cloud Processing for Building Reuse
Toggle main menu visibility
Loading...
Searching...
No Matches
sam3_prompt.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
// Backend-agnostic SAM3 prompt type shared between the vision library and
6
// the GUI layer. No OpenCV, no backend headers — only the standard library.
7
8
#pragma once
9
10
#include <array>
11
#include <string>
12
#include <string_view>
13
#include <utility>
14
#include <vector>
15
16
namespace
reusex::vision
{
17
20
using
SegmentBox
= std::pair<std::string, std::array<float, 4>>;
21
27
inline
constexpr
std::string_view
kGeometryOnlyPromptText
=
"visual"
;
28
37
inline
int
sam3_label_value
(
bool
by_prompt_index,
int
prompt_index,
38
int
cache_id)
noexcept
{
39
return
by_prompt_index && prompt_index >= 0 ? prompt_index : cache_id;
40
}
41
43
using
SegmentPoint
= std::array<float, 2>;
44
47
struct
Sam3Prompt
{
48
std::string
text
;
49
std::vector<SegmentBox>
boxes
;
54
std::vector<SegmentPoint>
points
;
56
float
confidence
= -1.0f;
57
58
explicit
Sam3Prompt
(std::string t, std::vector<SegmentBox> b = {},
59
float
conf = -1.0f)
60
:
text
(std::move(t)),
boxes
(std::move(b)),
confidence
(conf) {}
61
};
62
63
}
// namespace reusex::vision
reusex::vision
Definition
annotate.hpp:12
reusex::vision::kGeometryOnlyPromptText
constexpr std::string_view kGeometryOnlyPromptText
Text sent to SAM3 for a prompt that carries boxes but no class name.
Definition
sam3_prompt.hpp:27
reusex::vision::sam3_label_value
int sam3_label_value(bool by_prompt_index, int prompt_index, int cache_id) noexcept
The value a backend writes into the label map for one prompt's detections.
Definition
sam3_prompt.hpp:37
reusex::vision::SegmentPoint
std::array< float, 2 > SegmentPoint
A click-point prompt: pixel [x, y].
Definition
sam3_prompt.hpp:43
reusex::vision::SegmentBox
std::pair< std::string, std::array< float, 4 > > SegmentBox
A bounding-box prompt: label ("pos" or "neg") and pixel coords [x1,y1,x2,y2].
Definition
sam3_prompt.hpp:20
reusex::vision::Sam3Prompt::Sam3Prompt
Sam3Prompt(std::string t, std::vector< SegmentBox > b={}, float conf=-1.0f)
Definition
sam3_prompt.hpp:58
reusex::vision::Sam3Prompt::points
std::vector< SegmentPoint > points
Positive click points.
Definition
sam3_prompt.hpp:54
reusex::vision::Sam3Prompt::boxes
std::vector< SegmentBox > boxes
Definition
sam3_prompt.hpp:49
reusex::vision::Sam3Prompt::text
std::string text
Definition
sam3_prompt.hpp:48
reusex::vision::Sam3Prompt::confidence
float confidence
Per-prompt confidence override. Negative ⟹ use the global threshold.
Definition
sam3_prompt.hpp:56
libs
reusex
include
vision
sam3_prompt.hpp
Generated by
1.18.0