1#ifndef YODAU_BACKEND_GEOMETRY_HPP
2#define YODAU_BACKEND_GEOMETRY_HPP
13
14
15
16
17
18
21
22
26
27
31
32
33 static constexpr float epsilon { 0.001f };
36
37
38
39
40
41
42
46
47
48
49
50
51
52
53
54
55
60
61
72
73
74
75
76
77
78
79
80
83
84
88
89
93
94
95
96
100
101
102
103
107
108
109
110
111 void dump(std::ostream& out)
const;
114
115
116
117
118
119
120
121
122
123
124
128
129
130
131
132
133
134
135
136
137
138
139
144
145
149
150
151
152
153
154
155
156
157
158
160make_line(std::vector<point> points, std::string name,
bool closed =
false);
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
181
182
183
184
185
186
187
191
192
193
194
195
196
197
198
Simple interactive CLI (REPL) for controlling a stream_manager.
void cmd_start_stream(const std::vector< std::string > &args) const
Handler for start-stream.
void dispatch_command(const std::string &cmd, const std::vector< std::string > &args) const
Dispatch a command to its handler.
void cmd_set_line(const std::vector< std::string > &args) const
Handler for set-line.
int run() const
Run the interactive command loop.
void cmd_add_line(const std::vector< std::string > &args) const
Handler for add-line.
static cxxopts::ParseResult parse_with_cxxopts(const std::string &cmd, const std::vector< std::string > &args, cxxopts::Options &options)
Parse command arguments using cxxopts.
backend::stream_manager & stream_mgr
Stream manager controlled by this CLI.
void cmd_stop_stream(const std::vector< std::string > &args) const
Handler for stop-stream.
void cmd_list_streams(const std::vector< std::string > &args) const
Handler for list-streams.
void cmd_add_stream(const std::vector< std::string > &args) const
Handler for add-stream.
void cmd_list_lines(const std::vector< std::string > &args) const
Handler for list-lines.
cli_client(backend::stream_manager &mgr)
Construct a CLI client operating on an existing manager.
static std::vector< std::string > tokenize(const std::string &line)
Split a line into whitespace-separated tokens.
Central coordinator for streams, geometry, frame processing and events.
std::function< void(const std::string &stream_name, frame &&f)> manual_push_fn
Hook for manual frame pushing.
Represents a single video stream and its analytic connections.
static yodau::backend::tripwire_dir parse_tripwire_dir(const std::string &s)
line_ptr make_line(std::vector< point > points, std::string name, bool closed=false)
Create and normalize a line.
std::string normalize_str(std::string_view str)
Remove whitespace and parentheses from a string.
std::vector< point > parse_points(const std::string &points_str)
Parse points from a textual representation.
float parse_float(std::string_view num_str)
Parse a float from a string view.
std::shared_ptr< line const > line_ptr
Shared, immutable line pointer.
event_kind
High-level classification of backend events.
tripwire_dir
Allowed crossing direction for a tripwire.
Generic event produced by the backend.
std::chrono::steady_clock::time_point ts
Monotonic timestamp when the event was generated.
event_kind kind
Type of the event.
std::string stream_name
Name/identifier of the stream that produced the event.
std::optional< point > pos_pct
Optional position associated with the event in percentage coordinates.
std::string line_name
Name of the line / ROI / rule responsible for this event.
std::string message
Human-readable event description or payload.
Polyline / polygon described in percentage coordinates.
std::string name
Logical name of the line (e.g., "entrance_tripwire").
tripwire_dir dir
Optional tripwire direction constraint.
bool closed
Whether the chain is closed.
void dump(std::ostream &out) const
Print a human-readable representation of the line.
std::vector< point > points
Vertex list in percentage coordinates.
void normalize()
Canonicalize point order.
bool operator==(const line &other) const
Equality check using canonical point comparison.
Point in percentage-based image coordinates.
float distance_to(const point &other) const
Compute Euclidean distance to another point.
float x
Horizontal coordinate (percentage of width).
float y
Vertical coordinate (percentage of height).
static constexpr float epsilon
Tolerance used for fuzzy point comparisons.
bool compare(const point &other) const
Compare two points with tolerance epsilon.