1use std::fmt::Debug;
5
6pub use uuid::Uuid;
7pub mod bytetrack;
8pub use bytetrack::{ByteTrack, ByteTrackBuilder};
9mod kalman;
10
11pub trait DetectionBox: Debug + Clone {
12 fn bbox(&self) -> [f32; 4];
13 fn score(&self) -> f32;
14 fn label(&self) -> usize;
15}
16
17#[derive(Debug, Clone, Copy)]
19#[doc(hidden)]
20pub struct MockDetection {
21 bbox: [f32; 4],
22 score: f32,
23 label: usize,
24}
25
26impl DetectionBox for MockDetection {
27 fn bbox(&self) -> [f32; 4] {
28 self.bbox
29 }
30
31 fn score(&self) -> f32 {
32 self.score
33 }
34
35 fn label(&self) -> usize {
36 self.label
37 }
38}
39
40#[derive(Debug, Clone, Copy, PartialEq)]
41pub struct TrackInfo {
42 pub uuid: Uuid,
43 pub tracked_location: [f32; 4],
45 pub count: i32,
46 pub created: u64,
47 pub last_updated: u64,
48}
49
50#[derive(Debug, Clone, Copy, PartialEq)]
51pub struct ActiveTrackInfo<T: DetectionBox> {
52 pub info: TrackInfo,
53 pub last_box: T,
56}
57
58pub trait Tracker<T: DetectionBox> {
59 fn update(&mut self, boxes: &[T], timestamp: u64) -> Vec<Option<TrackInfo>>;
60 fn get_active_tracks(&self) -> Vec<ActiveTrackInfo<T>>;
61}