#### Abstract

In order to avoid subjective estimation of the direction of groove by using a tester in the four-ball friction test, an automatic wear angle detection method based on gray difference of inclination angle is proposed in this paper. First, the gray difference between the pixel and its *W* × 2*W* neighborhood pixels is acquired, in which each neighborhood pixel corresponds to an inclination angle. Second, a row’s grayscale difference of inclination angle is calculated, which is the sum of grayscale difference of all pixels in the same row with the same inclination angle. Third, the inclination angle corresponding to the minimum row’s grayscale difference is defined as the approach angles. Finally, the first *t* approaching angles with the highest frequency determine the wear angles. Compared with true angles determined manually, the simulation results of 200 samples show that the average absolute error is 2.1238° and the average running time is 1.3 s per frame. The influence of the algorithm parameters on detection precision is also analyzed.

#### 1. Introduction

Friction and wear exist in life widely, in which if there is a relative movement, there is a friction and wear. Lubricant, a kind of liquid or solid medium, is not only used to reduce the frictional force and wear but also used to cool, clear, and prevent pollution. Once the performance of lubricant declines, it will result in enormous energy consumption and cause component fault, leading to serious consequences. Therefore, measuring performance of lubricant in time attaches great importance to protect mechanical equipment and reduce energy consumption.

According to China petrol and chemical industry standards (GB-T12583-1998 H-T 0762–2005), the performance of lubricant could be tested by the four-ball friction test. First, clamp three steel balls whose diameter is 12.7 mm, and then drown them in a box full of testing oil. Second, place a steel ball on the top of the three balls, and apply a force of 147 N or 392 N. After the temperature reaches 75 ± 2°C, spin the top ball at a certain speed for 60 minutes. Third, the diameters of the wear spots from three bottom balls are measured twice under the optical microscope whose measuring accuracy is 0.01 mm. The first and second measurements are along the direction of groove and its vertical direction, separately. Finally, the arithmetic means of six diameters obtained from three steel balls are eventually used to evaluate the performance of lubricant as discussed in the literature [1, 2]. However, the method has some disadvantages. It is very difficult to ensure the measurement along the correct direction during the measurement process. The measured angle of each steel ball depends mainly on the human eye to judge. It will inevitably produce a certain error. The experience of operator has a big effect on measurement accuracy. At the same time, the measurement process is time-consuming and laborious. When the experience of the operator is not enough or the groove is irregular, it is often necessary to carry out multiple repeated measurements, and it is time-consuming. Thus, it is the foundation and crux to get the direction of groove precisely and quickly for analysis of four-ball friction testing results, for example, evaluation of wear resistance and detection of abnormal wear.

Because the morphology of frictional surface can be well observed by using a scanning electron microscope (SEM) with high magnification, the analysis of surface morphology is more popular and effectively done by using SEM than by using the optical microscope with low magnification. Thus, the method of analyzing the morphology of friction surface by exploiting image processing technology emerged, had been focused greatly, and is becoming a hot issue with the development of machine vision.

Image processing is used to estimate the tools’ wear state and damage degree. Matsushima et al. [3] tried to detect tools’ abrasion based on the computer vision system: the image of worn tool was examined by using the TV camera every time a tool is changed, and the pattern recognition technique was used to classify the tool failure based on the morphology of tools’ surface. In order to identify wear particles from four-ball, pin-on-disk, and pin-on-plate tests, Liu et al. [4] proposed a thin section segmentation algorithm based on local-texture feature. The algorithm is designed for online analysis and monitoring system of wear particle image. Considering the wear particles generated from the four-ball machine and spur gear box are helpful for analyzing machine wear state, Wu et al. [5] presented a 3-dimensional (3-D) morphological features extracted algorithm for a 2-dimensional wear particles image. The algorithm is based on image processing technologies such as particle extraction, tracking, and 3-D feature reconstruction. To assess the impact of fuels on durability, reliability, and longevity of engine, Azad et al. [6] measured tribological parameters algorithm for a wear image captured by using a scanning electron microscope. Wang et al. [7] developed a set of combinative systems consisting of machine tools and image acquisition device to monitor the status of tools through analyzing textural features from its surface. Zhang and Zhang [8] presented an algorithm to detect online wear of ball-end cutter, in which they made use of wear images and wear detection operation to calculate the degree of groove and remaining useful tool life. The testing consequence turned out that the algorithm was effective and reliable. García-Ordás et al. [9] came up with a method about how to estimate wear by cutting edge and outline of milling cutters. The shape description operator and support vector machine were used to describe and classify the shape. As the characteristics of wear particles are helpful to monitor the machine condition, Wu et al. [10] made use of the image separation technology to estimate the particle and wear of tools. In conclusion, it is feasible and effective to represent tools’ wear by the way of image processing.

More and more new materials’ antifriction resistance could be analyzed and classified by attired morphology as discussed by Shen and Yu et al. [11, 12]. Shen et al. explored tribological performance of titanium grease by observing qualitatively the surface morphology of the four-ball test. Similarly, Yu conducted tribological properties of Ti–W–Al–N films with the aid of SEM, energy dispersive spectroscopy (EDS), and tribometer. However, both of them lacked quantitative analysis, which will lead to subjective errors inevitably. Chen et al. [13] studied characteristics of microwear (e.g., wear rate) by measuring the size of groove generated from the self-development multifunctional microwear tester. Prabhakar and Chan [14] used the four-ball test to analyze the lubricating effect of nanoflowers and nanosheets, where the topography of the groove was evaluated by using SEM, EDS, and 3D surface profilometry. Charoo and Wani [15] studied the friction and wear behavior of nanoparticles with different concentrations through the four-ball wear test and characterized the grooves with scanning electron microscopy and Raman spectroscopy. Xiao et al. [16] came up with a method of steel balls’ wear diameter. It is based on steel balls’ wear image features including abundant and concurrent groove in the four-ball friction test. Li et al. [17] selected mill roll wear topography features including equivalent area, circle radius, circularity, texture entropy, and secondary moment and fractal dimension as quantitative index to represent wear and designed trilaminar BP neural network to recognize wear condition. Yan et al. [18] put forward a method of making use of image processing to estimate the small-scale wear of microelectrodischarge drill hole and milling cutter (front wear and corner wear). A wavelet-based extended depth of field image reconstruction was proposed by Szydlowski et al. [19]. The wear of the micromilling tool is evaluated, applying machine vision. Variable light intensity was used to detect regions of different reflective properties. Geometrical information and reflective properties are then used to evaluate the wear condition of tools. So far, no studies detected the wear angle automatically (i.e., the direction of grooves) by image processing. Although the wear angle is not an evaluating parameter for a wear spot in four-ball ASTM standards (American Society of Testing Materials), the detection of wear angle has practical significance for the following processing:(i)For the diameter measurement of wear spot: the diameter of the wear spot is a necessary parameter for the four-ball friction test, which is measured along the wear angle and its vertical direction because of ellipse wear spot.(ii)For segmentation of wear spot: knowing wear angle ahead is very useful for segmenting wear spot precisely from background, which is consisted of groove.(iii)For the recognition of abnormal groove: it is easier to discriminate the abnormal groove in different directions with wear angle.(iv)For the morphology analysis of groove: the detection of wear angle is helpful for morphology analysis, for example, the length and width of groove, or abnormal groove.

We intended to present an automatic detection algorithm of wear angle for processing software of the four-ball friction test.

#### 2. Materials and Methods

##### 2.1. Basic Definition

###### 2.1.1. Groove

The groove is the mark left on the surface of a test ball due to relative motion between the top and bottom balls. Because the direction of relative motion is almost the same, the grooves are fine lines with the same direction. The actual collected wear image is shown in Figure 1. One of the grooves is shown with dash line.

###### 2.1.2. Wear Spot

The wear spot is the area consisted of grooves with the same direction and it is almost circular or ellipse. The wear spot is surrounded by a solid black line (see Figure 1).

###### 2.1.3. Wear Angle

Wear angle, denoted *θ*, is defined as the smallest positive angle at which the groove rotates along the clockwise to positive direction of horizontal axis, which should satisfy 0° ≤ *θ* < 180°.

###### 2.1.4. Neighborhood and Neighborhood Pixels

In order to measure gray difference among pixels along groove, a new neighborhood and neighborhood pixels are defined here. Pixel is expressed in (*i*, *j*), in which *i* and *j* are row and column coordinates, respectively. The *W* × 2*W* neighborhood of the pixel (*i*, *j*) is defined as the *W* × 2*W* area above the pixel, which is surrounded by the black dash line in Figure 2. The size-measuring unit of neighborhood and image is pixel. The neighborhood pixels are some points located at the outer edges of the *W* × 2*W* neighborhood, which is shown as the white circles in Figure 2. If (*k*, *l*) represents a random pixel point in the *W* × 2*W* neighborhood of pixel (*i*, *j*), its coordinates should satisfy constraints (1), (2), or (3). Obviously, there are 4*W* neighborhood pixels around pixel (*i*, *j*). All neighborhood pixels are coded with the number in box in anticlockwise order, which starts from pixel (*i*, *j* + *W*):

###### 2.1.5. Inclination Angle

Line *L* is determined by pixel (*i*, *j*) and its neighborhood pixel (*k*, *l*). The angle between the line *L* and positive shaft of horizontal axis is called the inclination angle of line *L*, denoted *α*. Different neighborhood pixels have different inclination angles, and thus, there are 4*W* inclination angles considering the neighborhood pixels.

##### 2.2. An Automatic Wear Angle Detection Method for Wear Image

###### 2.2.1. Collection of Steel Balls’ Wear Image

Wear area in steel balls is usually smaller than 1 mm and cannot be observed by the naked eye. The wear image of four-ball test should be captured by using SEM or optical microscope with suitable numerical aperture (1.25) and magnification (400X) of objective lenses for observing the detailed morphology. In order to get better quality image, resolution and magnification are two main parameters for the collection of wear images. At first, resolution is the most important parameter. The higher the resolution is, the more detailed the morphology observed from the image. The resolution of the optical microscope is determined by its numerical aperture. The resolution increases as numerical aperture increases. Secondly, based on sufficient resolution, the magnification of objective lens should be as large as possible and no more than effective magnification, where effective magnification is eye resolution divided by microscope resolution.

Symbol *F* represents the true RGB color wear images and the size of image in pixel is *M* × *N*. *M* and *N* are the number of rows and columns. Pixel coordinates (*i*, *j*), in which *i* and *j* represent the row and column coordinates, respectively, are integer and satisfy the constraints: 1 ≤ *i* ≤ *M* and 1 ≤ *j* ≤ *N*.

###### 2.2.2. Grayscale Processing for Wear Spot

In order to speed up the process, the wear images in the RGB color mode are converted to the grayscale. It is worth mentioning that grayscale processing is not needed when the collected wear images are grayscale by default. Considering the eye sensibility for different colors, RGB values of pixel are converted to grayscale values by forming a weighted sum of the red, green, and blue components [20]:where *f* is the grayscale wear image; *f* (*i*, *j*) is the gray value of pixel (*i*, *j*); and *r* (*i*, *j*), (*i*, *j*), and *b* (*i*, *j*) represent red, green, and blue component values of pixel (*i*, *j*) in *F*, respectively.

###### 2.2.3. Grayscale Difference Calculation of Pixel along the Inclination Angle

Considering the processing speed and precision, the processing is just for the central region of the wear image. The grayscale difference between pixels (*i*, *j*) and (*k*, *l*) in neighborhood whose inclination angle is *α* is determined by using the following equation:where (*k*, *l*) is the pixel in *W* × 2W neighborhood around (*i*, *j*); *α* is the inclination angle of pixels (*i*, *j*) and (*k*, *l*), 0° ≤ *α* < 180°; and [] is the rounding operation.

The inclination angle *α* depends on the pixel coordinates (*i*, *j*) and (*k*, *l*), which is less than 180°. The inclination angles are determined by using the following equation:

The number of inclination angles depends on the size of neighborhood *W*. The larger the size of the neighborhood *W* is, the more the inclination angles there are. The inclination angle and size of neighborhood *W* are shown in Figure 3. For example, when *W* is equal to 1, the inclination angles of pixel (*i*, *j*) and its neighborhood pixels are 0°, 45°, 90°, and 135°. The number of inclination angles is 60 while *W* = 15, in which the minimum and maximum inclination angles are 0° and 176.2°, respectively.

###### 2.2.4. Operation of Row Grayscale Difference

The row grayscale difference represents the sum of grayscale differences of all the pixels along the same inclination angle in this row. For different inclination angles, the grayscale difference in row is usually different. *H* (*i*, *α*) represents the grayscale difference in row *i* with inclination angle *α*. The expression is determined by using the following equation:

###### 2.2.5. Acquisition of the Approaching Angle in Row

When the inclination angle is equal to the wear angle, the grayscale change in row is minimal. Thus, the inclination angle in row *i* (also called approaching angle in row *i*) with minimum row grayscale difference is determined by using the following equation:where *β*(*i*) is the approaching angle in row *i* and is the value of *α* for which *H* (*i*, *α*) attains its minimum.

###### 2.2.6. Frequency Construction of the Approaching Angle in Row

The approaching angles are different in different rows. The frequency can be used to represent the ratio of occurrence times to the total number of rows:where *n*(*β*) is the number of rows whose approaching angles are *β*, which is less than or equal to .

###### 2.2.7. Detection of Wear Angle

The wear angle depends on those approaching angles with high frequency. When the direction of groove is exactly the same in ideal condition, the approaching angle in all rows will be the same, and thus, frequency of the only approaching angle equals to 1. In fact, both reflection and deflection of light occur at groove, and there are more approaching angles with higher frequency. Assume that approaching angles are sorted in the descending order of frequency, which is *β*_{1}, *β*_{2}, … ,*β*_{t},…where *β*_{t} is the *t*^{th} sorted approaching angle in the descending order of frequency; *T* is the selecting threshold of combined frequency corresponding to several approaching angles, which is usually between 0.5 and 0.9; and is the value of *t* for which attains its minimum based on satisfying the constraint.

The wear angle, denoted by *θ*, could be calculated by using the approaching angle with high frequency:

#### 3. Simulation and Experimental Analysis

he simulation and experimental analysis are illustrated from two aspects: detection process and effect. The detection process takes a single sample as an example to illustrate the algorithm in this paper, and the detection effect described by error and time consumption is verified according to detection results of 200 samples.

##### 3.1. Detection Process of a Single Sample

The detection process of wear angle of a wear image sample is shown in Figure 4. The simulation platform is Matlab 2014, and the processor is Intel CPU 2.4 GHz and 1 GB RAM. The algorithm parameters are *W* = 10 and *T* = 0.6. For better quality, all wear images are captured by using the optical microscope with suitable numerical aperture (1.25) and magnification (400X) of objective lenses. The true RGB color wear image *F* is shown in Figure 4(a). The size of true RGB color wear image in pixels is 768 × 1024, that is, *M* = 768 and *N* = 1024. The grayscale wear image *f* is shown in Figure 4(b), and the image processing could be accelerated after graying out.

**(a)**

**(b)**

The approaching angle and its frequency are shown in Figure 5. The figure shows that different approaching angles result in different frequencies. The frequency of the approaching angle 34.99° is the highest. (34.99°) = 0.7567 > 0.6 indicates that the approaching angle of more than 75% in rows is 34.99°, and the wear angle *θ* = 34.99°.

##### 3.2. Result Analysis of Multiple Samples

Generally, when the absolute error of the detected wear angle is small, the deviation of diameters of the wear spot is low. Similarly, when the absolute error of the detected wear angle is high, the diameters of the wear spot will have a great deviation from true ones. Too high deviation will lead to wrong results of subsequent analysis, which includes validity of the four-ball friction test (or whether the test should be redone), friction coefficient, the performance analysis of the lubricating oil, and recognition of abnormal groove.

To verify the effectiveness of the algorithm, the accuracy and time-consuming stimulation of 200 steel ball wear spot samples should be verified. The detection precision is represented by absolute error *ξ*, defined as the absolute value of the difference between detected and actual angles is determined by using the following equation:where *θ* is the detected wear angle and is the actual angle which is measured manually.

The average absolute error of 200 samples is 2.1238° (Figure 6), and the maximum and minimum absolute errors are 5.3099° and 0°. It can be seen that the algorithm has high detection accuracy and good robustness. The average running time is 1.313373 s at the simulation platform, and it will take less time after hardwarezed.

Based on 200 sets of data, the influence of algorithm parameters (the size of the neighborhood and the selected threshold of frequency) on the detection error was further investigated. Figure 7 shows the relationship between average absolute error and the length of neighbors. As the length of neighbors increases, the average absolute error drops steadily and reaches its minimum when the length of neighbors is 8–24 and then rises gradually. That is to say, the detection effect is the best when the length of neighbors is 8–24.

The impact of selection threshold *T* on the detection results is shown in Figure 8. When *T* = 0.6–0.8, the average absolute error is the smallest.

#### 4. Conclusions

Gray difference along the wear angle is minimal, which is used to detect the wear angle automatically. According to the pixel and its grayscale difference of the neighborhood pixel, a new automatic method for measuring the wear angle is proposed in this paper. The detection of wear angle is important for diameter measurement and segmentation of wear spot, morphology analysis, and recognition of groove. The simulation on 200 groups of sample data shows that the average absolute error of the algorithm is 2.1238°, the maximum absolute error is 5.3099°, and the minimum absolute error is 0°. The average time of each frame is 1.3 s, and the algorithm runs fast. If the parameter values (e.g., length of neighbors and *T*) are too small or too large, the detection accuracy will decline, but it has almost no effect on the running speed. The algorithm in this paper has a strong expansibility, which is suitable for the software development and application of four-ball friction experiment. Generally, image brightness and contrast will not change the inherent attributes; therefore, they have little effect on the accuracy of the proposed method.

#### Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

#### Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.

#### Acknowledgments

This work was supported by the National Natural Science Foundation of China (61703052), Central University Basic Research High-Tech Cultivation Project (300102228204), and Zhejiang Natural Science Basic Public Welfare Research Project (LGF18E080001 and LGF20G010001).