We start this chapter by exploring the QR code standard and learning how to generate our own QR codes. Then, we use the OpenCV computer vision library to detect QR codes in images, as well as to read the data encoded in the QR code itself. We will then learn how to save the video stream data from the camera to the filesystem so that multiple applications can simultaneously read live video data. This will allow us to check the video stream for QR codes we are interested in, as well as stream the video to desktop and web applications at the same time. We will use the Tornado web framework to create a Motion JPEG video server that can be accessed from any mobile device or computer on the network to get a live view of the robot’s camera video stream. Finally, we end the chapter by creating a robot that can move around in search of matching QR codes in its environment.
Bringing all these technologies together helps us solve the problem of having robots use computer vision to investigate their environment and move around to different desired locations by looking for matching QR codes. This is a core functionality for many robots that must perform autonomous navigation in warehouses or factories.