Target Tracking for pattern recognition --- simplest Target Tracking Method -------- template matching and Correlation Coefficient Method

Source: Internet
Author: User

Preface

Template Matching and correlation coefficient method are typical methods of target tracking. They have many advantages: simplicity and accuracy, wide applicability, good noise resistance, and fast computing speed. The disadvantage is that it cannot adapt to drastic changes in light and severe deformation of the target.

The template matching method is to find the target template location in a frame image, and the most like the template is the target. You just need to compare all the sub-areas of the full graph with the target template and find the sub-areas most like the target template, which is the target location. How can we determine the degree of similarity between the quantum region and the target template? The simplest way is to calculate the correlation coefficient between the two.

 

Correlation Coefficient

Correlation coefficient (r) is a mathematical distance that can be used to measure the similarity between two vectors. It originated from cosine theorem: cos (A) = (A2 + c2-b2)/2bc. if the angle between two vectors is 0 degrees (corresponding to r = 1), they are completely similar. If the angle is 90 degrees (r = 0), they are completely different, if the angle is 180 degrees (r =-1), they are completely opposite. Write the cosine theorem as a vector:

Cos (A) = <B, c>/(| B | * | c | ),

That is: cos (A) = (b1c1 + b2c2 +... Bncn)/SQRT [(B12 + B22 +... + Bn2) (C12 + c22 +... + Cn2)]

The numerator represents the inner product of two vectors, and the denominator represents the Modulo Multiplication of the two vectors.

In practical application, we usually use the mean-less correlation coefficient. In the formula above, we need to subtract the mean of each vector from the numerator denominator:

In this way, the similarity of the two vectors is reduced, and their correlations are amplified.

If the target template is a 10*10 image, it can be regarded as a 100-dimensional vector, and each dimension is the gray value of a pixel. Then compare the vector with each subarea in the image to find the subarea with the highest correlation coefficient, and locate the target.

 

Algorithm Acceleration

It may take several seconds to search for a 30*30 target in a frame of 600*800, which is far from meeting the real-time requirement. There are many places where the above formula can be simplified and accelerated, and the original formula is deformed:

 

In the sum of Xi, the left half of the denominator is a constant and does not have to be calculated every time. On the left side of the numerator, the sum of Yi and the right side of the denominator can be accelerated through the intergral image method. Through these acceleration methods, the algorithm speed can reach within Ms per frame, but it still cannot reach the Real-Time Standard.

 

Search Policy

 

During search, the most stupid method is to traverse the search row by row and calculate each subarea of the image. In fact, the goal usually appears only in a very small area, and computing is not necessary in many places. Therefore, when searching, if the correlation coefficient of the current position is less than a certain threshold value or the position is far away from the target center of the previous frame, the search step size can be increased. Otherwise, the search step size is reduced.

 

Another search method starts from the center of the previous frame and uses the Gradient Descent Method to search for the target. This method requires attention. If the target motion is large, you need to use the image pyramid method to search.

 

Both methods can speed the algorithm up to 30 ms.

 

Template size

 

The determination of the template size is often an experience value. It is not good for a target profile template or a template that contains too many backgrounds. The template of the former is too small, and it is too sensitive to changes to the target, it is easy to lose the target. The latter is the opposite, but the algorithm does not respond when the target changes. Generally, the proportion of the target template is between 30% and ~ 50% is preferred.

 

Http://www.cnblogs.com/easymind223/archive/2012/08/14/2638015.html

Target Tracking for pattern recognition --- simplest Target Tracking Method -------- template matching and Correlation Coefficient Method

Related Article

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.