MayaFlux
1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Features.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
MayaFlux/Kinesis/Spatial/Bounds.hpp
"
4
5
namespace
MayaFlux::Core
{
6
class
VKImage;
7
}
8
9
namespace
MayaFlux::Kinesis::Vision
{
10
11
/**
12
* @brief Axis-aligned bounding box in normalised image coordinates.
13
*
14
* Origin is top-left, x and y in [0, 1], +Y down. Distinct from
15
* Kinesis::AABB2D which is NDC with center origin and +Y up.
16
*
17
* Use to_ndc() to convert to AABB2D for Forma hit testing.
18
*/
19
struct
BoundingBox
{
20
float
x
{};
21
float
y
{};
22
float
w
{};
23
float
h
{};
24
float
confidence
{ 1.0F };
25
uint32_t
label_id
{};
26
27
/**
28
* @brief Convert to NDC AABB2D for use with Portal::Forma::Element.
29
*
30
* Maps [0, 1] image space to [-1, 1] NDC, flipping Y axis.
31
*/
32
[[nodiscard]]
Kinesis::AABB2D
to_ndc
() const noexcept
33
{
34
return
{
35
.
min
= {
x
* 2.0F - 1.0F, 1.0F - (
y
+
h
) * 2.0F },
36
.max = { (
x
+
w
) * 2.0F - 1.0F, 1.0F -
y
* 2.0F },
37
};
38
}
39
};
40
41
/**
42
* @brief Closed contour extracted from a binary mask.
43
*
44
* Points are in normalised image coordinates [0, 1], top-left origin.
45
*/
46
struct
Contour
{
47
static
constexpr
uint32_t
no_parent
= 0xFFFFFFFFU;
///< Outer contour parent sentinel.
48
49
std::vector<glm::vec2>
points
;
50
float
area
;
///< Pixel coverage divided by total image area.
51
float
perimeter
;
///< Closed boundary length in pixels.
52
53
/**
54
* @brief no_parent for an outer contour. For a hole contour, the label id
55
* (1-based) of the foreground component this hole is
56
* enclosed by.
57
*/
58
uint32_t
parent_label
{
no_parent
};
59
60
/**
61
* @brief 1-based label id of the component this contour traces, matching
62
* ComponentResult::boxes and BoundingBox::label_id numbering, and
63
* the value written per pixel in ConnectedComponents' device
64
* label buffer. 0 for a hole contour: a hole has no foreground
65
* pixels of its own to select by label, it is already absent
66
* from the label buffer wherever it opens through the parent's
67
* silhouette.
68
*/
69
uint32_t
label_id
{ 0 };
70
};
71
72
/**
73
* @brief Single interest point produced by a corner or blob detector.
74
*
75
* Position is in normalised image coordinates [0, 1], top-left origin.
76
*/
77
struct
Keypoint
{
78
glm::vec2
position
;
79
float
response
;
80
float
scale
;
81
float
angle
;
82
};
83
84
/**
85
* @brief Image captured mid-pipeline by a Snapshot step.
86
*
87
* The CPU executor fills pixels, a normalised float buffer in the format
88
* active at the snapshot point. The GPU executor fills image instead: a copy
89
* of the working image that later steps do not overwrite, valid until the
90
* next run on the same executor. channels distinguishes single-channel
91
* (grayscale, Harris response) from three-channel (HSV) and four-channel
92
* (RGBA).
93
*/
94
struct
SnapshotEntry
{
95
std::vector<float>
pixels
;
96
std::shared_ptr<Core::VKImage>
image
;
97
uint32_t
w
{ 0 };
98
uint32_t
h
{ 0 };
99
uint32_t
channels
{ 0 };
100
};
101
102
}
// namespace MayaFlux::Kinesis::Vision
Bounds.hpp
MayaFlux::Core
Definition
Chronie.hpp:8
MayaFlux::Kinesis::Vision
Definition
ConnectedComponents.cpp:3
MayaFlux::Kinesis::AABB2D::min
glm::vec2 min
Definition
Bounds.hpp:64
MayaFlux::Kinesis::AABB2D
Axis-aligned bounding rectangle in a 2D coordinate space.
Definition
Bounds.hpp:63
MayaFlux::Kinesis::Vision::BoundingBox::y
float y
Definition
Features.hpp:21
MayaFlux::Kinesis::Vision::BoundingBox::h
float h
Definition
Features.hpp:23
MayaFlux::Kinesis::Vision::BoundingBox::w
float w
Definition
Features.hpp:22
MayaFlux::Kinesis::Vision::BoundingBox::confidence
float confidence
Definition
Features.hpp:24
MayaFlux::Kinesis::Vision::BoundingBox::x
float x
Definition
Features.hpp:20
MayaFlux::Kinesis::Vision::BoundingBox::to_ndc
Kinesis::AABB2D to_ndc() const noexcept
Convert to NDC AABB2D for use with Portal::Forma::Element.
Definition
Features.hpp:32
MayaFlux::Kinesis::Vision::BoundingBox::label_id
uint32_t label_id
Definition
Features.hpp:25
MayaFlux::Kinesis::Vision::BoundingBox
Axis-aligned bounding box in normalised image coordinates.
Definition
Features.hpp:19
MayaFlux::Kinesis::Vision::Contour::perimeter
float perimeter
Closed boundary length in pixels.
Definition
Features.hpp:51
MayaFlux::Kinesis::Vision::Contour::area
float area
Pixel coverage divided by total image area.
Definition
Features.hpp:50
MayaFlux::Kinesis::Vision::Contour::parent_label
uint32_t parent_label
no_parent for an outer contour.
Definition
Features.hpp:58
MayaFlux::Kinesis::Vision::Contour::label_id
uint32_t label_id
1-based label id of the component this contour traces, matching ComponentResult::boxes and BoundingBo...
Definition
Features.hpp:69
MayaFlux::Kinesis::Vision::Contour::no_parent
static constexpr uint32_t no_parent
Outer contour parent sentinel.
Definition
Features.hpp:47
MayaFlux::Kinesis::Vision::Contour::points
std::vector< glm::vec2 > points
Definition
Features.hpp:49
MayaFlux::Kinesis::Vision::Contour
Closed contour extracted from a binary mask.
Definition
Features.hpp:46
MayaFlux::Kinesis::Vision::Keypoint::angle
float angle
Definition
Features.hpp:81
MayaFlux::Kinesis::Vision::Keypoint::position
glm::vec2 position
Definition
Features.hpp:78
MayaFlux::Kinesis::Vision::Keypoint::scale
float scale
Definition
Features.hpp:80
MayaFlux::Kinesis::Vision::Keypoint::response
float response
Definition
Features.hpp:79
MayaFlux::Kinesis::Vision::Keypoint
Single interest point produced by a corner or blob detector.
Definition
Features.hpp:77
MayaFlux::Kinesis::Vision::SnapshotEntry::pixels
std::vector< float > pixels
Definition
Features.hpp:95
MayaFlux::Kinesis::Vision::SnapshotEntry::h
uint32_t h
Definition
Features.hpp:98
MayaFlux::Kinesis::Vision::SnapshotEntry::channels
uint32_t channels
Definition
Features.hpp:99
MayaFlux::Kinesis::Vision::SnapshotEntry::image
std::shared_ptr< Core::VKImage > image
Definition
Features.hpp:96
MayaFlux::Kinesis::Vision::SnapshotEntry::w
uint32_t w
Definition
Features.hpp:97
MayaFlux::Kinesis::Vision::SnapshotEntry
Image captured mid-pipeline by a Snapshot step.
Definition
Features.hpp:94
src
MayaFlux
Kinesis
Vision
Features.hpp
Generated by
1.9.8