May of 2020. Around the end of 9th grade school year.
My brother is getting very good at juggling a soccer ball and he records himself to count how many he has done after finishing. As you progress, this number can be in the thousands. Counting this number of juggles by hand to see if you broke your PB is not that fun. Instead, this program counts the number of juggles for you. Automation.
The user selects the ball in order to track it with colors (HSV). The program runs quickly over the video and keeps into acount the ball's Y coordination with relation to the video's frame. After that's done, the program counts the number of peaks in the ball's coordinates, and that number is the number of juggles.
This programming just uses simple computer vision (color) to find and track the ball.
- Python 3
- OpenCV - tracking and locating the ball
- SciPy - finding peaks
- Matplotlib - plotting and graphing
- NumPy - everything. NumPy is very useful
Go here.
OpenCV can either be compiled with CUDA or just CPU, works the same either way.
python3 src/counter_HSV.py path/to/juggling-soccer-ball-video.mov