Player Track
The bounding box of one player in the video picture over a time span, 4 samples per second. Pick the player by ID, or by a click on the video frame.
Request
GET /analyses/{id}/player-track?player_id=0-7&start=600&end=630
GET /analyses/{id}/player-track?t=612.4&x=0.48&y=0.62
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
integer | Yes | Analysis ID |
player_id |
string | With start, end |
Player ID to follow, e.g. 0-7 |
t |
float | With x, y |
Time of the click, seconds from video start |
x |
float | With t, y |
Horizontal click position, 0-1 of the frame width, left to right |
y |
float | With t, x |
Vertical click position, 0-1 of the frame height, top to bottom |
start |
float | With player_id |
Window start, seconds from video start. Optional with a click: the window then runs from t - 10 to t + 10 |
end |
float | With player_id |
Window end, seconds from video start. At most 600 seconds after start |
Send player_id or a click (t, x, y), not both. With a click and a window, t must lie inside the window.
422 on a request that breaks these rules:
{ "detail": "Give either player_id with start and end, or a click: t, x and y." }
404 when the analysis has no tracking, or when the player was never tracked:
{ "detail": "Player 0-99 does not appear in this analysis's tracking" }
Response
{
"player_id": "0-7",
"team": 0,
"box_source": "tracking",
"click": { "t": 612.4, "x": 0.4812, "y": 0.6533, "role": "player" },
"segments": [
{
"t0": 602.6,
"dt": 0.25,
"x": [0.4521, 0.4533, 0.4547], // ... 41 in total
"y": [0.6401, 0.6405, 0.6412], // ... 41 in total
"w": [0.0198, 0.0198, 0.0201], // ... 41 in total
"h": [0.0712, 0.0715, 0.0719] // ... 41 in total
},
{
"t0": 614.68,
"dt": 0.25,
"x": [0.5012, 0.5019], // ... 17 in total
"y": [0.6611, 0.6617], // ... 17 in total
"w": [0.0204, 0.0206], // ... 17 in total
"h": [0.0731, 0.0733] // ... 17 in total
}
]
}
Top level
| Field | Type | Description |
|---|---|---|
player_id |
string | null | Player ID of the tracked player. Null when the click matched nothing, an unidentified player or a referee |
team |
integer | null | 0 or 1, from the player ID. Null when player_id is null |
box_source |
string | null | Where w and h come from. tracking: the measured box, on analyses from version 0.5.75. estimated: from how far down the frame the player stands, fitted per analysis on the boxes in its events. Null when neither is available, or player_id is null |
click |
object | null | The detection the click was matched to. Null when the request names a player_id, or when nothing was found near the click |
segments |
array | The track in the window, in time order. [] when the player is not in the picture during the window, or player_id is null |
Click object
| Field | Type | Unit | Description |
|---|---|---|---|
t |
float | s | Time of the matched frame, the frame nearest the requested t |
x |
float | Horizontal position of the matched player's feet, 0-1 of the frame width |
|
y |
float | Vertical position of the matched player's feet, 0-1 of the frame height |
|
role |
string | player, goal_keeper or referee |
A click matches the person whose bounding box is under the cursor on that frame, with a margin of a quarter of the box height. Overlapping boxes go to the box whose centre is nearest. A click on a referee or on a player without an identified shirt number returns click with player_id null and no segments.
Segment object
The pixel_coords shape of Query Intervals, plus the box size. The box of sample i spans x - w/2 to x + w/2 horizontally and y - h to y vertically.
| Field | Type | Unit | Description |
|---|---|---|---|
t0 |
float | s | Time of the first sample |
dt |
float | s | Time between samples, 0.25. Sample i is at t0 + i * dt |
x |
array | Horizontal position of the player's feet (bottom centre of the bounding box) per sample, 0-1 of the frame width |
|
y |
array | Vertical position of the player's feet per sample, 0-1 of the frame height. Same length as x |
|
w |
array | null | Box width per sample, as a share of the frame width. Null when box_source is null |
|
h |
array | null | Box height per sample, as a share of the frame height. Null when box_source is null |
A new segment starts when the player is out of the picture or unidentified for more than 0.5 seconds, or when the track jumps faster than a person can move. Draw nothing between segments.
Warning
An estimated box is typically 10-20 % off in size, more where the camera zooms. It does not fit the player tightly.
Warning
Only the segment that holds click.t is guaranteed to be the person clicked. Other segments follow the same player_id, which the analysis can attach to a different person after a gap.