# MTC-GAN Bearing Fault Diagnosis for Small Samples and Variable Operating Conditions
## 2 Theoretical Background
### Local Binary Mode  
Local Binary Patterns (LBP) is an efficient image analysis technique. It analyzes microscopic patterns in an image and their distribution throughout the image. LBP can efficiently extract key feature information. LBP operators identify fine texture patterns called micropatterns or texture primitives in small areas. These patterns include edges, corners, line ends, points, or flat areas. The LBP operator is applicable to regions of different sizes and shapes, including circular and non-circular neighborhoods. Common applications range from 3 \(\times\) 3- to 4 \(\times\) 4-pixel areas. The performance of the LBP operator remains unchanged in the presence of lighting variations.  
In this paper, the LBP operator generates texture descriptors by comparing the grayscale values of each pixel within a 3 \(\times\) 3 neighborhood to its central pixel and applying thresholding. Specifically, if the gray value of the edge pixel is greater than or equal to the center pixel, the pixel is marked as \"1\"; otherwise, it is marked as \"0\". By concatenating these binary values, an 8-bit binary number representing the texture information of a particular neighborhood, i.e., the texture descriptor, is formed. The texture descriptors are converted into decimal values in the range of 0 to 255. By repeating this process for all 3 \(\times\) 3-pixel neighborhoods in the image, a unique 8-bit texture descriptor can be generated for each neighborhood. Texture features are obtained for the entire image, resulting in a matrix containing the local texture features for each pixel point. The total number of neighborhoods in each image is:  
\[T_{N}=(W-N+1)\times(H-N+1) \tag{10}\]  
where \(N\) is the edge length of each neighborhood, with \(N\) = 3. The extracted local texture features of the image are used to construct a global histogram, which can uniquely identify the entire image. For any grayscale image G(x,y), \(i_{p}\) is the gray value of the pixel in the given neighborhood, and \(i_{C}\) is the gray value of the central pixel. The texture descriptor \(t_{N}\) is converted to a decimal value in the range 0-255. The calculation formula is as follows:  
\[t_{N}=\sum_{n=0}^{N^{2}-1}s(i_{p}-i_{C})2^{n} \tag{11}\]  
where \(s(i_{p}-i_{C})\) is the threshold function defined as  
\[s(i_{p}-i_{C})=\begin{cases}1,&i_{p}-i_{C}\geq 0\\ 0,&i_{p}-i_{C}<0\end{cases} \tag{12}\]  
In Equation (11), the texture descriptor can have \(2^{N^{2}-1}\) unique values. Therefore, the construction of the global histogram of the image will require \(2^{N^{2}-1}\) number of bins. However, a previous study suggests the existence of certain micro-patterns called uniform patterns. Uniform patterns occur more frequently than other patterns and are more discriminating. Uniform patterns have a uniformity measure of up to two, which is calculated by counting the number of binary transitions in the texture descriptor. Thus, texture de scriptors with two or fewer binary transitions are considered uniform. Out of 256 possible texture descriptors, 58 are uniform, and the rest are non-uniform. Thus, the global LBP histogram has 59 bins: 58 bins are used for the 58 uniform texture descriptors, and one bin is used for the remaining non-uniform texture descriptors. In this paper, the designed grayscale images of vibration signals are processed using LBP, which searches for micro-patterns in small neighborhoods and then constructs the global frequency distribution of these micro-patterns across the entire image in the form of a histogram. These global LBP histograms are used to uniquely identify each vibration fault image.