A visual measurement method of grinding surface roughness based on aliasing region index and neural network

Most existing vision-based roughness measurements primarily rely on statistical information from grayscale images or intensity information from color images. However, the structural information of images has not been fully and effectively utilized. To more accurately measure the roughness of grinding surfaces, a visual measurement method of grinding surface roughness based on aliasing region index and neural network is proposed. Firstly, color images of grinding surface are obtained under red and green illumination. Secondly, aliasing regions of red and green images are extracted through fuzzy clustering segmentation and morphological processing. Then the aliasing width and the aliasing dispersion of aliasing region can be calculated as indices for roughness measurement. Thirdly, the relationship model between aliasing region index and grinding surface roughness is constructed using the back propagation (BP) neural network. The results demonstrate that the aliasing dispersion index has a better correlation with grinding surface roughness than the aliasing width index. The method based on the aliasing dispersion index and BP neural network is feasible and accurate for grinding surface roughness measurement.


Introduction
It is crucial for surface roughness in industrial manufacturing as it directly affects the quality, performance, and lifespan of components.The surface roughness of a component is a part of its surface texture, including ripples, irregularities, and contours.If the surface roughness of components Original content from this work may be used under the terms of the Creative Commons Attribution 4.0 licence.Any further distribution of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI.
does not meet the specified standards, they may need to be scrapped or reworked [1].Due to the randomness and weak directionality of the texture on grinding surface, the accuracy of grinding surface roughness measurement is not accurate enough.
Currently, there are many methods for roughness measurement, broadly categorized into contact and non-contact methods.Contact methods are currently the most widely used for roughness measurement.However, contact measurement is prone to damage to the work-piece and is sensitive to the texture's orientation [2], which is suitable only for characterizing the profile information.Non-contact methods can be further divided into optical, electrical, and visual methods.The optical and electrical methods largely depend on precise and expensive instruments, and have strict environmental requirements.Visual methods are cost-effective, versatile, and straightforward for measurement, which have garnered significant attention [3][4][5][6].
Visual methods of surface roughness measurement mainly focus on analysing surface feed traces captured in images.They are typically divided into four processing stages: image acquisition, image processing, feature extraction and model prediction.Visual methods can be categorized into grayscale image measurement and color image measurement.Grayscale image measurement primarily involves extracting statistical information from the grayscale image's histogram [7,8], or features derived from Fourier transforms and wavelet transforms [9,10] as roughness evaluation indices.Chen et al [11] constructed features related to roughness based on grayscale and texture features.Patel and Kiran [12] used the grayscale co-occurrence matrix for predicting surface roughness.However, these methods are more suitable for regular processed surfaces, such as turning and milling.Due to the irregular distribution of surface texture after grinding, it is not suitable to use grayscale images.
To extract more image feature information, Yi et al [13,14] proposed evaluation indices based on color model, such as chromaticity difference index and singular value entropy of color images, for constructing surface roughness prediction models.Lu et al [15] constructed a roughness estimation model using color image aliasing regions related to red and green light sources.The 'image energy index' was introduced to measure surface roughness.Furthermore, they used Full-Reference image quality algorithm and visual saliency index (VSI) with back propagation (BP) neural network for grinding surface roughness, revealing the advantages of VSI in terms of measurement accuracy and resistance to light source brightness interference [16].Liu et al [17] measured surface roughness based on the aliasing regions between virtual images formed by different light sources on surfaces with varying roughness levels.Zhang et al [18] used inductive transfer learning and a limited number of standard training samples to build roughness measurement model.Zhao et al [19] explored the functionality of color image indices in improving the mathematical representation of three primary color vectors, and derived the singular value ratio for roughness.The above methods have effectively evaluated surface roughness through feature extraction.Due to the complex imaging environment, feature extraction reduces dimensions by determining statistical or non-statistical indices to represent interesting parts of the image.Therefore, it is crucial to select appropriate surface features as inputs for the measurement model.
To avoid interference from manually extracting features, automatic feature extraction methods based on deep learning have been applied to surface roughness measurement.With the continuous development of deep learning such as [20,21], the application of Convolutional Neural Networks (CNNs) in roughness measurement has enhanced accuracy and robustness in various lighting conditions.Rifai et al [22] used CNN to evaluate surface roughness from digital images of surface textures directly.Feature extraction was integrated into the network during the convolution process.Chen et al [23] applied deep CNN method to classify surface roughness with good light source robustness in different light source environments.He et al [24] used Region of Interest extraction to filter out interference information and extract effective regions.CNN was applied to evaluate the roughness.Saeedi1 et al [25] presented an industrial measurement and detection system for electrical discharge machining (EDM) eroded steel work-pieces, utilizing deep neural networks for surface roughness estimation and defect detection.Kumar et al [26] proposed a method using CNN to characterize surface roughness for EDM.Huang et al [27] proposed a feature fusion-based method for grinding surface roughness measurement, utilizing deep learning for feature extraction.The above methods can effectively solve the problem of weak information and difficult recognition of grinding surface roughness features.However, the drawback is that before constructing a measurement roughness model, a large amount of image data needs to be collected for training, which is time-consuming.
Although there are many methods for measuring surface roughness based on color image information, most indices are still based on statistical information or visual saliency of images.However, the structural information of the image is not fully utilized.The extraction of image features and the establishment of a model between surface features and roughness remain a research hotspot.As visual roughness measurement based on special lighting sources can fully utilize the light source structure, the reflection mechanism of rough surfaces and imaging characteristics, it has good performance on roughness measurement.Therefore, by taking advantages of special red and green light source, a visual measurement method for grinding surface roughness based on aliasing region index and neural network is proposed in this paper.
The main contributions of this paper are as follows: (1) By using fuzzy clustering segmentation and morphological processing on color images captured under red and green light source, the aliasing width and the aliasing dispersion of the image aliasing regions are used as roughness measurement indices, fully exploiting the brightness information and structural information of color images.(2) Both aliasing region index and BP neural network are used to establish the model for grinding surface roughness measurement.In addition, the aliasing dispersion index has good correlation with roughness, and the measurement model has good fitting performance.(3) The experiments have verified the feasibility and accuracy of the method using aliasing region index and BP neural network, especially using the aliasing dispersion index and BP neural network.This provides a new solution for grinding surface roughness measurement.
The rest of the paper is organized as follows: section 2 introduces the principles and imaging of roughness measurement.Section 3 describes how to construct the roughness measurement model.Section 4 is the experimental design, including the construction of experimental platform and data collection.Section 5 is the analysis and discussions of the experimental results.Section 6 concludes the paper.

The reflection mechanism and imaging characteristics of rough surfaces
According to the principles of optical reflection, when a beam of parallel light strikes the surface of an object at a certain angle, the micro-scale texture of the surface affects the reflected light.Light undergoes diffuse reflection, as shown in figure 1, and the reflected light forms a reflection band and a scattered light spot within a 180 • spatial range.The magnitude of surface roughness affects the intensity and proportion of reflected and scattered light.Zhu et al [28] and others have pointed out that as the angle between the camera's optical axis and the direction of incident light increases, the extent of the scattered spot is directly proportional to the surface roughness height value 'Z'.Therefore, as roughness increases, surface scattering becomes more pronounced, and the scattered light spots on both sides broaden.Conversely, when roughness decreases, surface reflection becomes stronger, and the scattered light spots on both sides narrower.
For a rough surface, when two beams of light are emitted from a certain point and strike the rough surface, due to the random nature of the small local slope of the incident point, diffuse reflection occurs.When the lens focal length and spatial position are held constant, the incident light rays after diffuse reflection on the rough surface may converge on both sides of the optical axis and in front and behind the imaging plane.Among these, the light that converges on the optical axis can form a clear virtual image on the imaging plane.Therefore, as the roughness increases, on the one hand, the range of the clear imaging distribution becomes larger, and on the other hand, the number of beams forming blurry virtual images increases, and the distance between their convergence points becomes greater.As a result, the image quality of the rough surface becomes more blurred, and the overall area of the divergent region in the image is generally lower.

Imaging of surface roughness under red and green lighting source
When a single light source is used to illuminate a rough surface, due to the singularity of color, only the intensity of illumination of different areas of the image pixels can be obtained.Unfortunately, it is not possible to determine the degree of blurriness and area in the image.However, using a red and green light source system with a special structure to illuminate the rough surface, the change information in the image of the rough surface can be effectively extracted.To effectively extract the reflected light bands and scattered light spots after diffuse reflection on rough surfaces, a red and green light source is used as shown in figure 2.
The images of light sources A (green) and B (red) on surfaces with different roughness levels are shown in figure 3. Figure 3(a) represents the virtual image of the light source on a theoretically smooth surface, while figure 3(b) shows A1 and B1 representing the virtual image formed on a surface with roughness Ra 1 .In figure 3(c), A2 and B2 represents the virtual image formed on a surface with roughness Ra 2 (where Ra 2 > Ra 1 ).The yellow area represents the aliasing region where the red and green light beams intersect.Surfaces with higher roughness produce larger scattered light and result in larger virtual image areas, including larger aliasing regions.
However, the overall energy intensity of these virtual images is smaller.In theory, the roughness of the surface can be represented by the width of the aliasing region.Additionally, the scattered light spots from the red and green lights will diverge at the edges due to the distribution of surface texture.
The imaging of rough surface and the distribution of chromatic aberration is shown in figure 4. Figure 4(a) presents the virtual image of a rough surface with red and green light source, and figure 4(b) is a contour map of the chromatic aberration distribution in the image.From figure 4(a), it can be seen that the chromatic aberration of the red and green channels in the actual image of the rough surface is significantly lower in  the aliasing region than in the non-aliasing region.The structure of the aliasing region approximates a rectangle.As can be seen from figure 4(b), the contour lines at the edge of the aliasing region are irregular curves, which differ somewhat from the theoretical analysis of straight lines to some extent, but the edge of the aliasing region can still be distinguished.

Clustering segmentation of aliasing regions.
The images are obtained under the red and green light source.The division of aliasing regions in the images can be considered as an image segmentation problem.Therefore, determining the relative sizes of the aliasing regions can be transformed into segmenting the images into red, green, and intermediate aliasing areas.Clustering can determine the category of data by the distance within the data class, which belongs to unsupervised learning and is suitable for addressing the division problem.The fuzzy C-means clustering algorithm by Bezdek [29] is a method that uses membership to determine whether each data point belongs to a certain cluster.The fuzzy C-means clustering is applied to the images.The objective function of the fuzzy C-means is defined as follows: In equation ( 1): x j represents the jth sample, u ij represents the degree of membership of the ith sample in the jth class, and U = [u ij ] is the membership matrix.The membership matrix U satisfies the following conditions: In equation ( 2): C represents the number of clusters, N represents the number of samples, V = {v 1 , v 2 , . . ., v C } represents the set of cluster centers, v i represents the ith cluster center, m ∈ [1, +∞] represents the fuzziness exponent used to control the degree of membership fuzziness for the samples, and d (x j , v i ) represents the vector distance from the samples x j to the cluster centerv i .
When solving the fuzzy C-means clustering algorithm, it is necessary to determine the maximum number of iterations for the algorithm (N iter ), the minimum improvement threshold (ε) for the objective function, the fuzziness exponent (m), the exponent (expo) of the partition matrix, the transfer coefficient (λ), and the vector distance in the sample space (d (x j , v i )).
The similarity measurement of the data is often based on the Euclidean distance.The calculation formula for the Euclidean distance is as follows: In equation ( 5), x i and y i represent two-dimensional data points.Firstly, the initialization of all parameters is performed.Then, the number of iterations is set.Through a continuous loop, the membership matrix is computed, and cluster centers are determined through partitioning.Finally, the results obtained are then checked, and this process is repeated iteratively until the most suitable result is achieved, ultimately determining the cluster centers.The parameter settings for fuzzy C-means clustering are as shown in table 1.The results of applying fuzzy C-means clustering to the acquired images are shown in figure 5. Figure 5(a) represents the original image, while figure 5(b) represents the image after fuzzy clustering.Green classification is displayed in green, red classification is displayed in red, and aliasing classification is displayed in yellow.

Morphological processing of aliasing regions.
Based on the rough surface's slope distribution model and imaging mechanism, the variance of the rough surface's slope model is correlated with the distribution of virtual images on the rough surface.The final superimposition effect of different distributed virtual images can be characterized by the edge differences in the aliasing region, which are also indicative of image structural information.Morphological processing with dilation and erosion is used to extract the aliasing boundaries from the images after fuzzy C-means clustering.In morphological processing, the types of structural elements mainly include rectangles, linear, cross, and circular elements, and different types of structural elements are suitable for different tasks.
As the texture direction of the rough surface is more evident after clustering segmentation, a rectangular structural element as the texture can effectively extract structural information at the edges.In this paper, a rectangular structural element with 8-pixel connectivity is used for boundary extraction.Through boundary extraction, the contours of the aliasing region can be obtained.Then the contour image is used as input for connectivity component extraction.In the set of all connected components, the top two are regarded as the left and right boundaries X 1 and X 2 of the aliasing region.Finally, the pixels of boundaries X 1 and X 2 can be determined, which provides the basis for further calculating the aliasing index.The results after morphological processing of the obtained images are shown in figure 6.

Indices of the aliasing width and dispersion.
After extracting the boundaries of the aliasing region and the maximum connectivity from the image through morphological processing, the pixel count of the aliasing region can be effectively determined.The calculation for the width w of aliasing region is as follows: In equation ( 6), n ′ represents the number of pixels between the aliasing boundaries X 1 and X 2 belonging to the aliasing category.M represents the width of the sampled image.
To effectively utilize the fuzzy information of the membership matrix U in the clustering results, when counting the number of pixels in the aliasing region, the membership value of each individual pixel is considered.The average width as regarded as the aliasing width index w m for the aliasing region is calculated as follows: In equation (7), Y represents the aliasing category after clustering, u ij represents the membership degree of the pixel (i, j) for its category, and p represents the weighting coefficient.This index is proposed based on image color difference, which is the brightness information of the image.
The edge difference of the aliasing region is the structural information of the image.Therefore, the difference between the ideal imaging boundary and the actual boundary can be characterized, by counting the coordinate values of the imaging boundary and further calculating the standard deviation of the coordinate values.The calculation for the aliasing dispersion d m is as follows: In equation ( 8), X 1 and X 2 represent the sets of abscissa values of the pixels on both sides of the aliasing region boundaries, and std (X) represents the standard dispersion of the set X.

Establishment of the model based on BP neural network
The roughness measurement model involves selecting the appropriate prediction algorithm, and establishing the optimal relationship between roughness and image feature indices.Roughness measurement methods belong to statistical learning.Based on the established learning strategies, the best model is chosen from the hypothesis space to enhance model  performance using computational methods.BP neural network is a type of multi-layer feed forward neural network that utilizes error back-propagation.BP neural network, which is one of the most widely applied neural network models [30], are commonly used in pattern recognition, data mining, and various fields.Therefore, BP neural network is introduced to establish the roughness measurement model in this paper.
It can be considered as a data fitting problem to find the relationship model between the aliasing region index and the surface roughness based on the known data.The structure of BP neural network is shown in figure 7.Where There are three commonly used training algorithms in MATLAB, including Levenberg-Marquardt (L-M), Bayesian Regularization, and Scaled Conjugate Gradient.L-M is suitable for small networks and fitting problems, Bayesian Regularization performs better when the sample noise is large or the training samples are small, and Scaled Conjugate Gradient is suitable for small and medium-sized networks and large-scale datasets.As the measured data of surface roughness for grinding samples are very small in this paper, to obtain a faster and more accurate fitting model, the BP neural network is trained using the L-M algorithm.

Evaluation of roughness measurement model performance
After establishing an appropriate roughness assessment model, to quantitatively evaluate the performance of the roughness assessment model, a performance evaluation system of image feature index is compiled based on the relevant research by Video Quality Experts Group (VQEG).Let R be the actual roughness value, X be the image index value, and f be the roughness measurement model, they have a mapping relationship as in equation ( 9): According to equation ( 9), the predicted roughness value can be obtained as: where i represents the ith sample, N is the total number of samples, X i is the image feature value for the ith sample, and R ai is the predicted roughness value for the ith sample.
To complete the model's performance evaluation, the differences between the actual and the predicted roughness values are quantified.Mean Absolute Error (MAE), Mean Squared Error (MSE), and Root Mean Squared Error (RMSE) are employed as performance evaluation metrics.Smaller values of MAE, MSE, and RMSE indicate better performance of the roughness measurement model.These performance evaluation metrics are given as follows:

Experimental system setup
To verify the feasibility and effectiveness, an experimental platform for roughness sample detection is set up as shown in figure 9.The system includes components such as light The experimental equipment is placed on a precision optical platform to minimize vibration errors.Considering the impact of ambient light in the experiments, the tests are conducted in a dark room.It is essential to pay attention to the positioning of the equipment within the platform.After connecting the camera and lens, they are secured using a camera platform, ensuring that the camera's optical axis is perpendicular to the clamping platform.The fixture is attached to the clamping platform using magnets, and the grinding sample is fixed to the fixture using magnets as well.During the imaging process of the red and green light source system, the boundary between the grinding sample and the clamping platform should be ensured to be located in the middle area of the surface.Additionally, it should be ensured that the virtual image is located in the middle of the camera frame.For the visual measurement of grinding surface roughness, all processing steps, including image acquisition, image clustering and segmentation, morphological processing, extraction of aliasing region indices, and roughness measurement model are all performed using software MATLAB.

Experimental data collection
To validate the proposed method, 40 grinding samples are prepared.Each size is 50 × 50 mm, made of 45# steel,  at different locations to calculate the average surface roughness Ra.The data from these 40 measurements are sorted in ascending order, renumbered, and are presented in table 2. It can be seen From table 2 that the standard deviation of multiple measurements varies among different samples.The accuracy of measuring the average of multiple times using a stylus to characterize the overall surface roughness is within a reliable range.

Qualitative analysis of the correlation of aliasing region indices
In the experiments, all 40 sets of surface samples are kept under consistent environmental conditions.When capturing images of the surface samples, it is ensured that the virtual image is located in the center of the camera frame.This arrangement allowed for the aliasing region to be in the middle of the image when cropping an image of the same size (1000 dpi × 1000 dpi) in the central region.As the surface roughness of the grinding samples increased, some of the original images obtained are shown in figure 12. From left to right, and from top to bottom, it can be seen that with increasing surface roughness of the grinding samples, the overall brightness of the images decreases, indicating a lower overall image energy.
For the virtual images obtained above, edge curves and edge regions are extracted through fuzzy clustering and morphological processing.The image under different roughness are shown in figure 13. Figure 13(a) are virtual images, which are sampling images of the red and green light source imaging different roughness grinding planes.Figure 13(b) shows the clustering segmented images obtained through fuzzy Cmeans clustering.Figure 13(c) shows the morphological processed images.From figure 13, it can be intuitively seen that as the roughness increases, the red and intuitively seen that as the roughness increases, the red and green boundaries in the virtual image of the light source gradually blur, and the aliasing region (yellow region) gradually expands.When the roughness is low, the microscopic surface texture differences are minor, resulting in a small yellow region with less edge dispersion.As roughness increases, the edge dispersion of the aliasing region between the red and green regions intensifies,  leading to a wider yellow region and more significant edge dispersion in the aliasing area.This confirms the feasibility of the proposed aliasing region indices.

Quantitative analysis of the correlation of aliasing region indices
To verify the correlation of the aliasing region indices, regression analysis is applied to assess their relationship with surface roughness.The Fourier series fitting algorithm is a powerful and flexible mathematical method used to decompose complex functions into a sum of simple sine and cosine functions.By solving the coefficients in the function, a finite-term Fourier series can be used to fit the function, thus enabling applications in signal processing, image processing, system identification, and more.Therefore, the Fourier series fitting method The two indices, the aliasing width w m and the aliasing dispersion d m are used, which are obtained through the fuzzy clustering and morphological processing algorithm in section 3.1.In the calculation of the aliasing dispersion d m , the value of p = 1 was taken.For the convenience of data processing, the data is normalized.The normalized aliasing width w m ′ and the normalized aliasing dispersion d m ′ are obtained with a normalized range of [0, 1].The specific values for the 40 grinding samples are presented in table 2. y = f (x) = a 0 + a 1 cos (wx) + b 1 sin (wx) is used as the fitting function, with the normalized aliasing width w m ′ and the normalized aliasing dispersion d m ′ as inputs, and the measured roughness of the grinding samples as outputs.The Fourier fitting curves for the aliasing width-roughness relationship and the aliasing dispersion-roughness relationship obtained from the 40 sets of data are shown in figure 14.From figure 14(a), when using the aliasing width index, the fitting curve is y = f (x) = 0.7411 + 0.4316 cos (1.431x) + 0.02252 sin (1.431x).The fitting curve performs well when the roughness is between 0.2 µm and 0.5 µm.However, the data between 0.6 µm and 0.8 µm, there are some outliers that seriously deviate from the fitting curve, leading to a relatively poor fit.As can be seen from table 2, the aliasing width index suddenly decreases at roughness value of 0.638 µm.This is attributed to the fact that, when exceeding a certain roughness, as the roughness increases, the aliasing region of image increases, and the aliasing boundaries becomes unclear and irregular, making the aliasing boundaries more blurred and asymmetric.This results in the calculation of the aliasing width becoming smaller instead.From the trend perspective, the growth trend of data points is consistent, and the data points are relatively close to the fitting curve.From figure 14(b), when using the aliasing dispersion index, the fitting curve is y = f (x) = −22130 + 221 30cos (0.001 455x) − 292sin (0.001 455x).The fitting curve shows some discontinuities around 0.5 µm.It performs best when the roughness is between 0.35 µm and 0.4 µm, and the data points are well balanced while roughness is between 0.2 µm and 0.8 µm, resulting in an overall good fit.Compared figure 14(a) with figure 14(b), it can be seen that the aliasing dispersion index has better correlation than the aliasing width index.
The merits for assessing the fit goodness of the fitting function include SSE, R 2 , RMSE, and so on.SSE represents the sum of the squared errors between the fitted data and the original data.A smaller SSE indicates a better model choice and fit, resulting in more successful data predictions.R 2 , on the other hand, reflects how well the model fits the sample data.R 2 typically range [0, 1].A higher R 2 indicates that the model's variables provide a stronger explanation for the data, demonstrating a better fit of the model to the data.In addition, RMSE is another measure of the model's prediction accuracy.The calculating of SSE and R 2 are as follows: 16) In the above equations,y i represents the original data.ŷi represents the fitted data.yi represents the average value.
The goodness of fit metrics for Fourier fitting functions are presented in table 3. It can be seen that SSE value for w m -Ra fitting function is 0.2427, R 2 value is 0.6756, and RMSE value 0.02451, R 2 is 0.9672, and RMSE is 0.02609.The R 2 closer to 1 indicates that the model has a stronger explanatory power for the data, and a smaller RMSE that is closer to 0 suggests a better fit.Therefore, the aliasing dispersion index has a better fit for the roughness measurement model.

Accuracy of roughness measurement model
Grinding samples with serial numbers 2, 8, 13,18,23,26,29,32,35,38 are selected as 'test group', while the remaining 30 are 'model group'.The corresponding aliasing region indices of 'model group' are used to train the roughness measurement model.Then the model is used to estimate the surface roughness of the grinding samples in 'test group'.For the three cases of the aliasing width w m and the aliasing dispersion d m , as well as both the aliasing width w m and the aliasing dispersion d m , BP neural network in section 3.2 is also used to establish the roughness measurement model.The ratio of training set, validation set, and test set used for BP neural network is 0.75:0.15:0.25.In addition, the normalized data w m ′ and d m ′ in table 2 is used for the convenience of data processing.The regression curves for the roughness measurement models obtained for these three cases including model group, validation group, test group, and final fitting curve, as shown in  The model's performance is evaluated by quantifying the differences between the actual roughness and the predicted values for 'test group'.MAE, MSE, and RMSE are used as performance evaluation metrics, as shown in table 4. The predicted roughness and relative error values of 'test group' are shown in table 5.For an ideal fit (where R = 1) in figure 15, the data should follow a 45 • diagonal line, meaning that the output equals the target.A fit can be considered reasonable when R (correlation coefficient) is greater than 0.95 for any of these three cases.As shown in figure 15, the final regression curve for the aliasing width w m has R of 0.820 08, the final regression curve for the aliasing dispersion d m has R of 0.999 21, and the final regression curve for both the aliasing width and aliasing dispersion w m + d m has R of 0.996 14.Therefore, using the aliasing dispersion index, as well as both the aliasing width and average aliasing dispersion indices, for regression is reasonable.
It is can be seen from figure 16 that using the aliasing width index for roughness measurement in higher errors, while the aliasing dispersion index yields the smallest errors and the closest approximation to the measured values.Thus, the aliasing dispersion index is better suited for measuring roughness values compared to the aliasing width index.When using both the aliasing width and the aliasing dispersion, the prediction errors are smaller, and the measurement values are closer to the expected values.Although the combined approach is not as accurate as using only the aliasing dispersion index for roughness measurement, it can be considered in practical applications to enhance the system's robustness.
Table 4 shows that the model using the aliasing width index and BP neural network has a larger MAE and RMSE of 6.40% and 9.50%, respectively, and a smaller MSE of 0.09%, indicating poorer performance evaluation of roughness measurement.On the other hand, the model using the aliasing dispersion index and BP neural network has the smallest MAE, MSE, and RMSE, which are 0.62%, 0.0067%, and 0.82%, respectively, indicating better performance evaluation of roughness measurement.In addition, the model using both aliasing width and aliasing dispersion indices along with BP neural network has relatively smaller MAE, MSE, and RMSE, which are 0.99%, 0.0128%, and 1.13%, respectively, signifying good performance evaluation of roughness measurement.
Table 5 shows that when using the aliasing width index with BP neural network, there is a relatively large estimation error for surface roughness, with average relative error of 11.49%.This inaccuracy increases as the roughness increase, with measurement accuracy decreasing for Ra greater than 0.68 µm.As the grinding surface roughness increases, the aliasing regions become irregular, leading to less accurate estimation of the aliasing width.In contrast, when using the aliasing dispersion index with BP neural network, the estimation error for surface roughness values is the smallest, with average relative error of 0.69%.The measurement accuracy is above 98.5%, accurately measuring the grinding surface roughness.This higher accuracy is attributed to the use of structural information from the aliasing regions in the images, resulting in more precise roughness measurements.When using both the aliasing width and dispersion indices along with BP neural network, the estimation error for surface roughness values is relatively small, with average relative error of 1.95%.This method outperforms using only the aliasing width index with BP neural network, but is slightly less accurate than using only the aliasing dispersion index with BP neural network.Therefore, using the aliasing dispersion index with BP neural network can improve the accuracy of surface roughness measurements.To enhance system's robustness and maintain high measurement accuracy, a combination of both the aliasing width and the aliasing dispersion with BP neural network can be employed.
To further verify the accuracy of roughness measurement, random grinding sample data are used for training.The three training models mentioned above are utilized, with the serial numbers 3, 6, 10, 16, 21, 24, 27, 33, 36, 40 as 'test group' and the remaining 30 as 'model group'.The corresponding aliasing region indices of 'model group' are used to train the roughness measurement model.Then the measurement model can be used to estimate the surface roughness of the grinding samples in 'test group'.For the three cases of the aliasing width w m and the aliasing dispersion d m , as well as both the aliasing width w m and the aliasing dispersion d m , BP neural network is also used to establish the roughness measurement model.The predicted and relative error values of roughness are shown in table 6.
From table 6, it can be seen that the model using the aliasing width index and BP neural network has relatively large prediction errors for surface roughness, with average relative error of 11.61%.Furthermore, as surface roughness increases, particularly when roughness exceeds 0.68 µm, the accuracy of measurements decreases.In contrast, the model using the aliasing dispersion index and BP neural network has minimal prediction errors for surface roughness, with average relative error of 1.44%.The average accuracy of predictions exceeds 98.5%, demonstrating the capability to accurately measure surface roughness.The model that combines both the aliasing width and the aliasing dispersion indices with BP neural network produces relatively small prediction errors for surface roughness, with average relative error of 1.64%.The average accuracy of measurements exceeds 98%.This model is superior to the model using only the aliasing width index   and BP neural network, but slightly worse than the model using only the aliasing dispersion index and BP neural network.Consequently, the approach using the aliasing dispersion index and BP neural network is able to enhance the accuracy of surface roughness measurements significantly.To enhance system robustness and maintain high measurement precision, it is recommended using both the aliasing width index and the aliasing dispersion index in conjunction with BP neural network.The comparison of tables 5 and 6 shows that 30 sets of data are uniformly and randomly selected within the roughness range for measuring the surface roughness of grinding samples.The use of the dispersion index with BP neural network for measuring the grinding surface roughness is the most accurate, with average accuracy of 98.5%.The use of two indices, the aliasing width and the aliasing dispersion, as well as BP neural network, for measuring the grinding surface roughness values is relatively accurate, with average accuracy of 98%.This not only ensures the accuracy of the surface roughness visual measurement system but also enhances its robustness.
Traditional methods [14][15][16] usually use grayscale images or intensity information from color images to characterize surface roughness.In this paper, the structural information of the color image is used to characterize the roughness.However, in the proposed method, the image acquisition is performed in a dark environment to reduce the interference of light.And the effect of the brightness of the light source on roughness measurement is not considered.These are the limitations of the proposed method.To further improve the accuracy of the method, it is necessary to expand the dataset of grinding samples and to expand the measurement range of roughness.As well, the influence of the brightness of light source on roughness measurement needs to be studied.In addition, the method based on deep learning to predict the roughness of images directly will be further explored in the future.

Conclusion
To measure the grinding surface roughness more accurately, a visual measurement method for grinding surface roughness based on aliasing region index and neural networks is proposed.Firstly, color images of grinding surface are acquired under red and green light source.Secondly, the aliasing regions of color images are extracted through fuzzy clustering segmentation and morphological processing.Thirdly, the aliasing width and the aliasing dispersion related to aliasing regions is feasible as indices for roughness measurement.Finally, it is effective to establish roughness measurement model for grinding surfaces by combining aliasing region indices with BP neural network.The experimental results demonstrate that within the range of grinding surface roughness 0.2 − −0.8 µm, the aliasing dispersion index outperforms the aliasing width index.Meanwhile, using the aliasing dispersion index and BP neural network results in the average relative error of 1.44% and the average measurement accuracy above 98.5%.

Figure 1 .
Figure 1.Schematic of rough surface scattering.When a beam of parallel light strikes the surface of an object at a certain angle, the reflected light forms a reflection band and a scattered light spot.The surface roughness affects the intensity and proportion of reflected and scattered light.

Figure 2 .
Figure 2. Red and green LED light source.(a) Theoretical size (b) physical light source.

Figure 3 .
Figure 3. Images of light sources on surfaces with different roughness levels.(a) Virtual image (b) virtual image with Ra 1 (c) virtual image with Ra 2 .

Figure 4 .
Figure 4. Imaging of rough surface and chromatic aberration distribution.(a) Virtual image (b) contour map of the chromatic aberration distribution.

Table 1 . 2 Figure 5 .
Figure 5.The results of applying fuzzy C-means clustering.(a) Virtual image (b) image after fuzzy clustering.
Figure 6(a) is the virtual image, figure 6(b) is the image after clustering segmentation, and figure 6(c) is the image after boundary extraction.The edges in figure 6(c) are rough, as in the part circled in red.Figure 6(d) is the image after maximum connectivity extraction.From figure 6(d), it can be seen that the aliasing region has relatively clear boundaries X 1 and X 2 .

Figure 7 .
Figure 7.The structure diagram of BP neural network.

Figure 8 .
Figure 8.The topology structure of BP neural network in Matlab.
x 1 , x 2 • • • x n are the input signals representing the indices values; y is the output signal generated after the activation function, representing the predicted roughness; each circle represents a perceptron or artificial neuron, and the desired value represents the measured Ra using stylus.A typical BP neural network model comprises an input layer, a hidden layer, and an output layer.Through continuous training and adjustment of network weights and thresholds, the aim is to minimize the error between the output and expected values.The BP neural network fitting in MATLAB is a two-layer feed forward network with sigmoid hidden neurons and linear output neurons.The topology structure is shown in figure 8.The input indices include the aliasing width and the aliasing dispersion.The first hidden layer is set to contain 10 neurons, with the output being roughness.The dataset is divided into two groups, a training set for network training, and a test set to validate training results.'Neural Net Fitting' from machine learning and deep learning libraries in MATLAB is utilized.

Figure 9 .
Figure 9. Rough sample detection experimental platform.It includes components such as clamping platform, optical platform, cameras, lenses, light sources, light sources controller, grinding samples, test fixture and a computer.

Figure 11 .
Figure 11.Schematic diagram of 9 measurement positions for surface roughness.

Figure 12 .
Figure 12.Changes in images with increasing roughness.From left to right, and from top to bottom, with increasing surface roughness, the overall brightness of the images decreases, indicating a lower overall image energy.

Figure 13 .
Figure 13.Experimental results examples at different roughness values.(a) Virtual images (b) clustered segmentation images (c) morphologically processed images.

figure 15 .
figure15.The fitting curves between the expected and measured roughness values obtained from 'test group' are shown in figure16.The model's performance is evaluated by quantifying the differences between the actual roughness and the predicted values for 'test group'.MAE, MSE, and RMSE are used as performance evaluation metrics, as shown in table 4. The predicted roughness and relative error values of 'test group' are shown in table5.For an ideal fit (where R = 1) in figure15, the data should follow a 45 • diagonal line, meaning that the output equals the target.A fit can be considered reasonable when R (correlation coefficient) is greater than 0.95 for any of these three cases.As shown in figure15, the final regression curve for the aliasing width w m has R of 0.820 08, the final regression curve for the aliasing dispersion d m has R of 0.999 21,

Table 2 .
Measurement data for 40 grinding samples (The unit of roughness is µm).Bold values indicate important data used in the experiment.

.783 0.069 8192.81 390.18 1
.000 1.000 is employed to analyze the goodness of fit for the proposed indices.

Table 3 .
Goodness of fit metrics for Fourier fitting.

Table 4 .
Error analysis of test results for three roughness measurement models.

Table 5 .
Test results of three roughness measurement models.Bold values indicate the maximum accuracy and minimum relative error under different cases.

Table 6 .
Test results of another three roughness measurement models.Bold values indicate the maximum accuracy and minimum relative error under different cases.