Automatic Basketball Shooting Trajectory Analysis
CSEF · 2018 Computational Systems & Analysis
Overview
Objectives/Goals The objective of the project is to build a system to detect the basketball trajectory and provide feedback of the incident angle to the shooter. Methods/Materials I bought a stereo camera kit and built a custom frame to mount it. This allowed me to use a baseline of 39 cm which is much wider than most of the commercially available stereo cameras. I developed my programs on Intel i7 based PCs using C++ and OpenCV library. I used the functions in the OpenCV library to calibrate my stereo camera. I evaluated many different object detecting techniques, and found that cascade detectors had the most promise in addressing my needs. I created an image library and annotated the sample images to train my own cascade models. I used cascade detectors to detect the backboard, rim, and basketball. I developed a custom algorithm to fine-tune the basketball location in the image. By using the reprojection matrix of the stereo camera, I could use the detected pixel coordinates from left and right images to find the basketball position in 3D space. I then wrote a program to collect all the sample basketball positions in the trajectory frame-by-frame, and fitted the samples to a parabola that minimized square errors. The parabola had the best fit to the projectile trajectory, and the incident angle can be derived from the parabola formula. Results I found that it was important to group foreground samples with different shot angles. The most critical factor was using the LBP (local binary patterns) feature type instead of the default HAAR feature type in training cascade models. After training the cascade models with LBP feature type, my program was able to detect the backboard, rim, and basketball. The RMS (root mean square) error of the trajectory detected by the stereo vision was about 7.4 cm at a distance of 7.9 m. I was able to fit the detected trajectory to a parabola and estimated the incident angle. Conclusions/Discussion Cascade models with LBP feature type were used to automatically detect the camera location relative to the backboard and rim, and detect the basketball trajectory. The trajectory was fitted to a parabola in order to estimate the incident angle for providing feedback to the shooter.
Summary statement
I have developed a system that can automatically detect the camera location on the court, detect the basketball trajectory in order to estimate the incident angle, and provide feedback to the shooter.
Help received
I wrote the programs and developed the algorithms myself. I used the OpenCV library extensively. I found answers through web searches for most of my programming questions.
Competition history
- CSEF 2018
Resources
Related projects
CSEF · 2014
Secrets of Shooting Success
ISEF · 2021
Automatic Basketball Return Chute that uses Color Tracking to Rebound the Ball to the Player as they Move around the Court
CSEF · 2015
The Geometry of Banking a Basket
CSEF · 2003
Software for Autonomous Visual Tracking and Calculation of Trigonometric Parallax
ISEF · 2025
Energy in Motion: Engineering a Pendulum Basketball Launcher Using the Coefficient of Restitution to Predict the Launch Path
CSEF · 2018
Low-Cost Archery Assistant with an Interface for the Visually Impaired
ISEF · 2025
Development of an Autonomous Robot Arm System for Playing Ping Pong
CSEF · 2017
Modification of a Ball Machine to Better Approximate a Human Tennis Swing by Providing a Visual Cue
Closest projects by meaning, across every fair and year in the corpus.
Browse more like this
Source: California Science & Engineering Fair public projects