A computer vision-based dart trajectory tracking system for RoboMaster competitions. This project uses OpenCV to detect and track yellow darts in video footage, visualizing their flight paths in real-time or post-processing.
- Real-time Dart Detection: Track yellow-colored darts using RGB color space filtering
- Trajectory Visualization: Display the complete flight path with motion trails
- Web Interface: Interactive web-based parameter tuning and visualization
- Color Range Adjustment: Built-in tools for calibrating color detection parameters
- Multi-mode Processing: Support for single dart, multi-dart, and RGB-based tracking
- Configurable Parameters: JSON-based configuration for easy parameter management
dart_2025_trajectory/
├── src/ # Source code
│ ├── track_dart.py # Main tracking script
│ ├── track_dart_rgb.py # RGB-based tracking
│ ├── track_single_dart.py # Single dart tracking
│ ├── track_dart_web.py # Web interface with Flask
│ └── adjust_color_range.py # Color calibration tool
├── templates/ # HTML templates
│ └── track_dart.html # Web interface template
├── data/ # Input video files
├── output/ # Generated output videos
├── examples/ # Example videos and results
├── dart_track_config.json # Configuration parameters
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore rules
└── README.md # This file
- Python 3.7+
- OpenCV
- NumPy
- Flask (for web interface)
- Clone the repository:
git clone https://github.com/illini-robomaster/dart_2025_trajectory.git
cd dart_2025_trajectory- Create and activate a virtual environment (recommended):
python -m venv .venv
# Windows
.venv\Scripts\activate
# Linux/Mac
source .venv/bin/activate- Install dependencies:
pip install -r requirements.txtTrack a dart in a video file:
python src/track_dart.pyThe script will process the video and save the output with trajectory overlay.
Launch the interactive web interface for real-time parameter tuning:
python src/track_dart_web.pyThen open your browser and navigate to http://localhost:5000
Features:
- Real-time parameter adjustment
- Frame-by-frame analysis
- Live trajectory preview
- Configuration save/load
Adjust color detection parameters for different lighting conditions:
python src/adjust_color_range.pyUse the trackbars to fine-tune HSV/RGB ranges until the dart is properly detected.
Edit dart_track_config.json to customize tracking parameters:
{
"R_min": 77,
"R_max": 246,
"G_min": 105,
"G_max": 255,
"B_min": 0,
"B_max": 150,
"Min_Area": 26,
"Max_Area": 1906,
"RG_ratio": 23,
"RB_diff": 70,
"Max_Jump": 158,
"Exclude_Right": 480,
"Exclude_Bottom": 701,
"Min_Motion": 27,
"Motion_Frames": 2
}Key Parameters:
R/G/B_min/max: RGB color range for dart detectionMin/Max_Area: Size constraints for dart detection (in pixels)RG_ratio: Red-Green ratio thresholdRB_diff: Red-Blue difference thresholdMax_Jump: Maximum pixel distance between consecutive framesExclude_Right/Bottom: Exclude zones to filter out false positivesMin_Motion: Minimum motion thresholdMotion_Frames: Number of frames to confirm motion
Main tracking script with HSV-based color detection. Best for controlled lighting.
RGB-based tracking with advanced filtering. Better for varied lighting conditions.
Optimized for tracking a single dart with higher accuracy.
Flask web application providing an interactive interface for parameter tuning and real-time visualization.
Interactive tool for calibrating color detection parameters using trackbars.
The tracking system uses several computer vision techniques:
- Color Space Filtering: Detects dart using RGB/HSV color thresholds
- Contour Detection: Identifies dart shape using OpenCV contours
- Motion Analysis: Filters false positives using motion detection
- Trajectory Smoothing: Maintains trajectory history with deque
- Spatial Filtering: Excludes specific regions to reduce false positives
- Adjust color ranges based on your lighting conditions
- Use the web interface for quick parameter iteration
- Enable exclusion zones to filter out background objects
- Tune
Max_Jumpto prevent tracking jumps - Adjust
Min_AreaandMax_Areabased on dart size in frame
Contributions are welcome! Please feel free to submit a Pull Request.
This project is developed for the Illini RoboMaster team.
Illini RoboMaster Team - Dart Trajectory Analysis Group
- RoboMaster Competition
- OpenCV Community
- Illini RoboMaster Team
For questions or suggestions, please open an issue on GitHub.
Note: Place your input videos in the data/ folder and output videos will be saved to output/.