Surf principle and source code Analysis of "feature matching"

Source: Internet
Author: User

SURF (speed up robust Features) is the SIFT improved version is also accelerated version, improve the detection feature points, the overall performance is better than sift.

The following first introduced surf principle, the final analysis of OpenCV surf source code.

Reprint Please specify source: http://blog.csdn.net/luoshixian099/article/details/47778143

1. Integral Image

Surf is to operate the integral image, thereby accelerating the use of box filters to calculate the Hessian matrix determinant of each pixel, only a few addition and subtraction operations, and the calculation of the size of the box filter is independent, so it can quickly make up the scale pyramid of surf.

The value of each cell in the integral image is the sum of all the elements in the upper-left corner of the corresponding position on the original image.

For example, we want to get the sum of the rectangular pixels in the green rectangular region, just on the integral graph, the operation S=d-b-c+a can be obtained.

2. Construction of scale space

2.1

an approximation of the Doh

Sift employs an approximate algorithm for log, while surf (speed up robust Features) uses the Doh approximation for feature point detection, and log and Doh are two common methods for detecting feature points.

Second order differential Hessian matrix of continuous function f (x, y).

We can use the determinant value of the Hessian matrix to determine if the point (x, y) is an extreme point.

In order to get the four elements of the Hessian matrix in discrete space, the surf uses the second standard Gaussian kernel function to calculate the convolution of the image, because the Gaussian kernel can construct the response image at different scales. At the scale σ, point x= (x, y), corresponding to the Hessian matrix.


LXX is the second derivative of the standard Gaussian function g (x,y,σ) and the result of the convolution of the image at the point (x, y);


Similarly, the calculation method of Lyy,lxy. This calculates the Hessian determinant values for all points on the image.

to be able to speed up operations, bay and other people Using Box Filters approximate processing of Gauss differential templates.


LyylxydyyDxy

, Figure 1 is the Erigos differential template in the y direction, Figure 3 uses a box filter to approximate it, the numbers represent the weights of the corresponding color regions, the gray area weights are 0, and the results of box filter and image convolution are recorded as DXX,DYY,DXY. Because the box filter is computationally fast on the integral image.

Due to the approximation of the original Hessian matrix, it can be proved that the following formula is used to get closer to the real value by the relevant derivation. Due to different scales, the corresponding values (0.9) are different, here in order to unify, the need to calculate the box filter response, the template box to the normalization of processing.


Using the above formula, a Hessian matrix response value is computed for each pixel in the image as a response image at scale σ.

2.2

Tectonic scale space

The tectonic scale space is to find the extremum point in the space domain and the scale domain, as the preliminary characteristic point. The traditional method of constructing the scale space is to construct a Gaussian pyramid, the original image as the lowest level, and then the Gaussian blur and then drop the sample (twice times) as the next layer of image, loop iteration down. Gaussian pyramid is the size of the original image is constantly changing, the Gaussian template size unchanged. The establishment of each layer must wait until the previous layer has been completed before processing, the dependence is very strong, which caused the speed is very slow. Surf constructs the scale pyramid method to use the original image size unchanged, the change is the template size, namely uses the Change Template box size to filter the original image, constructs the scale space. At the same time, surf can use parallel operation to process each layer of image in the pyramid simultaneously. The pyramid is constructed by the response image of the Hessian matrix determinant which is produced by the increasing box size filter template and integral image convolution.

As shown, the diagram on the left is a method for constructing a Gaussian pyramid, and the right image is a method of surf construction.


Surf first uses the 9x9 box filter ( Gauss differential, which is approximately equal to σ=1.2, is recorded as a scale s=1.2 The response image is taken as the lowest image, then the size of the box is gradually enlarged, and the original image is continuously filtered. Similar to sift, the response image is divided into groups, several layers per group. Each group is processed using a gradually increasing filter size. The scale variation between layers and layers is determined by the Gauss differential template. For 9x9 filter, because to ensure that the structure of the filter is the same as the Filter template center, the minimum increase of each block is 2, because there are three blocks, so the minimum increase is 6, that is, the next filter size of 15x15, in turn, increased to 21x21,27x27, ... Using such a template sequence, the scale space is constructed .


2. 3D Non-maximal value suppression

Similar to sift, each pixel on each layer of the image is compared with the response values within and within the spatial neighborhood (excluding the first and last layers of the image), there are 8 neighborhood cells on the same layer, there are 2x9=18 in the vector scale space, a total of 26 cell values are compared, if the maximum value is preserved, As a candidate feature point.


It is also excluded if the response value of the feature point is less than the threshold value of the Hessia determinant.

3.locating feature points accuratelybecause it is the extreme point of discrete space, the position of the feature point is accurately located by fitting method, each feature point contains three information H (x,y,σ), i.e. position and scale. As with the Sift method, you can see the article I wrote about the SIFT principle. derivative and make it equal to 0:calculation method:,
obtain,that is, the offset in three directions
with the above method, the location of each feature point is found, and the description of the surf feature point is described below. 4. Feature point descriptors 4.1assigning a main direction to a feature point

In order to guarantee the rotation invariance, we first assign the main direction to the feature points. At the center of the feature point, 6s is the circle of radius, and the Harr wavelet response of all pixel points is counted. is to calculate the horizontal gradient and the vertical gradient of each pixel point in the Circle field. The length of the Harr wavelet template is 4s. The calculation of the scale S is based on the size of the current template.

, Harr wavelet template (Black 1, White-1)

Each pixel in the circle calculates the horizontal response and the vertical response value of the Harr wavelet, multiplied by the Gaussian weight (σ=2.5s) of the corresponding position.
In order to obtain the main direction, a fan sliding window with a 60 degree angle is used to calculate the sum of the horizontal and vertical responses of the Harr in its region, and sliding the sector window to get the direction corresponding to the largest response area is the main direction of this feature point.


4.2 form feature vectors
along the main direction, take 20sx20s rectangular area as its neighborhood, divide into 4x4 sub-region, statistic Harr wavelet template of pixels in each sub-region, and respond along the main direction and perpendicular to main direction, the width of Harr wavelet template is 2s. The response information for the 16 subregions is counted, and each sub-region is counted in the following formula, with the response of each pixel multiplied by the Gaussian weight of the corresponding position (σ= 3.3s). so each sub-region carries 4 messages, a total of 16 sub-regions, a total of 64 dimensions. Finally, in order to prevent the influence of illumination and contrast, the characteristic vector is normalized.
about SIFT source analysis, will continue to update ....

Reference:
surf:speeded up robust Features:herbert Bay, Tinne tuytelaars, and Luc Van Gool
http://blog.csdn.net/crzy_sparrow/article/details/7392345
http://blog.csdn.net/yangtrees/article/details/7482960
Http://www.cnblogs.com/tornadomeet/archive/2012/08/17/2644903.html


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Surf principle and source code Analysis of "feature matching"

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.