(9) LBP feature extraction

LBP (Local Binary Pattern) is an operator used to describe the local texture features of an image, which has significant advantages such as rotation invariance and grayscale invariance.

(1) Original LBP

The original LBP operator is defined in a 3*3 window. The center pixel of the window is used as the threshold and compared with the gray value of the adjacent 8 pixels. If the surrounding pixel value is greater than the center pixel value, the position is marked. It is 1, otherwise it is marked as 0. An 8-bit binary can be obtained, and this value is used as the LBP value of the center pixel of the window to reflect the texture information of this 3*3 area. The LBP records the difference between the center pixel and the field pixel. Therefore, when the pixel gray value increases and decreases simultaneously due to the illumination change, the LBP change is not obvious. It can be considered that the LBP is not sensitive to the illumination change. It is only the texture information of the image. Therefore, LBP can be further used for histogram statistics, and this histogram can be used as a feature operator for texture analysis.

 Mathematical formula:

Among them, p represents the p-th pixel in the 3*3 window except the center pixel, I(c) represents the gray value of the center pixel, and I(p) represents the gray value of the p-th pixel in the field .

(2) Round LBP

In order to adapt to the texture features of different scales and meet the requirements of grayscale and rotation invariance, the 3*3 field is extended to any field, and the square field is replaced by the circular field. There are any number of pixels in the field. Suppose there is an LBP operator with P sampling points in a circular area of ​​radius R:

When p=16, R=2, the point on the circular boundary may not be an integer or just fall within a certain grid, and may be located at the junction, and the pixel value of the point can be calculated using bilinear interpolation.

 Among them, p represents the p-th sampling point in the total P sampling points in the circular area, I(c) represents the gray value of the center pixel, and I(p) represents the p-th point gray level in the circular boundary pixels. value. There are a total of p points on the circular boundary, and the point coordinates are calculated:

(3) Rotation invariant LBP

From the definition of the original LBP, the LBP operator is grayscale invariant, but not rotation invariant. If the image is rotated, different LBP values ​​will be obtained. A rotation-invariant LBP operator is proposed, that is, a series of initially defined LBP values ​​are obtained by continuously rotating the circular field, and the minimum value is taken as the LBP value of the field.

 It is to perform binary encoding on the result of LBP, and do a cyclic shift, and take the smallest value among all the results:

def value_rotation(num): 
	value_list = np.zeros((8), np.uint8) 
	temp = int(num) 
	value_list[0] = temp 
	for i in range(7): 
		temp = ((temp << 1) | (temp / 128)) % 256 
		value_list[i+1] = temp 
	return np.min(value_li

(4) Uniform mode LBP

For a circular area of ​​radius R containing P sampling points, there will be 2P-1 modes. Obviously, as the number of sampling points P increases, the types of binary patterns increase exponentially. There are as few and representative features as possible, so it is necessary to reduce the dimensionality of the binary pattern types obtained by LBP, and use a smaller amount of data to best represent the information of the image. This dimensionality reduction method is uniform LBP. Limit the number of transitions of a binary sequence from 0 to 1 or 1 to 0 to no more than 2 times. The number of patterns is reduced from the original 2P to P(P-1)+2, where P represents the number of sampling points in the domain set.

 The purpose is to count the number of transitions of binary numbers. If the number of transitions is less than or equal to 2, each represents a class, and all cases with a number of transitions greater than 2 are classified into one class.

(5) Uniform mode + rotation invariant mode LBP

First calculate the number of jumps:

If the number of transitions is less than or equal to 2, each represents a class, and all cases with a number of transitions greater than 2 are classified into one class. The obtained result is set as LBPuniP, R, and then the binary code is cyclically shifted to find the minimum value.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324134878&siteId=291194637