Skip to content

trackforge / utils / geometry


Module geometry

Quick Reference

Item Kind Description
iou fn Calculate Intersection over Union (IoU) between two bounding boxes.
iou_batch fn Calculate IoU matrix between two lists of bounding boxes.
tlwh_to_tlbr fn Convert a bounding box from TLWH (Top-Left-Width-Height) to TLBR (Top-Left-Bottom-Right) format.

Functions

iou

fn iou(box1: &[f32; 4], box2: &[f32; 4]) -> f32

Calculate Intersection over Union (IoU) between two bounding boxes.

Arguments

Argument Description
box1 First bounding box in TLWH format.
box2 Second bounding box in TLWH format.

iou_batch

fn iou_batch(bboxes1: &[[f32; 4]], bboxes2: &[[f32; 4]]) -> Vec<Vec<f32>>

Calculate IoU matrix between two lists of bounding boxes.

Returns a 2D vector where result[i][j] is the IoU between bboxes1[i] and bboxes2[j].

tlwh_to_tlbr

fn tlwh_to_tlbr(tlwh: &[f32; 4]) -> [f32; 4]

Convert a bounding box from TLWH (Top-Left-Width-Height) to TLBR (Top-Left-Bottom-Right) format.