Skip to content

Conversation

Copy link

Copilot AI commented Jan 28, 2026

MOT tracking labels (TID/CID) positioned at y1 - vertical_offset become invisible when bounding boxes appear near the image top, as the calculated y-coordinate goes negative or clips at the edge.

Changes

  • Label positioning logic (basenode.py, draw_util.py)

    • Add 5px margin check before positioning labels above bbox
    • Reposition labels inside bbox when y_pos < margin
    • Preserve TID/CID ordering and spacing in both positions
  • Test coverage (test_mot_label_visibility.py)

    • Validate positioning logic across edge cases (y=0, small y1, sufficient space)
    • Verify implementation in both draw functions
# Before: Always above bbox (clips at top)
cv2.putText(image, text, (x1, y1 - vertical_offset_1), ...)

# After: Reposition when too close to edge
tid_y_pos = y1 - vertical_offset_1
if tid_y_pos < 5:
    tid_y_pos = y1 + vertical_offset_1  # Inside bbox
cv2.putText(image, text, (x1, tid_y_pos), ...)

Normal positioning (labels above bbox) remains unchanged when sufficient space exists.

Original prompt

le tracking est non visible sur MOT, verifie est fix


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 28, 2026 18:17
- Add check to reposition labels inside/below bbox when at image top
- Labels now always visible regardless of bbox position
- Apply fix to both basenode.py and draw_util.py
- Add comprehensive tests for label visibility

Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
- Add 5-pixel margin to prevent labels at y=0 edge
- Update all tests to reflect margin-based positioning
- Address code review feedback for edge case handling

Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix non-visible tracking on MOT Fix MOT tracking label clipping at image boundaries Jan 28, 2026
Copilot AI requested a review from hackolite January 28, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants