O'Reilly logo

Computer Vision with Python 3 by Saurabh Kapur

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Template matching

In this section, we learn about how to locate a template image in an image using some OpenCV functions. A smaller image template matching will help get coordinates in a larger image that match with the template. Let us try to understand this with an example and also see how to write the code for it in Python. The following Figure 17 is the template image we are going to use in our example:

Figure 17: Template image that we wish to find in an image

The following Figure 18 is the original image in which we have to locate the template image:

Figure 18 Image used to find the template shown in Figure 17

In the code for template ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required