Bounding Box Interpolation¶
Bounding box interpolation module for object tracking.
interpolate_bbox ¶
interpolate_bbox(
boxes: ndarray,
frames: ndarray,
target_frame: int,
method="cubic",
) -> np.ndarray
Interpolates bounding boxes using cubic splines.
Args: boxes: a (n, 4) array of bounding box coordinates (x, y, width, height). frames: a (n,) array of frame indices corresponding to the bounding boxes. target_frame: the frame index at which to interpolate the bounding box. method: the spline function, default is 'cubic', 'nearest', 'linear'
Returns: A 1d array (x, y, width, height) representing the interpolated bounding box.
Source code in src/dnt/engine/bbox_interp.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
interpolate_bboxes ¶
interpolate_bboxes(
boxes: ndarray,
frames: ndarray,
target_frames: ndarray,
method="cubic",
) -> np.ndarray
Interpolates bounding boxes using cubic splines.
Args: boxes: a (n, 4) array of bounding box coordinates (x, y, width, height). frames: a (n,) array of frame indices corresponding to the bounding boxes. target_frames: the frame indexes at which to interpolate the bounding boxes. method: the spline function, default is 'cubic', 'nearest', 'linear'
Returns: A (m, 4) array of interpolated bounding boxes for the target frames.
Source code in src/dnt/engine/bbox_interp.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |