Computer vision: color detection and object tracking
Time: 11:35 AM to 12:15 PM
Your robot’s camera can detect specific colors and track faces. This section introduces classical computer vision, which is fast and works offline but only detects what it was explicitly programmed to look for.
Color detection
Run the computer vision script and open the web stream:
sudo python3 7.computer_vision.py
Open your browser to:
http://picar-x.local:9000/mjpg
Hold a red card or object in front of the camera. You should see a detection bounding box appear around the red area in the stream.
Face tracking
Run the face-tracking script:
sudo python3 8.stare_at_you.py
The camera’s pan/tilt servos will track a detected face, keeping it centered in the frame.
How it works
This is classical computer vision using color segmentation and HSV thresholds. It is:
- Fast - processes frames in real time on the Pi
- Offline - no internet connection needed
- Brittle - it only detects what it was programmed to look for
The robot cannot recognize arbitrary objects. It can only find the specific colors and patterns that were defined in code.
The key question
What is the difference between this and an AI that can recognize any object? That is exactly what you will explore on Day 4.
Day 2 wrap-up
Recap: Your robot now moves, speaks, follows lines, and tracks colors, all without any AI. Everything today used explicit rules. AI replaces rules with learned patterns.
Preview for tomorrow: Connect an LLM, give the robot a microphone, and have a real conversation with it.