10 Robotic QR code finder

 

This chapter covers

  • Generating QR codes
  • Detecting and decoding data in QR codes
  • Streaming live video using Motion JPEG
  • Creating a robot that can search for specific QR codes in its environment

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.

10.1 Hardware stack

10.2 Software stack

10.3 Detecting QR codes in an image

10.3.1 Exploring QR codes

10.3.2 Marking detected QR codes

10.4 Streaming live video to multiple applications

10.4.1 Saving the video stream to a ramdisk

10.4.2 Watching the filesystem for changes

10.4.3 Streaming to a graphical application

10.4.4 Detecting QR codes in a video stream

10.4.5 Streaming to a web browser

10.5 Moving the robot to a target QR code

10.5.1 Find the QR code

Summary