SDK Core Events

struct EventBbox

Class representing a spatio-temporal bounding-box event.

The timestamp of the event (i.e. member variable ‘t’) is by convention the detection timestamp. Convention about the spatial position is that points with u in [x, x + w[ and v in [y, y + h[ are inside the bounding-box and everything else is outside.

Public Functions

inline EventBbox()

Default constructor.

inline EventBbox(timestamp time, float x, float y, float w, float h, unsigned int class_id, unsigned int track_id, float class_confidence)

Constructs a Event Bounding box.

Parameters
  • time – Timestamp of last detection

  • x – Column index

  • y – Row index

  • w – Bounding box’s width

  • h – Bounding box’s height

  • class_id – Class identifier

  • track_id – Track identification number

  • class_confidence – Detection confidence

inline void write_event(void *buf, timestamp origin) const

Writes EventBbox in buffer.

Parameters
  • buf – Memory in which the bounding box will be serialized

  • origin – Reference timestamp cut away from the bounding box timestamp

inline float get_x() const

Gets x position of the bounding box.

Returns

X position of the bounding box

inline float get_y() const

Gets y position of the bounding box.

Returns

Y position of the bounding box

inline float get_width() const

Gets bounding box’s width.

Returns

Width of the bounding box

inline float get_height() const

Gets bounding box’s height.

Returns

Height of the bounding box

inline unsigned int get_class_id() const

Gets bounding box’s class id.

Returns

bounding box’s class id

inline float intersection_area(const EventBbox &bbox2) const

Computes the area recovered by both boxes.

Parameters

bbox2 – Box to be compared with

Returns

The intersection area between current bbox and bbox 2 (in pixel * pixel)

inline float intersection_area_over_union(const EventBbox &bbox2) const

Computes the proportion of box overlap.

Parameters

bbox2 – Box to be compared with

Returns

Percentage of overlap

inline void write_csv_line(std::ostream &output, char sep = ' ') const

Serialize a bounding box in csv format.

Parameters
  • output – Stream in which the csv of the bounding box will be written

  • sep – Character inserted between fields

Public Members

timestamp t

timestamp of the detection

float x

X coordinate of top left corner.

float y

Y coordinate of top left corner.

float w

width of the bounding box

float h

height of the bounding box

unsigned int class_id

Class identifier of detected object.

unsigned int track_id

Track identifier.

float class_confidence

Confidence of the detection.

Public Static Functions

static inline EventBbox read_event(void *buf, const timestamp &delta_ts)

Reads EventBbox from a buffer.

Parameters
  • buf – Memory containing a serialized bounding box

  • delta_ts – Origin timestamp to be added to the serialized timestamp

Returns

An unserialized event bounding box

Friends

inline friend std::ostream &operator<<(std::ostream &output, const EventBbox &e)

Serializes an EventBbox into a stream.

Parameters
  • output – Stream

  • e – EventBbox to be serialized

Returns

Stream provided as input

struct EventTrackedBox

Class representing a spatio-temporal tracked bounding-box event.

Public Functions

inline EventTrackedBox(timestamp t = 0, float x = 0.f, float y = 0.f, float w = 0.f, float h = 0.f, unsigned int class_id = 0, unsigned int track_id = 0, float class_confidence = 0) noexcept

Constructor.

Parameters
  • t – Timestamp

  • x – X coordinate of the top-left corner of the box

  • y – Y coordinate of the top-left corner of the box

  • w – Box’s Width

  • h – Box’s height

  • class_id – Box’s class label identifier

  • track_id – Track identifier

  • class_confidence – Confidence score of the detection

inline void write_csv_line(std::ostream &output, char sep = ' ') const

Writes the tracked box into a csv format.

Parameters
  • output – Stream to write the tracked box

  • sep – The separator to use between attributes

inline void set_last_detection_update(timestamp t, float detection_confidence = 0.5f, float similarity_box_track = 1.0f)

Updates the last detection timestamp and compute a new track confidence value.

Parameters
  • t – Timestamp of the new detection

  • detection_confidence – Detection confidence value

  • similarity_box_track – Weight applied on the detection to compute track detection

Public Members

timestamp t

Timestamp of the box.

float x

X position of the bounding box.

float y

Y position of the bounding box.

float w

Width of the bounding box.

float h

Height of the bounding box.

unsigned int class_id

bounding box’s class id

int track_id

Track identifier.

float class_confidence

Confidence of the detection.

float tracking_confidence

Confidence computed from previous detection and matching.

timestamp last_detection_update_time

Time of last update of the detection.

int nb_detections

Number of time this box have been seen.

Friends

inline friend std::ostream &operator<<(std::ostream &output, const EventTrackedBox &e)

Serializes an EventBbox into a stream.

Parameters
  • output – Stream

  • e – EventBbox to be serialized

Returns

Stream provided as input