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. |
iou_cost_matrix |
fn | Build an IoU association cost matrix between track boxes and detection boxes. |
tlwh_to_tlbr |
fn | Convert a bounding box from TLWH (Top-Left-Width-Height) to TLBR (Top-Left-Bottom-Right) format. |
tlwh_to_xyah |
fn | Convert a bounding box from TLWH to XYAH (center-x, center-y, aspect ratio, height). |
xyah_to_tlwh |
fn | Convert an XYAH vector back to a TLWH bounding box. |
Functions
iou
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
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].
iou_cost_matrix
Build an IoU association cost matrix between track boxes and detection boxes.
result[i][j] = 1.0 - iou(tracks[i], dets[j]), the cost used by the
IoU-based trackers. The shape mirrors iou_batch: one row per track, one
column per detection (so an empty dets yields one empty row per track).
tlwh_to_tlbr
Convert a bounding box from TLWH (Top-Left-Width-Height) to TLBR (Top-Left-Bottom-Right) format.
tlwh_to_xyah
Types: MeasurementVector
Convert a bounding box from TLWH to XYAH (center-x, center-y, aspect ratio, height).
The aspect ratio is width / height, guarded against division by zero.
xyah_to_tlwh
Convert an XYAH vector back to a TLWH bounding box.
Accepts any vector with at least four components (e.g. the 8-dim Kalman state or the 4-dim measurement vector); only the first four elements are used.