SunFounder picar-x
5.7 Color Detection
PiCar-X is a self-driving car with a built-in camera, which allows Ezblock programs to utilize object detection and
color recognition code. In this section, Ezblock will be used to create a program for color detection.
Note: Before attempting this section, make sure that the Raspberry Pi Camera’s FFC cable is properly and securely
connected. For detailed instructions on securely connecting the FCC cable, please reference: Component List and
Assembly Instructions.
In this program, Ezblock will first be told the Hue-Saturation-Value (HSV) space range of the color to be detected,
then utilize OpenCV to process the colors in the HSV range to remove the background noise, and finally, box the
matching color.
Ezblock includes 6 color models for PiCar-X, “red”, “orange”, “yellow”, “green”, “blue”, and “purple”. Color cards
have been prepared in the following PDF, and will need to be printed on a color printer.
• [PDF]Color Cards
5.7. Color Detection 99