This project aims to output a PDF with vector trajectories drawn on a user-provided PDF.
A Python tool that analyzes GamePigeon 8 ball screenshots and predicts ball trajectories using computer vision and physics simulation.
- Automatic Ball Detection: Uses Hough Circle Transform to detect pool balls
- Table Detection: Identifies pool table boundaries using color segmentation
- Cue Direction Detection: Automatically detects the shot direction
- Physics Simulation: Calculates ball trajectories with collision detection
- PDF Output: Generates annotated PDF with predicted ball paths
- Python 3.8 or higher
- pip package manager
- Navigate to the project directory:
cd gamepigeon-pool-predictor- Install dependencies:
pip install -r requirements.txtProcess a GamePigeon screenshot and generate trajectory prediction:
python -m src.main <input_screenshot> <output_pdf>Example:
python -m src.main examples/sample_screenshots/shot1.png output.pdfCustom Initial Velocity:
python -m src.main input.png output.pdf --velocity 8.0Custom Configuration:
python -m src.main input.png output.pdf --config my_config.yamlDebug Mode (shows visualization window):
python -m src.main input.png output.pdf --debuginput: Path to GamePigeon screenshot (required)output: Path to output PDF file (required)--config: Path to custom configuration YAML file (optional)--velocity: Initial cue ball velocity in m/s (default: 5.0)--debug: Show debug visualization window before generating PDF
The detection and simulation parameters can be customized in config/detection_params.yaml:
hsv_lower/upper: HSV color range for green feltmin_area: Minimum contour area for table
dp: Hough Circle accumulator resolutionmin_dist: Minimum distance between ball centersparam1/param2: Hough Circle sensitivity parametersmin_radius/max_radius: Expected ball radius range
threshold: Line detection sensitivitymin_line_length: Minimum cue stick lengthproximity_threshold: Maximum distance from cue ball
max_bounces: Maximum cushion bounces to simulatemin_velocity: Velocity threshold for stoppinginitial_velocity: Default cue ball speed