Chapter 9 introduced feature detection and extraction, but mostly focused on common geometric shapes like lines and circles. Even blobs assume that there is a contiguous grouping of similar pixels. This chapter builds on those results by looking for more complex objects. Most of this detection is performed by searching for a template of a known form in a larger image. This chapter also provides an overview of optical flow, which attempts to identify objects that change between two frames. The specific topics for this chapter include:
Finding instances of template images in a larger image
Using Haar classifiers, particularly to identify faces
Barcode scanning for 1D and 2D barcodes
Finding keypoints, which is a more robust form of template matching
Tracking objects that move
As the name implies, this algorithm works by searching for instances where a bitmap template—a small image of the object to be found—can be found within a larger image. For example, if trying to create a vision system to play Where’s Waldo, the template image would be a picture of Waldo. To match his most important feature, his face, the Waldo template would be cropped to right around his head and include a minimal amount of the background. A template with his whole body would only match instances where his whole body was visible and positioned exactly the same way. The other component in template matching is the image to be searched. In the Waldo example, this ...