Haar features of Image feature extraction from target detection (c)

Source: Internet
Author: User

Disclaimer: This article is reproduced from Liulina603

1.haar-like characteristics

The haar-like feature was first applied to face expression by Papageorgiou ,Viola and Jones on this basis, using 3 types of 4 characteristics of the form.

Haar features are divided into three categories: Edge features, linear features, central features, and diagonal features, which are combined into feature templates. The feature template has both white and black rectangles, and defines the template's characteristic values as white rectangle pixels and minus black rectangle pixels and. the Haar characteristic value reflects the gray-level change of the image. For example: Some features of the face can be described by a simple rectangular feature, such as: The eye is darker than the cheek color, the nose bridge on both sides of the bridge than the color to deep, mouth than the surrounding color to be deep. But the rectangle feature is sensitive to some simple graphic structures, such as edges and segments, so it can only describe the structure of a particular trend (horizontal, vertical, diagonal).

for the characteristics of A, B and D in the figure, the characteristic numerical formula is:v=sum white -sum Black, and for C , the formula is as follows:V =sum White -2*sum black; The black area pixels are multiplied by 2to make the number of pixels in the two rectangular regions consistent.

By changing the size and position of the feature template, a large number of features can be quoted in the Image sub-window. Feature template is called "feature prototype"; The feature prototype expands in the image Subwindow (translation scaling) The resulting features are called "rectangular features", and the values of the rectangular features are called "eigenvalues".

Rectangular features can be anywhere in the image, and the size can be arbitrarily changed, so the rectangular eigenvalue is a rectangular template category, rectangular position and the size of the rectangle three factors of the function. Therefore, the category, size and position of the change, so that very small detection window contains a lot of rectangular features, such as: In the 24*24 pixel size of the detection window within the number of rectangular features can reach the million. So there are two problems to solve: (1) How to quickly calculate so many features? --- integral graph prowess; (2) which rectangular features are most effective for classifier classification? --- such as through the AdaBoost algorithm to train (this piece is not discussed here, specifically see http://blog.csdn.net/zouxy09/article/details/7922923 )

2. Calculation ofhaar-like features - integral graph

The integral graph is a fast algorithm that can find all the pixels in the image and the efficiency of the image eigenvalue calculation by traversing only one image.

The main idea of the integral graph is that the pixels of the rectangular region formed from the starting point of the image to each point are stored in memory as an element of an array, and the elements of the array can be indexed directly when the pixels of an area are computed, without recalculating the pixels of the region and speeding up the calculation (this has a corresponding salutation, Called dynamic programming Algorithms). The integration graph can be used to calculate different characteristics at various scales using the same time (constant time), so the detection speed is greatly improved.

Let's see how it's done.

Integral graph is a kind of matrix representation method which can describe global information. The integral graph is constructed by the value of position (i,j) II (I,J) is the same as all pixels in the upper-left direction of the original image (i,j) :

Integration Graph Construction Algorithm:

1) using s (i,j) to denote the summation of the line direction and initialize s (i,-1) =0;

2) use II (I,J) to represent an integral image, initialize II ( -1,i) =0;

3) Progressive scan of the image, recursive calculation of each pixel (i,j) line direction of the summation and s (i,j) and Integral Image II (I,J) values

S (i,j) =s (i,j-1) +f (I,J)

II (I,J) =ii (i-1,j) +s (I,J)

4) Once the image is scanned, the integral image II is constructed when the pixel in the lower right corner of the image is reached.

After the integral graph is constructed, the pixel summation of any matrix region in the image can be obtained by simple operation.

The four vertices of D are α, β, γ, δ, then the pixels of D and can be expressed as

Dsum = II (α) +ii (β)-(II (γ) +ii (δ));

The haar-like eigenvalue is nothing more than two matrix pixels and the difference, can also be completed in constant time. Therefore, the eigenvalue calculation of a rectangular feature is only related to the integral graph of the vertex of this feature rectangle, so no matter how the scale transformation of this feature rectangle is, the time spent on the calculation of the eigenvalues is constant. This allows the eigenvalues of all child windows to be evaluated as long as the image is traversed once.

3.haar-like Rectangle feature Expansion

Lienhart R. The haar-like Rectangle feature Library is further expanded, and the rotation is added . The rectangle feature of the corner. The expanded features are broadly divided into 4 types: Edge feature, line feature ring, center surround feature, and diagonal feature:

During the calculation of the eigenvalues, the weights of the black areas are negative, and the weights of the white areas are positive values. And the weights are inversely proportional to the rectangular area (so that the number of pixels in the two rectangular regions is consistent);

Vertical matrix Eigenvalue calculation:

For the vertical matrix, the same as above 2 .

calculation of rectangular features of the rotation angle of the:

For the rectangle with the rotation angle, we define the pixels of RSAT (x, y) to the upper left corner of the point (x, y) and the lower left corner of the region.

The formula can be expressed as:

In order to save time and reduce the repetition calculation, the following recursive formula can be calculated as follows:

The characteristic value of the computed matrix feature is the difference between the RSAT (x, y) of the cross-row rectangle. Refer to:


Haar features of Image feature extraction from target detection (c)

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.