1#ifndef YODAU_BACKEND_FRAME_HPP
2#define YODAU_BACKEND_FRAME_HPP
11
12
13
14
15
30
31
32
33
34
35
36
37
38
39
40
41
42
43
46
47
51
52
56
57
58
59
63
64
65
66
70
71
72
73
77
78
79 std::chrono::steady_clock::time_point
ts;
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.
pixel_format
Pixel format of a frame buffer.
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.
int width
Frame width in pixels.
int stride
Number of bytes per row.
int height
Frame height in pixels.
std::vector< std::uint8_t > data
Raw pixel bytes.
std::chrono::steady_clock::time_point ts
Monotonic timestamp when the frame was captured/produced.
pixel_format format
Pixel format of the buffer.
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.