diff --git a/src/api/media_api.rs b/src/api/media_api.rs index aec149c..b707958 100644 --- a/src/api/media_api.rs +++ b/src/api/media_api.rs @@ -404,13 +404,22 @@ async fn trace_video( y_pos -= 22; } - // Green thin bounding boxes with trace_id label for each face detection + // Bounding boxes: interpolated (thickness=1) + actual (thickness=4) with trace_id label for (tid, frames) in &sorted_traces { + let range_enable = format!("between(n,{},{})", frames[0] as i64 - frame_offset, frames[frames.len() - 1] as i64 - frame_offset); + // Interpolated bbox at first known position across the whole trace range + if let Some((x, y, w, h)) = bbox_per_frame.get(&(*tid, frames[0])) { + parts.push(format!( + "drawbox=x={}:y={}:w={}:h={}:color=green@0.3:thickness=1:enable='{}'", + x, y, w, h, range_enable + )); + } + // Actual detection bboxes with trace_id label for fn_ in frames.iter() { if let Some((x, y, w, h)) = bbox_per_frame.get(&(*tid, *fn_)) { let n = *fn_ as i64 - frame_offset; parts.push(format!( - "drawbox=x={}:y={}:w={}:h={}:color=green@0.5:thickness=1:enable='between(n,{},{})'", + "drawbox=x={}:y={}:w={}:h={}:color=green@0.5:thickness=4:enable='between(n,{},{})'", x, y, w, h, n, n )); parts.push(format!(