ReUseX  0.0.1
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
Sam3Type.hpp
Go to the documentation of this file.
1#pragma once
2#include <array>
3#include <opencv2/opencv.hpp>
4#include <string>
5#include <utility>
6#include <vector>
7
9
10// Define BoxPrompt: <Label("pos"/"neg"), {x1, y1, x2, y2}>
11using BoxPrompt = std::pair<std::string, std::array<float, 4>>;
12
13// Single prompt unit: contains a piece of text and an optional set of boxes
15 std::string text;
16 std::vector<BoxPrompt> boxes;
17 Sam3PromptUnit() = default;
18 Sam3PromptUnit(const std::string &t, const std::vector<BoxPrompt> &b = {})
19 : text(t), boxes(b) {}
20};
21
22// Unified input struct
23struct Sam3Input {
25 cv::Mat image; // Required: input image
26 std::vector<Sam3PromptUnit>
27 prompts; // Required: all prompt words list corresponding to this image
28 Sam3Input() = default;
29 Sam3Input(const cv::Mat &img) : image(img) {}
30 Sam3Input(const cv::Mat &img, const std::vector<Sam3PromptUnit> &p,
31 float conf)
32 : image(img), prompts(p), confidence_threshold(conf) {}
33};
34} // namespace ReUseX::vision::tensor_rt
std::pair< std::string, std::array< float, 4 > > BoxPrompt
Definition Sam3Type.hpp:11
std::vector< Sam3PromptUnit > prompts
Definition Sam3Type.hpp:27
Sam3Input(const cv::Mat &img, const std::vector< Sam3PromptUnit > &p, float conf)
Definition Sam3Type.hpp:30
Sam3PromptUnit(const std::string &t, const std::vector< BoxPrompt > &b={})
Definition Sam3Type.hpp:18