Basic concepts and algorithms of template matching in Image Pattern Recognition

Source: Internet
Author: User

Cognition is a process of associating an unknown with a known one. For a complex visual system, multiple expressions of input and other knowledge coexist. Perception is the process of combining visual input with existing expressions, and identification and needs to establish or discover the relationship between various internal expressions. Matching is the technology and process of establishing these connections. The purpose of establishing a connection is to explain the unknown with known information. (From Chapter Jin's Image Engineering)

1. template matching method:

In the process of machine identification, it is often necessary to align two or more images of the same scene acquired by different sensors or the same sensor at different times and under different imaging conditions in space, or find the corresponding pattern in another image based on the known pattern, which is called matching. In remote sensing image processing, sensors in different bands need to set up the multi-spectral images of the same scene according to the corresponding image points, and then classify the images based on the nature of the image points. If you use two photos taken on the same ground at different times, you can find the changed image points of the features after the settings, and then you can analyze the changes in those parts of the graph; the two sensors at a certain distance are used to take two pictures of the same object. After finding the corresponding point, the distance between the object and the camera can be calculated, that is, the depth information.

The general image matching technology is to use a known template to match and compute the recognized image to obtain the information and coordinates of the template contained in the image;

2. Basic Algorithms:

We use the following formula to measure the relationship between the template T (m, n) and the covered subgraph SIJ (I, j). We know the original image S (W, h ),:

Use the following formula to measure their similarity:

In the preceding formula, the first item is the sub-graph energy, and the third item is the template energy, which has nothing to do with template matching. The second item is the mutual correlation between the template and the subgraph, which changes with (I, j. When the template matches the subgraph, the value ranges from the maximum value. After normalization, obtain the correlation coefficient of template matching:

When the template is exactly the same as the subgraph, the correlation coefficient R (I, j) = 1. After completing all searches in the searched graph s, find the maximum rmax (IM, JM) of R, and the corresponding subgraph simjm matches the target. Obviously, using this formula for Image Matching requires a large amount of computation and slow speed. We can use another algorithm to measure the error between T and SIJ. The formula is as follows:

Calculate the vector error of the two images to increase the calculation speed. Select an error threshold value E0 based on different matching directions. When E (I, j)> E0, the calculation is stopped, continue with the next calculation.

The final experiment proves that the larger the image to be searched, the slower the matching speed; the smaller the template, the faster the matching speed; the larger the threshold value, the greater the matching speed;

3. Improved Template Matching Algorithm

Change the template matching process to match the template twice;

The first match is a rough match. Take the row/column data of the template, that is, 1/4 of the template data, and perform the row/column match on the searched soil, that is, match within the 1/4 range of the source image. The matching speed is significantly improved because the data volume is greatly reduced. At the same time, a reasonable Error Threshold Value E0 must be designed:

E0 = E0 * (m + 1)/2 * (n + 1)/2

Formula: E0 is the maximum error of the average of each point, generally 40 ~ 50;

M, n is the template's length and width;

The second match is exact match. In the neighborhood of the first smallest point of error (Imin, jmin), that is, in the corner (Imin-1, jmin-1), (Imin + 1, jmin + 1) to obtain the final result.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.