From the course: OpenCV for Python Developers
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Introduction to template matching
From the course: OpenCV for Python Developers
Introduction to template matching
- [Instructor] When it comes to feature detection, template matching is a readily available and straightforward method. The way template matching works is it searches for a similar pattern between two images. This is accomplished by taking a reference image, called a template, and sliding it around the other comparison image, taking a difference at every position. The result is a black and white, grayscale image, with varying intensities showing how well it matched in each position. Using a 1D, somewhat modified example, we can see that as we slide our template, which is a triangle, across the screen, it does a comparison at each spot. On the far left, there are no matches, so it has a perfectly black value but as it goes to the right and starts to overlap, it gets a gray value, indicating a partial match at some of the pixels of the template itself. Then, when it perfectly overlaps the red triangle in the image, it…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.