A real-time computer vision tool that detects yellow objects from a webcam feed, calculates the distances between them using pixel-to-centimeter calibration, and visualizes everything dynamically on screen.
- 🟡 Yellow Object Detection using HSV color filtering
- 🧠 Dynamic Calibration using two mouse clicks + real-world input
- 📏 Distance Calculation in centimeters
- 🔤 Auto-labeling of objects (A, B, C...)
- 🎯 Trackbars for HSV tuning to refine detection
- 📸 Snapshot saving (
skey) - 🧮 Real-time FPS and Object Count overlay
- 🖱️ Interactive mouse-based calibration
- ♻️ Trackbar Reset & Calibration Clear via keyboard
- Language: Python 3.8+
- Libraries: OpenCV (cv2), NumPy, Math, Time
Make sure you have Python 3.8+ installed. Then install the required libraries:
pip install -r requirements.txt-
Clone the repository:
git clone https://github.com/DharminJoshi/YellowTrack-By-DevKay.git
-
Navigate to the project folder:
cd YellowTrack-By-DevKay -
Run the script:
python main.py
| Key | Action |
|---|---|
q / ESC |
Quit the program |
s |
Save a snapshot (snapshot.png) |
c |
Clear calibration points |
r |
Reset HSV trackbars |
- In the final output window, left-click twice to select two points.
- You'll be asked to input the real-world distance (in centimeters) between those points.
- The tool will auto-update the internal pixel-to-cm scale.
- After calibration, all distances will be shown in cm.
- Run the script.
- Tune the HSV trackbars until only yellow objects are detected.
- Left-click on two known points to calibrate scale.
- Watch labels and distances render dynamically.
- Press
sto save the current frame.
yellowtrack-by-devkay/
├── main.py # Main Python script
├── requirements.txt # Python dependencies
├── README.md # Project documentation
├── LICENSE # LICENSE File
└── snapshot.png # Saved snapshots (generated)
- Multi-color detection (red, blue, green, etc.)
- Export data to CSV (object positions, distances)
- Data-Logging
- Object tracking using object IDs across frames
- Auto-calibration via reference object
- Web-App Integration
This project is licensed under the CC BY-NC 4.0 License.
See the LICENSE file for full details.
This tool is intended for educational and personal use only.
Accuracy of distance measurement depends on proper calibration and camera positioning.
Provided "as is" — the developer assumes no liability for any misuse or consequences.
- Developer: Dharmin Joshi / DevKay
- Email: info.dharmin@gmail.com
- LinkedIn: linkedin.com/in/dharmin-joshi-3bab42232
- GitHub: github.com/DharminJoshi
Thank you for using YellowTrack-By-DevKay!
Happy yellow-tracking! haha 🎯📐📸