A professional-grade computer vision script that isolates a target color, tracks its centroid, and calculates a full PID (Proportional, Integral, Derivative) control signal. This serves as the "brain" for a pan-tilt servo tracking system.
- HSV Color Isolation: Uses the Hue-Saturation-Value color space for robust tracking under varying light.
- One-Click Calibration: Left-click on any object in the video feed to automatically set the tracking range and update the color swatch.
- Full PID Controller:
- P (Proportional): Immediate reaction to error.
- I (Integral): Eliminates steady-state error with built-in windup protection.
- D (Derivative): Predicts motion to dampen oscillations and prevent overshoot.
- Real-time Visualization: * Target "locked/lost" status.
- Error vector arrows.
- PID control signal strength bars.
- Active color swatch preview.
- Python 3.x
- OpenCV: Image processing and contour detection.
- NumPy: High-performance matrix operations and range handling.
- Clone your project directory.
- Install dependencies:
pip install opencv-python numpy