A golf ball tracking compass system that helps golfers locate their ball after hitting it. The system uses computer vision to track golf ball trajectories and provides directional guidance via a web interface.
- Real-time golf ball detection and tracking
- Trajectory prediction for errant shots
- Web-based compass interface
- Works on Mac (prototyping) and Raspberry Pi (production)
- Install dependencies:
pip install -r requirements.txt- Copy environment configuration:
cp .env.example .env-
Adjust
.envsettings if needed (camera index, thresholds, etc.) -
Run the application:
python src/main.py- Open your browser to
http://localhost:5000
- Install system dependencies:
sudo apt-get update
sudo apt-get install -y python3-pip python3-opencv libopencv-dev- Install Python dependencies:
pip3 install -r requirements.txt- Configure
.envfor Raspberry Pi camera:
CAMERA_INDEX=0 # or use /dev/video0- Run the application:
python3 src/main.py- Access from your phone/tablet at
http://<raspberry-pi-ip>:5000
golfeye/
├── src/
│ ├── detection/ # Ball detection modules
│ ├── tracking/ # Ball tracking and trajectory prediction
│ ├── compass/ # Direction calculation
│ ├── web/ # Web server and frontend
│ ├── camera/ # Camera abstraction
│ └── main.py # Main application entry point
├── models/ # ML models (optional)
├── tests/ # Unit and integration tests
└── requirements.txt # Python dependencies
See .env.example for all configuration options. Key settings:
CAMERA_INDEX: Camera device index (0 for default)FRAME_SKIP: Process every Nth frame (higher = better performance)LAUNCH_VELOCITY_THRESHOLD: Minimum velocity to detect ball launchWEB_PORT: Web server port
- Position the camera on your golf cart to view the golfer
- Start the application
- Open the web interface on your phone/tablet
- Hit your golf ball
- The compass will guide you to the predicted landing location
The system uses a hybrid detection approach:
- Color-based detection (fast, good for white balls)
- ML verification (optional, more accurate)
- Kalman filtering for smooth tracking
- Physics-based trajectory prediction
MIT