Analysing the court data, part 1
Analysing the data we captured in the court, answering important questions that will inform future decisions about the vision system.
- Stereo Vision
What I’m trying to achieve
A few days ago, Steven and I went to an empty badminton court to gather data for our detection and prediction algorithm. Today, my goal is to answer:
- Do I need to hand label things again?
- What was the purpose of getting all those shots of the floor without anything in them?
- How accurate was our plane, which we created from all the badminton birdies on the court (namely, how do we quantify how good that approach was)?
- What is the value of gravity our recordings give us?
- How can I use the ~124 GB of footage we have from when we did a simple sweep over the different camera settings to see if we truly picked the right ones (9 dB gain, 100 fps, 4 ms exposure)?
- How good is our current detection method in the court setting?
- How good is our current tracking method in the court setting?
The results of this will be to create a plot (or set of plots) showing how accurate our predictions are as a function of time, in two dimensions: WHEN the birdie will reach the floor, and WHERE the birdie will reach the floor.
Driving questions
- How do I present the data from these recordings in a useful way?
Context
The cameras were calibrated at the court.
But we still need a way to transform our camera coordinates into the court coordinates. Instead of getting a ChArUco marker, we will use the court lines, whose sizes are standard, and set the origin (0, 0, 0) at this corner:
We placed several birdies on the floor (cork facing upwards) in known spots.
We then measured the coordinates in the camera frame, which gave us enough information to perform a homogeneous transformation to the court frame.
Question 1
Do I need to hand label things again?
First, I need to label when a hit started in our data, and where the birdie hit the ground. I am just trimming our data to the useful bits.
cd ~/Projects/baddy-bot/vision/analysis
~/.venvs/cpsc330/bin/python landing_label.py ~/Projects/baddy-bot/recordings/court_2026-11-21 --shot shot_01
With labelling done (took 68 minutes by the way), it is time to address question 2.
Question 2
What was the purpose of getting all those shots of the floor without anything in them?
We got a few shots of empty floors. We did this so we could figure out where our birdies were when we went to place them on the court:
Question 3
How accurate was our plane, which we created from all the badminton birdies on the court (namely, how do we quantify how good that approach was)?
To quantify how good this approach is, I have to explain that our camera readings perform worse at larger distances. Part of this is calibration, the other part is math:
- : depth from the cameras
- : focal length, 1908 px
- : baseline, 0.617 m
- : disparity, how far the birdie shifts between the two cameras’ images, in pixels
- : the disparity error, and the depth error it causes
Having a pixel error this large implies a 17 cm error at 14 m away!
In this stage, we are not addressing how to minimise this error. We are simply looking to use the court lines, and the camera coordinates, to create a plane which represents the floor.
To do this, we create a matrix which transforms the distance between where we know the birdies are in the court frame:
| Birdie | x (m) | y (m) | z (m) |
|---|---|---|---|
| N1 | 0.46 | 0.035 | 4.72 |
| N3 | 2.46 | 0.035 | 4.72 |
| F1 | 0.00 | 0.035 | 8.68 |
| F3 | 0.00 | 0.035 | 13.40 |
| F4 | 3.05 | 0.035 | 13.40 |
and the set of camera coordinate positions of those birdies:
| Birdie | x, up (m) | y, right (m) | z, out of the lens (m) |
|---|---|---|---|
| N1 | -2.079 | 1.718 | 5.761 |
| N3 | -2.049 | -0.310 | 5.724 |
| F1 | -3.149 | 2.293 | 9.727 |
| F3 | -4.395 | 2.403 | 14.348 |
| F4 | -4.257 | -0.729 | 13.839 |
Since each camera reading is going to have varying error (depending on depth, mainly), the error will NOT be uniform.
| Birdie | Depth from the cameras (m) | Placed at x, z (m) | T puts it at x, z (m) | Error in x (cm) | Error in y (cm) | Error in z (cm) | Error magnitude (cm) |
|---|---|---|---|---|---|---|---|
| N1 | 5.76 | 0.46, 4.72 | 0.52, 4.72 | +5.8 | -0.6 | +0.4 | 5.9 |
| N3 | 5.72 | 2.46, 4.72 | 2.55, 4.67 | +8.6 | +0.7 | -5.5 | 10.3 |
| F1 | 9.73 | 0.00, 8.68 | -0.03, 8.84 | -2.5 | -0.1 | +15.6 | 15.8 |
| F3 | 14.35 | 0.00, 13.40 | -0.10, 13.62 | -9.9 | +0.5 | +22.3 | 24.4 |
| F4 | 13.84 | 3.05, 13.40 | 3.03, 13.07 | -2.0 | -0.5 | -32.9 | 33.0 |
Here is a render I asked Claude to make to help us visualise what this error looks like more intuitively.
What I have learned from this is that I ought to place more birdies closer to the camera, where the readings of the camera are more trustworthy, such that the transformation of these birdies in the camera coordinates ends up on the real plane (the actual floor) more precisely.
And that leads us to question 4.
Next
- Present to the team.
- Address questions 4-7.