Image features, image texture, image frequency domain and other angles to extract the characteristics of the image.
LBP, local two-valued model, local feature description operator, has strong texture feature description ability, has illumination invariance and rotational invariance. Using Python for a simple LBP algorithm experiment:
1 fromSkimageImportData,io2 ImportMatplot.pyplot as Plt3 ImportCv24 fromSkimage.featureImportLocal_binary_pattern5Image = Cv2.imread ('lena.jpg')6Plt.subplot (1,2,2)7 plt.imshow (image)8 plt.show (image)9RADIUS = 1Tenn_points = radius * 8 Onelbp=Local_binary_pattern (Image,n_points,radius) A plt.inshow (LBP) -Plt.show (LBP)
(1) LBP rotation mode invariance
The initial LBP algorithm does not have rotational invariance, the connection order of the LBP string is fixed, and LBP changes after the image is rotated, in order to maintain rotation invariance, to formulate a rule that calculates the LBP value of all rotations, Whichever is the smallest (not knowing why the smallest, not the largest) is the LBP value for that point, the minimum value is always constant, regardless of how the image is rotated, and the rotational invariance is obtained. The cost is to increase the computational capacity of the algorithm.
(2) LBP equivalent mode
A LBP operator can produce many different binary modes, if there are p sampling points, there are two possible values for each sampling point, one of which has 2^p mode, which is unfavorable to the analysis. The pattern of LBP operator is reduced by using an equivalence model. Ojala the definition of the equivalence pattern, that is, when a local binary mode corresponding to the loop binary number from 0 to 1 or from 1 to 0 of the maximum two times, the local binary mode corresponding to the binary becomes an equivalent mode class, the other is classified as a mixed-mode class, there are two times the equivalent mode of the jump to a p* (P-1) Species, 0 jumps of 2 kinds, Mixed Mode Class 1, the dimension from 2*p to p* (P-1) + 3 species.
Steps for extracting LBP eigenvectors
1) First divide the detection window into a small area of 16*16 (cell)
2) for one pixel in each cell, compare the gray values of the adjacent 8 pixels with their values, if the surrounding pixel value is greater than the center pixel value, the pixel's position is marked as 1, otherwise 0. In this way, 8 points in the 3*3 field are compared to produce a 8-bit binary number, The LBP value of the center pixel point of the window is obtained;
3) then calculate the histogram for each cell, that is, the frequency at which each number appears, and then treat the histogram as normalized
4) Finally, the resulting statistical histogram of each cell is connected to a eigenvector, which is the LBP texture feature vector of the entire graph.
It can then be categorized using SVM or other machine learning algorithms.
LBP of Feature extraction algorithm