Chapter 13: Robot Vision – Using a Pi Camera and OpenCV
Giving a robot the ability to see things allows it to behave in ways to which humans relate well. Computer vision is still actively being researched, but some of the basics are already available for use in our code, with a Pi Camera and a little work.
In this chapter, we will use the robot and camera to drive to objects and follow faces with our pan-and-tilt mechanism. We'll be using the PID algorithm some more and streaming camera output to a web page, giving you a way to see what your robot is seeing.
The following topics will be covered in this chapter:
- Setting up the Raspberry Pi camera
- Setting up computer vision software
- Building a Raspberry Pi camera stream app
- Running background tasks when streaming
- Following colored objects with Python
- Tracking faces with Python