feat: add DISTANCE mode with traces and leaderboard (PR 4)#63
Draft
AlexBodner wants to merge 3 commits into
Draft
feat: add DISTANCE mode with traces and leaderboard (PR 4)#63AlexBodner wants to merge 3 commits into
AlexBodner wants to merge 3 commits into
Conversation
Integrate distance via gated homography on VideoTrackingSession.tracks while reusing gap-filled speed badges and minimap traces from PR3. Co-authored-by: Cursor <cursoragent@cursor.com>
Share _render_speed_distance_traces in distance.py with focus_tid and append_end_card hooks, plus spotlight helpers and only_tid speed filtering, so PR5 adds wiring only. Co-authored-by: Cursor <cursoragent@cursor.com>
Shared renderer accepts show_speed; SPEED_AND_DISTANCE wiring in PR5 uses show_speed=True. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DISTANCEanalytics mode: direction dots (same as DIRECTION) plus cumulative distance chips (m), per-player trace lines on the radar minimap, and a 3-second distance leaderboard end-card. No m/s badges.VideoTrackingSession.tracks._render_speed_distance_traces(..., show_speed=)indistance.py(spotlight + speed overlay hooks for PR5).Stack: PR 1 → PR 2 → PR 3 (base) → this PR
Demo
DISTANCEmode — speed + distance chips, trace minimap, end-card (08fd33_0.mp4, truncated preview).Download full demo clip
Homography / kinematics design
VideoTrackingSession.tracks— lazycollect_tracks+compute_kinematicsusing_gated_speed_transforms()(not gap-filled).session.gap_filled_transforms_by_frame— instant speed badges (same as SPEED).session.minimap_transforms_by_frame— warp feet for trace buffer on radar.valid_pitch_cm()— filters trace outliers before drawing polylines.Scope
examples/soccer/distance.py— shared trace renderer +run_distancekinematics.py—PlayerTrack,compute_kinematics,cumulative_distance_at_framemotion.py—draw_distance_labels,build_trace_minimap,draw_distance_end_card,dim_frame,spotlightspeed.py—only_tidfilter on_speed_by_tidMode.DISTANCEwired inmain.py+ README sectionNot included:
run_all,SPEED_AND_DISTANCEwiring (PR5), GK goal-distance locks, goal shading (PR6).Test plan
python main.py --source_video_path data/2e57b9_0.mp4 --target_video_path data/renders/2e57b9_0-distance.mp4 --mode DISTANCE --max-frames 90 --tracker bytetrack