### Rust ByteTrack Multi-Object Tracking Example Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Example demonstrating how to use the ByteTrack Rust library for multi-object tracking. It shows initialization, frame processing, and accessing tracking results. ```rust use bytetrack::{Detection, Bytetrack, BytetrackConfig}; fn main() { let mut total_tracked_objects = 0; let frames: Vec> = // insert frames with detection here // Initializing tracker which uses u32 unique incremental IDs for tracked objects let mut tracker = Bytetrack::new(BytetrackConfig::::default()); // Process each frame for (i, frame) in frames.iter().enumerate() { println!("Processing frame {} with {} detections", i, frame.len()); // Track objects in the current frame let result = tracker.track(&frame_detections); // Count removed objects let removed_count = result.removed_objects.len(); total_tracked_objects += result.new_objects.len(); // Read tracking results or access tracker.get_objects() directly println!("New object detected: {:?}", result.new_objects.len()); println!("Updated objects: {:?}", result.updated_objects.len()); println!("Removed objects: {:?}", removed_count); } // Read final tracked objects and clear internal state let final_count = tracker.drain_objects(); total_tracked_objects += final_count.len(); println!("Total tracked objects: {:?}", total_tracked_objects); // Print track of some object if let Some(object) = final_objects.last() { println!(" Track of object {}:", object.id); for t in object.track.iter() { println!( "Frame: {}, X: {}, Y: {}", t.frame_index, t.bbox.center().x, t.bbox.center().y ) } } } ``` -------------------------------- ### Install Pre-commit Hook Source: https://github.com/qitechgmbh/mot/blob/main/hooks/README.md Copies the pre-commit hook to the local .git/hooks directory and makes it executable. This ensures the hook runs automatically before each commit. ```bash cp hooks/pre-commit .git/hooks/pre-commit chmod +x .git/hooks/pre-commit ``` -------------------------------- ### Rust ByteTrack Object Tracking Example Source: https://github.com/qitechgmbh/mot/blob/main/README.md Demonstrates how to initialize and use the ByteTrack Rust library for multi-object tracking. It processes frames containing detections, tracks objects using Kalman filtering, and provides access to new, updated, and removed objects. ```Rust use bytetrack::{Detection, Bytetrack, BytetrackConfig}; fn main() { let mut total_tracked_objects = 0; let frames: Vec> = // insert frames with detection here // Initializing tracker which uses u32 unique incremental IDs for tracked objects let mut tracker = Bytetrack::new(BytetrackConfig::::default()); // Process each frame for (i, frame) in frames.iter().enumerate() { println!("Processing frame {} with {} detections", i, frame.len()); // Track objects in the current frame let result = tracker.track(&frame_detections); // Count removed objects let removed_count = result.removed_objects.len(); total_tracked_objects += result.new_objects.len(); // Read tracking results or access tracker.get_objects() directly println!("New object detected: {:?}", result.new_objects.len()); println!("Updated objects: {:?}", result.updated_objects.len()); println!("Removed objects: {:?}", removed_count); } // Read final tracked objects and clear internal state let final_count = tracker.drain_objects(); total_tracked_objects += final_count.len(); println!("Total tracked objects: {:?}", total_tracked_objects); // Print track of some object if let Some(object) = final_objects.last() { println!(" Track of object {}:", object.id); for t in object.track.iter() { println!( "Frame: {}, X: {}, Y: {}", t.frame_index, t.bbox.center().x, t.bbox.center().y ) } } } ``` -------------------------------- ### Rust ByteTrack Object Tracking Example Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/README.md Demonstrates how to initialize and use the ByteTrack Rust library for multi-object tracking. It processes frames containing detections, tracks objects using Kalman filtering, and provides access to new, updated, and removed objects. ```Rust use bytetrack::{Detection, Bytetrack, BytetrackConfig}; fn main() { let mut total_tracked_objects = 0; let frames: Vec> = // insert frames with detection here // Initializing tracker which uses u32 unique incremental IDs for tracked objects let mut tracker = Bytetrack::new(BytetrackConfig::::default()); // Process each frame for (i, frame) in frames.iter().enumerate() { println!("Processing frame {} with {} detections", i, frame.len()); // Track objects in the current frame let result = tracker.track(&frame_detections); // Count removed objects let removed_count = result.removed_objects.len(); total_tracked_objects += result.new_objects.len(); // Read tracking results or access tracker.get_objects() directly println!("New object detected: {:?}", result.new_objects.len()); println!("Updated objects: {:?}", result.updated_objects.len()); println!("Removed objects: {:?}", removed_count); } // Read final tracked objects and clear internal state let final_count = tracker.drain_objects(); total_tracked_objects += final_count.len(); println!("Total tracked objects: {:?}", total_tracked_objects); // Print track of some object if let Some(object) = final_objects.last() { println!(" Track of object {}:", object.id); for t in object.track.iter() { println!( "Frame: {}, X: {}, Y: {}", t.frame_index, t.bbox.center().x, t.bbox.center().y ) } } } ``` -------------------------------- ### Rust Kalman Filter: Get Configuration Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Retrieves the configuration used by the Kalman filter. This includes parameters specific to the bounding box tracking. ```rust pub fn config(self: &Self) -> &BBoxKalmanConfig { /* ... */ } ``` -------------------------------- ### Rust From Trait Implementation Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Enables conversion from another type into this type. The provided example returns the argument unchanged. ```rust fn from(t: T) -> T { /* ... */ } ``` -------------------------------- ### Rust BBox Method: left Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Gets the x-coordinate of the left edge of the bounding box in Rust. ```rust pub fn left(self: &Self) -> f32 { /* ... */ } ``` -------------------------------- ### Rust Trait: Any Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the 'Any' trait, providing a method to get the TypeId of the object. ```rust fn type_id(self: &Self) -> TypeId { /* ... */ } ``` -------------------------------- ### Rust Object Method: last_seen_index Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Gets the frame index of the last time the object was detected. ```rust pub fn last_seen_index(self: &Self) -> Option { /* ... */ } ``` -------------------------------- ### Rust Kalman Filter: Get Current Bounding Box Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Retrieves the current estimated bounding box from the Kalman filter. This provides the most recent tracked bounding box. ```rust pub fn current_bbox(self: &Self) -> BBox { /* ... */ } ``` -------------------------------- ### Rust Kalman Filter: Get Covariance Matrix Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Returns a slice representing the current covariance matrix of the Kalman filter. This matrix indicates the uncertainty in the state estimation. ```rust pub fn covariance(self: &Self) -> &[f32] { /* ... */ } ``` -------------------------------- ### Rust BBox Method: bottom Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Gets the y-coordinate of the bottom edge of the bounding box in Rust. ```rust pub fn bottom(self: &Self) -> f32 { /* ... */ } ``` -------------------------------- ### Rust Kalman Filter: Get State Vector Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Returns a slice representing the current state vector of the Kalman filter. The state includes position, dimensions, and velocities. ```rust pub fn state(self: &Self) -> &[f32] { /* ... */ } ``` -------------------------------- ### Rust Trait: Any Type ID Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the Any trait to get the TypeId of a type. ```rust fn type_id(self: &Self) -> TypeId { /* ... */ } ``` -------------------------------- ### Rust Bytetrack::new Method Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Constructor for the Bytetrack struct, initializing the tracker with a given configuration. ```rust pub fn new(config: BytetrackConfig) -> Self { /* ... */ } ``` -------------------------------- ### Rust Trait Implementations: Any, Borrow, BorrowMut, Clone, CloneToUninit, From, Into, SupersetOf, ToOwned, TryFrom, TryInto, VZip Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md This snippet showcases various common Rust trait implementations for different types within the project. It includes methods for type identification, borrowing, cloning, conversion, subset operations, and ownership. ```rust fn type_id(self: &Self) -> TypeId { /* ... */ } ``` ```rust fn borrow(self: &Self) -> &T { /* ... */ } ``` ```rust fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ } ``` ```rust fn clone(self: &Self) -> Self { /* ... */ } ``` ```rust unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ } ``` ```rust fn from(t: T) -> T { /* ... */ } ``` ```rust fn into(self: Self) -> U { /* ... */ } ``` ```rust fn to_subset(self: &Self) -> Option { /* ... */ } ``` ```rust fn is_in_subset(self: &Self) -> bool { /* ... */ } ``` ```rust fn to_subset_unchecked(self: &Self) -> SS { /* ... */ } ``` ```rust fn from_subset(element: &SS) -> SP { /* ... */ } ``` ```rust fn to_owned(self: &Self) -> T { /* ... */ } ``` ```rust fn clone_into(self: &Self, target: &mut T) { /* ... */ } ``` ```rust fn try_from(value: U) -> Result>::Error> { /* ... */ } ``` ```rust fn try_into(self: Self) -> Result>::Error> { /* ... */ } ``` ```rust fn vzip(self: Self) -> V { /* ... */ } ``` -------------------------------- ### Rust Object Method: new_with_config Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Creates a new Object with custom Kalman filter configuration. Requires an ID, detection data, detection index, frame index, and Kalman configuration. ```rust pub fn new_with_config(id: ID, detection: &Detection, detection_index: usize, frame_index: usize, config: BBoxKalmanConfig) -> Self { /* ... */ } ``` -------------------------------- ### Rust Trait: Type ID Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the `Any` trait, providing a `type_id` method to get the unique identifier for the type. ```rust fn type_id(self: &Self) -> TypeId { /* ... */ } ``` -------------------------------- ### Rust Method: Detection::new Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Constructor for the Detection struct to create a new detection with a bounding box and confidence. ```rust pub fn new(bbox: BBox, confidence: f32) -> Self { /* ... */ } ``` -------------------------------- ### Rust: Create TrackedDetection Instance Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Creates a new instance of TrackedDetection with specified parameters including detection, detection index, Kalman bounding box, and frame index. ```rust pub fn new(detection: Option<&Detection>, detection_index: Option, kalman_bbox: BBox, frame_index: usize) -> Self { /* ... */ } ``` -------------------------------- ### Rust Object Method: from_detection Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Creates a new Object from a detection with default Kalman filter configuration. Requires an ID, detection data, detection index, and frame index. ```rust pub fn from_detection(id: ID, detection: &Detection, detection_index: usize, frame_index: usize) -> Self { /* ... */ } ``` -------------------------------- ### Rust Kalman Filter: Create New Filter Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Creates a new Kalman filter instance for bounding box tracking. It requires an initial bounding box and Kalman filter configuration. ```rust pub fn new(initial_bbox: &BBox, config: BBoxKalmanConfig) -> Result> { /* ... */ } ``` -------------------------------- ### Rust BBox Constructor: new Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Provides a constructor for the BBox struct in Rust, allowing the creation of a bounding box using its origin point and dimensions (width and height). ```rust pub fn new(origin: Point2, width: f32, height: f32) -> Self { /* ... */ } ``` -------------------------------- ### Rust Module: matching Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Defines the 'matching' module, likely containing algorithms for associating tracks with detections in a multi-object tracking system. ```rust pub mod matching { /* ... */ } ``` -------------------------------- ### Rust Re-export: detection::* Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Re-exports all items from the 'detection' module, making them directly accessible. ```rust pub use detection::*; ``` -------------------------------- ### Rust BBox Constructor: from_xywh Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md A constructor for the Rust BBox struct that creates a bounding box from its top-left corner coordinates (x, y) and its width and height. ```rust pub fn from_xywh(x: f32, y: f32, width: f32, height: f32) -> Self { /* ... */ } ``` -------------------------------- ### Rust Bytetrack::config Method Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Provides an immutable reference to the tracker's configuration. ```rust pub fn config(self: &Self) -> &BytetrackConfig { /* ... */ } ``` -------------------------------- ### Rust Re-export: matching::* Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Re-exports all items from the 'matching' module, making them directly accessible. ```rust pub use matching::*; ``` -------------------------------- ### Rust BBox Constructor: from_xyxy Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Constructs a BBox in Rust using the coordinates of its top-left (x1, y1) and bottom-right (x2, y2) corners. ```rust pub fn from_xyxy(x1: f32, y1: f32, x2: f32, y2: f32) -> Self { /* ... */ } ``` -------------------------------- ### Rust MatchingAlgorithm: Solve Assignment Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Solves the assignment problem using the Hungarian algorithm. It takes an IoU matrix and a minimum IoU threshold to match tracks to detections. ```rust pub fn solve_assignment(self: &Self, iou_matrix: &[Vec], iou_min: f32) -> Vec> { /* ... */ } ``` -------------------------------- ### Rust Bytetrack::set_config Method Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Allows modification of the tracker's configuration. ```rust pub fn set_config(self: &mut Self, config: &BytetrackConfig) { /* ... */ } ``` -------------------------------- ### Rust Re-export: kalman::* Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Re-exports all items from the 'kalman' module, making them directly accessible. ```rust pub use kalman::*; ``` -------------------------------- ### Rust BBox Constructor: from_ccwh Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Enables the creation of a BBox in Rust using the center coordinates (cx, cy) along with the width and height of the bounding box. ```rust pub fn from_ccwh(cx: f32, cy: f32, w: f32, h: f32) -> Self { /* ... */ } ``` -------------------------------- ### Rust BBoxKalmanConfig Struct Definition Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Defines the configuration parameters for the bounding box Kalman filter, including time step and noise levels. ```rust pub struct BBoxKalmanConfig { pub dt: f32, pub process_noise: f32, pub measurement_noise: f32, pub initial_position_variance: f32, pub initial_velocity_variance: f32, } ``` -------------------------------- ### Rust Kalman Module Declaration Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Declares the `kalman` module, which contains Kalman filter implementations for bounding box tracking. ```rust pub mod kalman { /* ... */ } ``` -------------------------------- ### Rust: Implement SupersetOf trait methods Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementations for methods related to the `SupersetOf` trait in Rust, including converting to a subset, checking subset status, and creating from a subset. ```rust fn to_subset(self: &Self) -> Option { /* ... */ } ``` ```rust fn is_in_subset(self: &Self) -> bool { /* ... */ } ``` ```rust fn to_subset_unchecked(self: &Self) -> SS { /* ... */ } ``` ```rust fn from_subset(element: &SS) -> SP { /* ... */ } ``` -------------------------------- ### Rust: Build IoU Matrix Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Builds an Intersection over Union (IoU) matrix based on the IoU between objects and detections. It takes slices of bounding boxes as input. ```rust pub fn build_iou_matrix(object_bboxes: &[&BBox], detection_bboxes: &[&BBox]) -> Vec> { /* ... */ } ``` -------------------------------- ### Rust BBox Method: center Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Returns the center point of the bounding box as a `Point2` in Rust. ```rust pub fn center(self: &Self) -> Point2 { /* ... */ } ``` -------------------------------- ### Rust Bytetrack::track Method Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md The core tracking method that processes detections to update and manage tracked objects. ```rust pub fn track(self: &mut Self, detections: &[&Detection]) -> BytetrackTrackResult { /* ... */ } ``` -------------------------------- ### Rust Re-export: bbox::* Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Re-exports all items from the 'bbox' module, making them directly accessible. ```rust pub use bbox::*; ``` -------------------------------- ### Rust: Implement From trait from Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the `from` method for the `From` trait in Rust. This function creates a new instance from another type, returning the argument unchanged. ```rust fn from(t: T) -> T { /* ... */ } ``` -------------------------------- ### Rust Macro: bbox Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md A convenience macro for creating a bounding box from (x, y, width, height) coordinates. It simplifies the process of defining bounding boxes in the (x_center, y_center, width, height) format. ```rust pub macro_rules! bbox { ($x:expr, $y:expr, $w:expr, $h:expr) => { ... }; } ``` -------------------------------- ### Rust Re-export: bytetrack::* Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Re-exports all items from the 'bytetrack' module, making them directly accessible. ```rust pub use bytetrack::*; ``` -------------------------------- ### Rust: Implement Debug trait fmt Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the `fmt` method for the `Debug` trait in Rust. This function formats the object for debugging output. ```rust fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ } ``` -------------------------------- ### Rust: BytetrackConfig struct definition Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Defines the `BytetrackConfig` struct, which holds configuration parameters for the ByteTrack algorithm. It includes parameters like maximum disappeared frames, IoU thresholds, and ID generation. ```rust pub struct BytetrackConfig { pub max_disappeared: u32, pub min_iou: f32, pub high_thresh: f32, pub low_thresh: f32, pub algorithm: crate::matching::MatchingAlgorithm, pub generate_id: std::sync::Arc) -> ID + Send + Sync>, } ``` -------------------------------- ### Rust SupersetOf Trait Implementations Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Provides methods for the SupersetOf trait, including converting to a subset, checking subset status, and creating from a subset. ```rust fn to_subset(self: &Self) -> Option { /* ... */ } ``` ```rust fn is_in_subset(self: &Self) -> bool { /* ... */ } ``` ```rust fn to_subset_unchecked(self: &Self) -> SS { /* ... */ } ``` ```rust fn from_subset(element: &SS) -> SP { /* ... */ } ``` -------------------------------- ### Rust: Implement CloneToUninit Trait Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implements the CloneToUninit trait for unsafe cloning into uninitialized memory. ```rust unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ } ``` -------------------------------- ### Rust Macro: bbox_xyxy Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md A convenience macro for creating a bounding box from (x1, y1, x2, y2) coordinates. It simplifies the process of defining bounding boxes in the (x_min, y_min, x_max, y_max) format. ```rust pub macro_rules! bbox_xyxy { ($x1:expr, $y1:expr, $x2:expr, $y2:expr) => { ... }; } ``` -------------------------------- ### Rust: Implement TryInto Trait Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implements the TryInto trait, providing a fallible conversion into another type. ```rust fn try_into(self: Self) -> Result>::Error> { /* ... */ } ``` -------------------------------- ### Rust: Implement Any Trait Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Provides the type_id method for the Any trait, allowing for runtime type identification. ```rust fn type_id(self: &Self) -> TypeId { /* ... */ } ``` -------------------------------- ### Rust: Implement CloneToUninit trait clone_to_uninit Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the `clone_to_uninit` method for the `CloneToUninit` trait in Rust. This unsafe function clones the object into an uninitialized memory location. ```rust unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ } ``` -------------------------------- ### Rust BBoxKalmanConfig Default Trait Implementation Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Provides a default configuration for the `BBoxKalmanConfig` struct. ```rust fn default() -> Self { /* ... */ } ``` -------------------------------- ### Rust Clone Trait Implementation Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implements the Clone trait, allowing for the creation of a copy of BytetrackConfig. ```rust fn clone(self: &Self) -> BytetrackConfig { /* ... */ } ``` -------------------------------- ### Rust Re-export: tracked_detection::* Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Re-exports all items from the 'tracked_detection' module, making them directly accessible. ```rust pub use tracked_detection::*; ``` -------------------------------- ### Rust Bytetrack Struct Definition Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Defines the Bytetrack struct, the main implementation for the multi-object tracking algorithm. ```rust pub struct Bytetrack { // Some fields omitted } ``` -------------------------------- ### Rust Into Trait Implementation Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implements the Into trait, enabling conversion to another type U by calling U::from. ```rust fn into(self: Self) -> U { /* ... */ } ``` -------------------------------- ### Rust: Implement From Trait Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implements the From trait, providing a way to create an object from another type, returning the argument unchanged. ```rust fn from(t: T) -> T { /* ... */ } ``` -------------------------------- ### Rust Bytetrack::get_objects Method Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Returns a vector containing references to all currently tracked objects. ```rust pub fn get_objects(self: &Self) -> Vec<&Object> { /* ... */ } ``` -------------------------------- ### Rust Object Method: update Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Updates the object's state with a new matching detection using Kalman filtering. Returns a Result indicating success or failure. ```rust pub fn update(self: &mut Self, detection: &Detection, detection_index: usize, frame_index: usize) -> Result<(), Box> { /* ... */ } ``` -------------------------------- ### Rust: Implement TryFrom Trait Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implements the TryFrom trait, providing a fallible conversion from another type. ```rust fn try_from(value: U) -> Result>::Error> { /* ... */ } ``` -------------------------------- ### Rust: Implement VZip Trait Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implements the VZip trait, providing a method to zip the object's elements. ```rust fn vzip(self: Self) -> V { /* ... */ } ``` -------------------------------- ### Rust Trait: CloneToUninit Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the 'CloneToUninit' trait, providing an unsafe method to clone the object into uninitialized memory. ```rust unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ } ``` -------------------------------- ### Rust: Implement Into Trait Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implements the Into trait, allowing conversion into another type by calling the corresponding From::from method. ```rust fn into(self: Self) -> U { /* ... */ } ``` -------------------------------- ### Rust Trait: TryInto Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the 'TryInto' trait, providing a method to attempt conversion from Self to type U, returning a Result. ```rust fn try_into(self: Self) -> Result>::Error> { /* ... */ } ``` -------------------------------- ### Rust BBox Method: right Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Returns the x-coordinate of the right edge of the bounding box in Rust. ```rust pub fn right(self: &Self) -> f32 { /* ... */ } ``` -------------------------------- ### Rust Object Method: predict Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Predicts the next bounding box position for the object using its Kalman filter. ```rust pub fn predict(self: &mut Self) -> BBox { /* ... */ } ``` -------------------------------- ### Rust Any Trait Implementation Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Provides the `type_id` method for the Any trait, used for runtime type identification. ```rust fn type_id(self: &Self) -> TypeId { /* ... */ } ``` -------------------------------- ### Rust: Implement SupersetOf Trait - From Subset Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implements the SupersetOf trait, providing a method to create an object from a subset. ```rust fn from_subset(element: &SS) -> SP { /* ... */ } ``` -------------------------------- ### Rust Re-export: object::* Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Re-exports all items from the 'object' module, making them directly accessible. ```rust pub use object::*; ``` -------------------------------- ### Rust Trait: TryInto Conversion Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the TryInto trait for fallible conversion between types. ```rust fn try_into(self: Self) -> Result>::Error> { /* ... */ } ``` -------------------------------- ### Rust Trait: Default Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the 'Default' trait, providing a method to create a default instance of the object. ```rust fn default() -> Self { /* ... */ } ``` -------------------------------- ### Rust Trait: SupersetOf Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementations for the 'SupersetOf' trait, providing methods to convert to a subset, check subset status, and create from a subset. ```rust fn to_subset(self: &Self) -> Option { /* ... */ } ``` ```rust fn is_in_subset(self: &Self) -> bool { /* ... */ } ``` ```rust fn to_subset_unchecked(self: &Self) -> SS { /* ... */ } ``` ```rust fn from_subset(element: &SS) -> SP { /* ... */ } ``` -------------------------------- ### Rust Trait: SupersetOf Operations Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementations for SupersetOf trait, including converting to a subset, checking subset status, and creating from a subset. ```rust fn to_subset(self: &Self) -> Option { /* ... */ } ``` ```rust fn is_in_subset(self: &Self) -> bool { /* ... */ } ``` ```rust fn to_subset_unchecked(self: &Self) -> SS { /* ... */ } ``` ```rust fn from_subset(element: &SS) -> SP { /* ... */ } ``` -------------------------------- ### Rust Struct: Detection Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Represents a raw detection from an object detector, including its bounding box and confidence score. ```rust pub struct Detection { pub bbox: crate::bbox::BBox, pub confidence: f32, } ``` -------------------------------- ### Rust Trait: TryFrom Conversion Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the `TryFrom` trait, providing a `try_from` method for fallible conversion from one type to another. ```rust fn try_from(value: U) -> Result>::Error> { /* ... */ } ``` -------------------------------- ### Rust Macro: det Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md A macro for creating detection data, likely used for object detection results. ```rust pub macro_rules! det { ($point:expr, $conf:expr) => { ... }; } ``` -------------------------------- ### Rust Trait: TryInto Conversion Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the `TryInto` trait, providing a `try_into` method for fallible conversion of the type into another. ```rust fn try_into(self: Self) -> Result>::Error> { /* ... */ } ``` -------------------------------- ### Rust TryFrom Trait Implementation Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Enables fallible conversion from one type to another, returning a `Result`. ```rust fn try_from(value: U) -> Result>::Error> { /* ... */ } ``` -------------------------------- ### Rust VZip Trait Implementation Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Provides a `vzip` method, likely for vector zipping operations. ```rust fn vzip(self: Self) -> V { /* ... */ } ``` -------------------------------- ### Rust: Implement TryInto trait try_into Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the `try_into` method for the `TryInto` trait in Rust. This function attempts to convert the object into another type, returning a `Result`. ```rust fn try_into(self: Self) -> Result>::Error> { /* ... */ } ``` -------------------------------- ### Rust Re-export: object_status::* Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Re-exports all items from the 'object_status' module, making them directly accessible. ```rust pub use object_status::*; ``` -------------------------------- ### Rust: Implement SupersetOf Trait - To Subset Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implements the SupersetOf trait, providing a method to convert the object into a subset. ```rust fn to_subset(self: &Self) -> Option { /* ... */ } ``` -------------------------------- ### Rust CloneToUninit Trait Implementation Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Provides an unsafe method to clone the object into an uninitialized memory location. ```rust unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ } ``` -------------------------------- ### Rust BBox Method: area Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Calculates and returns the area of the bounding box in Rust. ```rust pub fn area(self: &Self) -> f32 { /* ... */ } ``` -------------------------------- ### Rust Trait: TryFrom Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the 'TryFrom' trait, providing a method to attempt conversion from type U to T, returning a Result. ```rust fn try_from(value: U) -> Result>::Error> { /* ... */ } ``` -------------------------------- ### Rust Clone Trait Implementation Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Enables creating a copy of the object. The specific type cloned depends on the context (e.g., `Detection` or `BBoxKalmanConfig`). ```rust fn clone(self: &Self) -> Detection { /* ... */ } ``` ```rust fn clone(self: &Self) -> BBoxKalmanConfig { /* ... */ } ``` -------------------------------- ### Rust CloneToUninit Trait Implementation Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implements the unsafe CloneToUninit trait for cloning data into uninitialized memory. ```rust unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ } ``` -------------------------------- ### Rust Enum: MatchingAlgorithm Hungarian Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Defines the Hungarian algorithm for assignment problems in tracking, including a scale factor for converting IoU values to integers. ```rust pub enum MatchingAlgorithm { Hungarian { scale_factor: f32, }, } ``` -------------------------------- ### Rust: Implement Clone trait clone Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the `clone` method for the `Clone` trait in Rust. This function creates a new `BBox` by cloning the current one. ```rust fn clone(self: &Self) -> BBox { /* ... */ } ``` -------------------------------- ### Rust Trait: VZip Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the `VZip` trait, providing a `vzip` method for vector zipping operations. ```rust fn vzip(self: Self) -> V { /* ... */ } ``` -------------------------------- ### Rust Into Trait Implementation Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Enables conversion from this type into another type by calling the target type's `from` method. ```rust fn into(self: Self) -> U { /* ... */ } ``` -------------------------------- ### Rust: Implement Into trait into Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the `into` method for the `Into` trait in Rust. This function consumes the object and converts it into another type by calling `U::from`. ```rust fn into(self: Self) -> U { /* ... */ } ``` -------------------------------- ### Rust Trait: TryFrom Conversion Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the TryFrom trait for fallible conversion between types. ```rust fn try_from(value: U) -> Result>::Error> { /* ... */ } ``` -------------------------------- ### Rust: Implement TryFrom trait try_from Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the `try_from` method for the `TryFrom` trait in Rust. This function attempts to convert one type into another, returning a `Result`. ```rust fn try_from(value: U) -> Result>::Error> { /* ... */ } ``` -------------------------------- ### Rust Trait: From Conversion Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the `From` trait, providing a `from` method for converting one type to another. This specific implementation returns the argument unchanged. ```rust fn from(t: T) -> T { /* ... */ } ``` -------------------------------- ### Rust Trait: SupersetOf Subset Conversion Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementations for the `SupersetOf` trait, allowing conversion to a subset, checking if an element is within the subset, and creating from a subset. ```rust fn to_subset(self: &Self) -> Option { /* ... */ } ``` ```rust fn is_in_subset(self: &Self) -> bool { /* ... */ } ``` ```rust fn to_subset_unchecked(self: &Self) -> SS { /* ... */ } ``` ```rust fn from_subset(element: &SS) -> SP { /* ... */ } ``` -------------------------------- ### Rust SupersetOf Trait Implementation Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Defines methods for subset and superset relationships between types, including conversion and checking. ```rust fn to_subset(self: &Self) -> Option { /* ... */ } ``` ```rust fn is_in_subset(self: &Self) -> bool { /* ... */ } ``` ```rust fn to_subset_unchecked(self: &Self) -> SS { /* ... */ } ``` ```rust fn from_subset(element: &SS) -> SP { /* ... */ } ``` -------------------------------- ### Rust Kalman Filter: Update with Measurement Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Updates the Kalman filter's state with a new bounding box measurement. This method takes a reference to the new bounding box. ```rust pub fn update(self: &mut Self, bbox: &BBox) -> Result<(), Box> { /* ... */ } ``` -------------------------------- ### Rust Trait: VZip Operation Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the VZip trait for zipping operations. ```rust fn vzip(self: Self) -> V { /* ... */ } ``` -------------------------------- ### Rust Trait: Clone Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the 'Clone' trait, providing a method to create a copy of the object. ```rust fn clone(self: &Self) -> MatchingAlgorithm { /* ... */ } ``` -------------------------------- ### Rust: Implement Clone Trait Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implements the Clone trait, providing a method to create a clone of the TrackedDetection object. ```rust fn clone(self: &Self) -> TrackedDetection { /* ... */ } ``` -------------------------------- ### Rust Object Method: current_bbox Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Retrieves the current bounding box of the object, either from the latest tracked detection or the Kalman filter prediction. ```rust pub fn current_bbox(self: &Self) -> BBox { /* ... */ } ``` -------------------------------- ### Rust Trait: Into Conversion Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the Into trait for converting one type to another. Calls U::from(self). ```rust fn into(self: Self) -> U { /* ... */ } ``` -------------------------------- ### Rust Trait: From Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the 'From' trait, providing a method to create an object from another type T. Returns the argument unchanged. ```rust fn from(t: T) -> T { /* ... */ } ``` -------------------------------- ### Rust Trait: From Conversion Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the From trait for converting one type to another. Returns the argument unchanged. ```rust fn from(t: T) -> T { /* ... */ } ``` -------------------------------- ### Rust Trait: VZip Source: https://github.com/qitechgmbh/mot/blob/main/bytetrack/rustdoc.md Implementation of the 'VZip' trait, providing a method to perform a vector zip operation. ```rust fn vzip(self: Self) -> V { /* ... */ } ```