MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Features.hpp
Go to the documentation of this file.
1#pragma once
2
4
6
7/**
8 * @brief Axis-aligned bounding box in normalised image coordinates.
9 *
10 * Origin is top-left, x and y in [0, 1], +Y down. Distinct from
11 * Kinesis::AABB2D which is NDC with center origin and +Y up.
12 *
13 * Use to_ndc() to convert to AABB2D for Forma hit testing.
14 */
16 float x {};
17 float y {};
18 float w {};
19 float h {};
20 float confidence { 1.0F };
21 uint32_t label_id {};
22
23 /**
24 * @brief Convert to NDC AABB2D for use with Portal::Forma::Element.
25 *
26 * Maps [0, 1] image space to [-1, 1] NDC, flipping Y axis.
27 */
28 [[nodiscard]] Kinesis::AABB2D to_ndc() const noexcept
29 {
30 return {
31 .min = { x * 2.0F - 1.0F, 1.0F - (y + h) * 2.0F },
32 .max = { (x + w) * 2.0F - 1.0F, 1.0F - y * 2.0F },
33 };
34 }
35};
36
37/**
38 * @brief Closed contour extracted from a binary mask.
39 *
40 * Points are in normalised image coordinates [0, 1], top-left origin.
41 */
42struct Contour {
43 std::vector<glm::vec2> points;
44 float area;
45 float perimeter;
46
47 /**
48 * @brief 0 for an outer contour. For a hole contour, the label id
49 * (1-based) of the foreground component this hole is
50 * enclosed by.
51 */
52 uint32_t parent_label { 0U };
53};
54
55/**
56 * @brief Single interest point produced by a corner or blob detector.
57 *
58 * Position is in normalised image coordinates [0, 1], top-left origin.
59 */
60struct Keypoint {
61 glm::vec2 position;
62 float response;
63 float scale;
64 float angle;
65};
66
67/**
68 * @brief Pixel buffer captured mid-pipeline by a Snapshot step.
69 *
70 * pixels is a normalised float buffer in the format active at the snapshot
71 * point. channels distinguishes single-channel (grayscale, Harris response)
72 * from three-channel (HSV) and four-channel (RGBA).
73 */
75 std::vector<float> pixels;
76 uint32_t w { 0 };
77 uint32_t h { 0 };
78 uint32_t channels { 0 };
79};
80
81} // namespace MayaFlux::Kinesis::Vision
Axis-aligned bounding rectangle in a 2D coordinate space.
Definition Bounds.hpp:21
Kinesis::AABB2D to_ndc() const noexcept
Convert to NDC AABB2D for use with Portal::Forma::Element.
Definition Features.hpp:28
Axis-aligned bounding box in normalised image coordinates.
Definition Features.hpp:15
uint32_t parent_label
0 for an outer contour.
Definition Features.hpp:52
std::vector< glm::vec2 > points
Definition Features.hpp:43
Closed contour extracted from a binary mask.
Definition Features.hpp:42
Single interest point produced by a corner or blob detector.
Definition Features.hpp:60
Pixel buffer captured mid-pipeline by a Snapshot step.
Definition Features.hpp:74