SunFounder picar-x
(continued from previous page)
k = cv2.waitKey(1) & 0xFF
if k == 27:
camera.close()
break
There are many other ways to read video streams with OpenCV. The ones used in these examples are better suited for
the next four PiCar-X tasks, such as Color Detection and Face Detection.
For more ways to use video streams, please reference: OpenCV-Python Tutorials.
4.8 Color Detection
This project will add a color detection algorithm to the previous Computer Vision project.
• [PDF]Color Cards
Note: The printed colors may have a slightly different hue from the Python color models due to printer toner differ-
ences, or the printed medium, such as a tan-colored paper. This can cause a less accurate color recognition.
Run the Code
Note:
• This project requires access to the Raspberry Pi desktop to view the footage taken by the camera module.
• You can connect a screen to the PiCar-X or refer to the tutorial remote_desktop to access it with VNC or XRDP.
4.8. Color Detection 63