Surf algorithm Analysis
One, integral image
The concept of integral images is proposed by Viola and Jones. The value of any point (I,J) in the integral image is the sum of the gray values of the corresponding focus area of the upper left corner of the original image to any point (I,J), as shown in mathematical equation 1:
So, when we want to calculate the integral of an area of a picture, we just need to calculate the value of the four vertices in the integral image, then we can calculate it by 2-step addition and 2-step subtraction, the mathematical formula is as follows:
Second, Hession matrix detector
1. Spot detection
Spot: An area with color and grayscale differences around it.
In a one-dimensional signal, let it and the Gauss derivative convolution, that is, the Laplace transform, then at the edge of the signal will appear over 0 points, as shown in:
The response value of the Laplace log detector is to measure the similarity of images, such as the three-dimensional and grayscale images of an image's Laplace transform, and the blob size and Laplace function in the image.
When the shape tends to coincide, the Laplace response of the image reaches the maximum.
Hession Matrix is the use of second-order differential for speckle detection, The matrix is as follows:
2. Hession Matrix and box filter
The Hession matrix in the image is as follows:
Their three-dimensional and grayscale graphs are as follows:
Thus, we convert the template (the area in the image) and the convolution operation of the image into the operation of the box filter, as shown in:
3. Simplification of hession Matrix determinant
When we use Sigma = 1.2. Gauss differential filtering, template size for 9x9 the smallest scale spatial value of the image filtering and speckle detection, hession matrix determinant can be simplified as follows:
Constant C does not affect the comparison of extreme points, so the final simplification is as follows, which is also the source of the formula for calculating the Hession response value in surf paper:
In addition, the response value is normalized according to the filter size to ensure that the F-norm of the filter of any size is uniform. The 0.9^2 is the relative weight of the filter response w is to balance the expression of the Hessian determinant. This is to maintain consistency between the Gaussian nucleus and the approximate Gaussian nucleus. In theory, the W value is different for different σ values and for the corresponding size of the template size, but for the sake of simplification, it can be considered the same constant. Using the approximate Hessian matrix determinant to represent the BLOB response value at a point x in the image, traversing all the cell points in the image, the response image of the glass point detection at a certain scale is formed. Using a different template size,
The pyramid image of multi-scale speckle response is formed, which can be used to search the extreme point of speckle response.
Third, 3D non-maximal value suppression
1. Scale pyramid Structure
In the surf, the Hession matrix response is obtained by increasing the box filter template size and integral image, and then the 3D non-maximal value suppression is applied to the response image, and various scales are obtained.
Spots, the following are two different pyramids, the surf pyramid belongs to the second kind:
In the surf, the 9x9 size filter is used as the starting filter, after which the filter size can be calculated by the following formula:
Octave, interval in the formula are starting from 1, that is, when the No. 0 Group No. 0 layer, in the formula Octave = 1, interval = 1.
The reasons for defining the filter size in this way are as follows;
Filter response length, filter size, group index O, layer index s
The relationship between scale Sigma is as follows:
A similar approach is used to process several other sets of template sequences. The method is to double the filter size increase (6,12,24,38). In this way, the second set of filter sizes can be obtained, which are 15,27,39,51 respectively. The filter size of the third group is 27,51,75,99. If the size of the original image is still larger than the corresponding filter size, the analysis of the scale space can be carried out in the fourth group, the corresponding template size is 51, 99,147,195. Shows the change in the filter size for the first group to the third group:
In the case of normal scale analysis, the number of detected spots rapidly decays as the scale increases. So it is generally possible to do 3-4 groups, at the same time, in order to reduce the computational capacity, improve the speed of calculation, you can consider the filter, the sampling interval is set to 2.
2, in order to locate the interest point in the image and the different size, we use the 3x3x3 neighborhood non-maximum value suppression:
All values less than the preset extrema are discarded, increasing the extremum to reduce the number of detected feature points, and eventually only a few of the strongest features will be detected. Detection process with the scale layer image resolution relative to the size of the filter to detect, with a 3x3 filter as an example, the scale layer image of one of the 9 pixels in Figure 2 detection feature points and their own scale layer of the remaining 8 points and above and below the two scale layer 9 points are compared, a total of 26 points, the figure labeled ' The value of the pixel of X ' is greater than the surrounding pixels to determine the point as a feature point for the region.
3, local maximum precision positioning
The sub-pixel feature points are obtained by the 3-D linear interpolation method, and the points which are less than a certain threshold value are also removed.
Four, feature point descriptor
1, the characteristic point direction assignment
At the center of the feature point, a radius of 6s (s is the scale value of the feature point) in the neighborhood of the point in the X, Y-direction of the Haar wavelet (Haar wavelet edge length takes 4s) response, Harr wavelet
Template:
After calculating the response values of the image in the X and y directions of the Haar wavelet, the Gaussian weighting of the two values is 2S, and the weighted values represent the directional components in the horizontal and vertical directions, respectively.
The Harr eigenvalue reflects the gray-scale change of the image, so the main direction is to describe the direction of the area where the gray changes are particularly intense.
Then, with the feature point as the center, the angle of the Π/3 is the fan slide, the Harr wavelet response value in the window is calculated as the accumulation of dx and dy:
Sliding of a fan window:
The C + + code in Opensurf is implemented as follows:
for (int i =-6, I <= 6; ++i) {for (int j =-6; J <= 6; ++j) { if (i*i + J*j <) { gauss = Static_cast<float> (gauss25[id[i+6]][id[j+6]]); RESX[IDX] = Gauss * Haarx (r+j*s, c+i*s, 4*s); RESY[IDX] = Gauss * Haary (r+j*s, c+i*s, 4*s); ANG[IDX] = Getangle (Resx[idx], resy[idx]); ++idx;}}}
By I,j to control the range of 6x6 centered on the feature point, (I*i + j*j < 36) The points in the circular area that fall at the center of the feature point, with a radius of 6s, are filtered, and then the Haarx and Harry are calculated with the prior calculation Gauss
Filtering. and calculates the angle of each point.
Finally, the direction of the maximum that fan is used as the main direction of the feature point. In the Opensurf look-up fan, there is the most worthwhile direction code as follows:
for (ang1 = 0; ang1 < 2*pi; ang1+=0.15f) {ang2 = (ang1+pi/3.0f > 2*pi? ang1-5.0f*pi/3.0f:ang1+pi/3.0f); SumX = SumY = 0.F; for (unsigned int k = 0, K < ang.size (); ++k) {//Get angle from the x-axis of the sample-point const FLO AT & ang = Ang[k]; Determine whether the point is within the window if (ang1 < ang2 && ang1 < ang && Ang < A NG2) {sumx+=resx[k]; SUMY+=RESY[K]; } else if (Ang2 < ang1 && ((Ang > 0 && ang < ang2) | | (Ang > Ang1 && ang < 2*pi))) {Sumx+=resx[k]; SUMY+=RESY[K]; }}//If the vector produced from this window was longer than all//previous vectors then this forms the new D Ominant direction if (sumx*sumx + sumy*sumy > Max) {//store largest orientation max = Sumx*sumx + su My*sumy; Orientation = Getangle (SumX, SumY); } }
2. Generation of characteristic vectors of feature points
The 20sx20s image is divided into 4x4 blocks in the main direction, centered on the feature point, and each sub-block is calculated in response with a harr template of size 2S, and each sub-block is counted
This has the characteristic data of the 4x4x4=64 dimension. As shown in the following:
In the calculation of this rectangular region is not first to rotate it to the main direction, but first calculate the Harr response value of each point dx, dy and Gaussian weighted processing, the DX, dy rotation transformation, calculation
The formula is as follows:
In the Opensurf implementation of the source code is another way, through the point rotation formula, the point is rotated to the main direction and the nearest neighbor interpolation of the corresponding point, the formula is as follows:
Five, matching
To speed up the matching process, surf the matching process index faster with Laplacian (which was previously calculated to be the way that the Hessian was able to do so without taking too much time). This separates the following situations and then matches them in the descriptor:
Reference: http://www.cnblogs.com/ronny/p/4045979.html
Http://doc.okbase.net/ronny/archive/107771.html
Http://www.tuicool.com/articles/2i6fqq3
Http://wenku.baidu.com/view/cf0c164f2e3f5727a5e96238.html
Transferred from: http://blog.csdn.net/cxp2205455256/article/details/41311013
Go Surf algorithm Analysis