Documentation Pages
Colored Ball Following
Whisper-bot tracks and follows target color objects by converting camera RGB/BGR frames into HSV space, generating binary thresholds, and driving servo joints to align the camera center with the detected object centroid.
1. Object Centroid Extraction
- HSV Conversion: Transforms input BGR video frames into HSV (Hue, Saturation, Value) coordinates to ensure robust color segmenting under variable lighting.
- Binary Masking: Filters pixels matching range (e.g. RED to white, others to black).
- Contour Detection: Detects edges, corners, and contours to identify the largest contour group (largest circle).
- Circularity Filtering: Validates shape geometry using circularity threshold formula: C = 4 * pi * A / P² (where A is Area, P is Perimeter) to distinguish spheres from arbitrary geometric blocks.
- Tracking Loop: Extracts the center coordinate (x, y) and sphere radius to calculate error vectors, driving pan-tilt camera servos.
Target Color Tracking Flow

Target HSV Color Filtering & Servo Tracking