Method for detecting turning effect of oxide layer on surface of bar
By using image analysis and mutual information feature quantization, the problems of subjectivity and low efficiency in detecting the turning effect of oxide layer on bar surface are solved, realizing a high-precision and fast detection method, and improving the processing accuracy and life of bar.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANDONG XINJING MASCH CO LTD
- Filing Date
- 2026-02-03
- Publication Date
- 2026-05-12
AI Technical Summary
In existing technologies, the detection of the turning effect of the oxide layer on the surface of bars relies on manual visual inspection or simple image grayscale comparison, which has problems such as high subjectivity, misjudgment and missed judgment, and low detection efficiency.
Image analysis methods are used to acquire grayscale images of the bar surface after turning, construct a mutual information feature quantization system, use the difference of Gaussian pyramid and dual-branch perceptron for image preprocessing, extract the frequency domain energy distribution of the mutual information attenuation spectrum curve, calculate the process consistency and surface anomaly disturbance index, and generate a turning effect quality score.
It enables a comprehensive and objective evaluation of turning results, improves detection accuracy and efficiency, and enhances the subsequent processing accuracy and service life of bars.
Smart Images

Figure CN122023360A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image detection technology, and in particular relates to a method for detecting the turning effect of oxide layer on the surface of bar stock. Background Technology
[0002] Turning to remove the oxide layer from bar stock is a critical process in metallurgy and machining, directly impacting the accuracy and service life of subsequent processing. With the upgrading of industrial automation, the market demand for accurate, objective, and efficient inspection of turning results is increasingly urgent. Currently, bar stock turning results inspection largely relies on manual visual inspection or simple image grayscale comparison methods. Manual inspection is heavily influenced by subjective experience, prone to misjudgments and omissions, and is inefficient. Summary of the Invention
[0003] In view of the technical problems existing in the background art, the present invention proposes a method for detecting the turning effect of oxide layer on bar material surface.
[0004] To achieve the above objectives, the technical solution adopted by the present invention includes the following steps:
[0005] Acquire a grayscale image of the bar surface after turning under uniform lighting conditions and divide the grayscale image into M×N regularly arranged local analysis windows, where M is the number of axial windows and N is the number of circumferential windows;
[0006] For each local analysis window, a set of gray values of pixels within the window and a set of normalized local spatial coordinates are constructed, and the mutual information feature value between the two is calculated. The mutual information feature value characterizes the statistical dependence strength between gray distribution and spatial location within the local area.
[0007] A two-dimensional mutual information feature distribution matrix is generated based on the mutual information feature values of all local analysis windows.
[0008] The two-dimensional mutual information feature distribution matrix is projected in one dimension along the window arrangement direction to obtain the mutual information decay spectrum curve. The horizontal axis of the mutual information decay spectrum curve is the window sequence index, and the vertical axis is the mutual information feature value after one-dimensional projection.
[0009] Calculate the frequency domain energy distribution of the mutual information attenuation spectrum curve, perform discrete Fourier transform on the attenuation spectrum curve, extract the energy ratio of the low frequency component as a process consistency index, and extract the energy ratio of the high frequency component as a surface anomaly disturbance index.
[0010] Based on the process consistency index and surface abnormal disturbance index, the turning effect quality score is calculated by normalized weighted summation, and the quality scores of multiple circumferential sampling surfaces of the bar are averaged to obtain the final bar turning effect quality score.
[0011] Preferably, after acquiring a grayscale image of the bar surface under uniform illumination after turning, the grayscale image data needs to be preprocessed, including:
[0012] Preprocessing is performed on the input noisy image to generate multiple image feature maps at different scales through the difference of Gaussian pyramid, and the pixel gradient variance of each scale feature map is calculated at the same time.
[0013] The pixel gradient variance is input into a dual-branch perceptual network. The first branch uses a threshold adaptive classifier to classify noise into high-frequency impulse noise and low-frequency Gaussian noise. The second branch calculates the noise intensity gradient coefficient through pixel neighborhood correlation and outputs the decoupled noise type label and noise intensity distribution matrix.
[0014] Based on the noise type label and noise intensity distribution matrix, dynamic fusion weights are assigned to the generated feature maps at each scale. At the same time, through a dynamic adjustment mechanism of the convolution kernel, the noise intensity distribution matrix is mapped to the weight bias of the convolution kernel to obtain the enhanced feature map.
[0015] The enhanced feature map is normalized by pixel values to output the final denoised image.
[0016] Preferably, the implementation of the normalized local spatial coordinate set includes:
[0017] A local Cartesian coordinate system is constructed with the top left corner of the local analysis window as the origin, the width of the window as the X-axis, and the height as the Y-axis.
[0018] For each pixel within the window, calculate its horizontal and vertical pixel offsets relative to the origin.
[0019] Perform scale normalization to linearly map all coordinate values to the closed interval [0,1].
[0020] The normalized horizontal and vertical coordinates of each pixel are combined into two-dimensional coordinate pairs, maintaining a one-to-one correspondence with the pixels in the grayscale value sequence, thus forming a set of normalized local spatial coordinates.
[0021] Preferably, when constructing the set of gray values of pixels within the window, gray-level rank normalization needs to be performed on the set of gray values of pixels within the window, replacing the gray value of each pixel with its percentile rank in the gray-level sorting of the entire image, thereby eliminating the influence of absolute gray-level scale.
[0022] Preferably, the calculation of the mutual information feature value includes:
[0023] Discretize the gray values within the local window into L levels, and discretize the normalized local spatial coordinates into a P×Q grid.
[0024] Construct the joint probability distribution matrix of gray-level coordinates and the edge probability distribution vector;
[0025] Calculate the mutual information eigenvalues: ,in, For the i-th gray level, Let be the spatial coordinates of the k-th column and the q-th row. Gray levels and spatial coordinates The probability of them occurring simultaneously Gray levels The probability of occurrence Spatial coordinates The probability of occurrence.
[0026] Preferably, the two-dimensional mutual information feature distribution matrix is generated based on the mutual information feature values of all local analysis windows by sequentially combining M×N regularly arranged local analysis windows.
[0027] Preferably, the one-dimensional projection adopts a weighted average strategy: for each horizontal coordinate window position, the weight is determined by a Gaussian function based on its window spatial distance, and the mutual information feature values of each column are Gaussian weighted and fused as the vertical coordinate to generate a mutual information decay spectrum curve.
[0028] As a preferred method, the calculation of the energy percentage extracted from low-frequency components as a process consistency index is as follows: ,in This represents the complex value of the Fourier transform of the attenuation spectrum curve at frequency f. For low cutoff frequency, C represents the maximum frequency, and C is the process consistency index.
[0029] As a preferred method, the calculation of the energy ratio of high-frequency components as a surface anomalous disturbance index is as follows: ,in, These are the standard deviation and mean of the mutual information feature distribution matrix, respectively. This is the high-frequency starting frequency.
[0030] Compared with existing technologies, the advantages and positive effects of this invention lie in its construction of a mutual information feature quantification system through image analysis, avoiding the subjectivity and inconsistency of manual inspection. Image preprocessing using a Gaussian difference pyramid and a dual-branch perceptron effectively eliminates noise interference. The innovative extraction of the frequency domain energy distribution from the mutual information attenuation spectrum curve yields process consistency indices and surface anomaly disturbance indices, enabling a comprehensive and objective evaluation of turning effects. This method offers high detection accuracy, high efficiency, and reliable results, effectively improving the subsequent processing accuracy and service life of bars, and possesses significant industrial application value. Attached Figure Description
[0031] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0032] Figure 1 This is a flowchart illustrating a method for detecting the turning effect of the oxide layer on the surface of bars. Detailed Implementation
[0033] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described below in conjunction with the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.
[0034] Numerous specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways than those described herein, and therefore the invention is not limited to the specific embodiments disclosed in the following specification.
[0035] Example, Figure 1 This document outlines the implementation steps of a method for detecting the turning effect of oxide layers on the surface of bars.
[0036] First, acquire a grayscale image of the bar surface after turning under uniform lighting conditions, and divide the grayscale image into M×N regularly arranged local analysis windows, where M is the number of axial windows and N is the number of circumferential windows.
[0037] Furthermore, after acquiring the grayscale image of the bar surface under uniform illumination after turning, preprocessing of the grayscale image data is required. Specifically, preprocessing is performed on the input noisy image by generating multiple image feature maps at different scales using a Gaussian difference pyramid, and simultaneously calculating the pixel gradient variance of each scale feature map. Specifically, a Gaussian pyramid is first constructed and applied to the original bar surface image. Sub-Gaussian blurring and downsampling yield a scale of , ,..., Gaussian layer , ,..., Calculate Gaussian difference layering ,in, Finally generated The feature map. The horizontal gradient of each pixel is calculated for the feature map at each scale. and vertical gradient The gradient magnitude is then obtained, and the variance of the gradient magnitude is calculated for the 8×8 pixel block of the feature map to obtain the pixel gradient variance of the feature map at each scale.
[0038] The pixel gradient variance is input into the dual-branch perceptron. Before entering the dual-branch perceptron, these multi-scale gradient variance matrices need to be upsampled to the original scale size through bilinear interpolation. The mean of all upsampled matrices is then taken to obtain the global gradient variance matrix. The first branch uses a threshold adaptive classifier to classify noise into high-frequency impulse noise and low-frequency Gaussian noise. The second branch calculates the noise intensity gradient coefficient through pixel neighborhood correlation and outputs the decoupled noise type label and noise intensity distribution matrix. Specifically, the implementation of the first branch classifying noise into high-frequency impulse noise and low-frequency Gaussian noise through the threshold adaptive classifier is achieved by first calculating the global mean and global standard deviation of the global gradient variance, and then adaptively adjusting the threshold based on the 3σ principle. ,in These represent the global mean and global standard deviation, respectively. High-frequency impulse noise and low-frequency Gaussian noise are determined using an adaptive threshold, and the second branch calculates the 5×5 neighborhood Pearson correlation coefficient. The noise intensity gradient coefficient is obtained as follows: The noise intensity distribution matrix is obtained by combining the noise intensity gradient coefficients at each point.
[0039] Based on the noise type labels and noise intensity distribution matrix, dynamic fusion weights are assigned to the generated feature maps at each scale: for feature maps where the proportion of high-frequency impulse noise exceeds a preset threshold, the fusion weights of the high-scale feature maps are increased to enhance edge details; for feature maps where the proportion of low-frequency Gaussian noise exceeds a preset threshold, the fusion weights of the low-scale feature maps are increased to smooth regional noise. Simultaneously, through a dynamic adjustment mechanism of the convolution kernel, the noise intensity distribution matrix is mapped to the weight bias of the convolution kernel, resulting in enhanced feature maps. Specifically, based on the multi-scale feature maps... Calculate the global noise type proportion, including the proportion of high-frequency impulse noise. and the proportion of low-frequency Gaussian noise The weights for each scale are set according to preset rules, ensuring that the sum of the weights is 1. The feature maps from multiple scales are upsampled to their original size and then weighted and fused according to the weights to obtain the fused feature map. Then the noise intensity is mapped to a weight bias: This leads to the dynamic convolution kernel. .in It is the basic convolution kernel (3×3 Gaussian kernel). Dynamic convolution enhancement yields: The convolution result is normalized to obtain an enhanced feature map. Finally, the enhanced feature map is concatenated with the residual feature map of the original noisy image, where the residual feature map is... ,in, For the original image, This is the enhanced feature map obtained by normalizing the convolution result. and The feature fusion map is obtained by concatenating the channels, and the enhanced feature map is normalized by pixel values to output the final denoised image.
[0040] For each local analysis window, construct a set of grayscale values of pixels within the window and a set of normalized local spatial coordinates.
[0041] In constructing the set of grayscale values of pixels within a window, grayscale rank normalization needs to be performed on the set of grayscale values of pixels within the window. This replaces the grayscale value of each pixel with its percentile rank in the grayscale sorting of the entire image, thus eliminating the influence of absolute grayscale scale.
[0042] Specifically, a list is created using the grayscale values of each pixel in the original grayscale image. ,right Sort in ascending order (or descending order, maintaining consistency) to obtain the sorted sequence. For each grayscale value in the original list, its position in the sorted sequence, i.e., its rank, is recorded. This rank is then converted to a percentile position within the [0,1] interval. The calculated percentile rank is used to replace the corresponding pixel grayscale value in the original image, resulting in a new grayscale image. Each pixel value is a floating-point number within the [0,1] interval, representing the relative position of the original grayscale value in the global sort.
[0043] The normalized local spatial coordinate set is constructed by taking the top-left corner of the local analysis window as the origin, the window width as the X-axis, and the height as the Y-axis to construct a local rectangular coordinate system. For each pixel in the window, its horizontal and vertical pixel offsets relative to the origin are calculated. Scale normalization is performed by dividing the horizontal offset by (window width - 1) and the vertical offset by (window height - 1) to linearly map all coordinate values to the closed interval [0,1]. The normalized horizontal and vertical coordinates of each pixel are combined into two-dimensional coordinate pairs, and the one-to-one correspondence with the pixels in the grayscale value sequence is strictly maintained to form the normalized local spatial coordinate set.
[0044] Then, the mutual information feature value between the two is calculated, which characterizes the statistical dependence strength between gray-level distribution and spatial location within the local region. Specifically, the gray-level values within the local window are discretized into L levels, and the normalized local spatial coordinates are discretized into a P×Q grid.
[0045] We construct the joint probability distribution matrix of grayscale coordinates and the edge probability distribution vector. Specifically, the edge probability is divided into grayscale edge probability vector and spatial coordinate edge probability vector. Both are obtained by summing the dimensions of the joint probability matrix and are key intermediate quantities for calculating mutual information.
[0046] The grayscale edge probability represents the probability of a grayscale level appearing within a local window, obtained by summing the column dimensions of the joint probability matrix. The spatial coordinate edge probability represents the probability of a spatial coordinate appearing within a local window, obtained by summing the row dimensions of the joint probability matrix. Finally, the mutual information eigenvalues are calculated. ,in, For the i-th gray level, Let the coordinates of the k-th column and the q-th row be . Gray levels and spatial coordinates The probability of them occurring simultaneously Gray levels The probability of occurrence Spatial coordinates The probability of occurrence.
[0047] A two-dimensional mutual information feature distribution matrix is generated based on the mutual information feature values of all local analysis windows. This two-dimensional mutual information feature distribution matrix is obtained by sequentially combining M×N regularly arranged local analysis windows.
[0048] A one-dimensional projection is performed on the two-dimensional mutual information feature distribution matrix along the window arrangement direction to obtain the mutual information decay spectrum curve. The horizontal axis of the mutual information decay spectrum curve is the window sequence index, and the vertical axis is the mutual information feature value after one-dimensional projection. Further, the one-dimensional projection adopts a weighted averaging strategy: for each horizontal axis window position, a weight is determined by a Gaussian function based on its window spatial distance; the mutual information feature values of each column are then Gaussian weighted and fused to form the vertical axis, generating the mutual information decay spectrum curve.
[0049] The frequency domain energy distribution of the mutual information attenuation spectrum curve is calculated. A discrete Fourier transform is performed on the attenuation spectrum curve. Based on a preset frequency range, the energy proportion of the low-frequency component is extracted as a process consistency index, and the energy proportion of the high-frequency component is extracted as a surface anomaly disturbance index. Further, the calculation method for extracting the energy proportion of the low-frequency component as the process consistency index is as follows: ,in This represents the complex value of the Fourier transform of the attenuation spectrum curve at frequency f. For low cutoff frequency, Where C is the maximum frequency and C is the process consistency index. The calculation method for extracting the energy proportion of high-frequency components as a surface anomalous disturbance index is as follows: ,in, These are the standard deviation and mean of the mutual information feature distribution matrix, respectively. This is the high-frequency starting frequency.
[0050] Finally, based on the process consistency index and surface anomaly disturbance index, the turning effect quality score is calculated by normalized weighted summation: Among them, the quality score for Z-turning effect is... For the preset weights, The process consistency index and surface anomaly disturbance index are obtained after normalization. The quality scores of multiple circumferential surfaces of the bar are averaged to obtain the final bar turning effect quality score.
[0051] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments for application in other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.
Claims
1. A method for detecting the turning effect of the oxide layer on the surface of bars, characterized in that, Includes the following steps: Acquire a grayscale image of the bar surface after turning under uniform lighting conditions and divide the grayscale image into M×N regularly arranged local analysis windows, where M is the number of axial windows and N is the number of circumferential windows; For each local analysis window, a set of gray values of pixels within the window and a set of normalized local spatial coordinates are constructed, and the mutual information feature value between the two is calculated. The mutual information feature value characterizes the statistical dependence strength between gray distribution and spatial location within the local area. A two-dimensional mutual information feature distribution matrix is generated based on the mutual information feature values of all local analysis windows. The two-dimensional mutual information feature distribution matrix is projected in one dimension along the window arrangement direction to obtain the mutual information decay spectrum curve. The horizontal axis of the mutual information decay spectrum curve is the window sequence index, and the vertical axis is the mutual information feature value after one-dimensional projection. Calculate the frequency domain energy distribution of the mutual information attenuation spectrum curve, perform discrete Fourier transform on the attenuation spectrum curve, extract the energy ratio of the low frequency component as a process consistency index, and extract the energy ratio of the high frequency component as a surface anomaly disturbance index. Based on the process consistency index and surface abnormal disturbance index, the turning effect quality score is calculated by normalized weighted summation, and the quality scores of multiple circumferential sampling surfaces of the bar are averaged to obtain the final bar turning effect quality score.
2. The method for detecting the turning effect of the oxide layer on the surface of bars according to claim 1, characterized in that, After acquiring a grayscale image of the bar surface under uniform illumination after turning, the grayscale image data needs to be preprocessed, including: Preprocessing is performed on the input noisy image to generate multiple image feature maps at different scales through the difference of Gaussian pyramid, and the pixel gradient variance of each scale feature map is calculated at the same time. The pixel gradient variance is input into a dual-branch perceptual network. The first branch uses a threshold adaptive classifier to classify noise into high-frequency impulse noise and low-frequency Gaussian noise. The second branch calculates the noise intensity gradient coefficient through pixel neighborhood correlation and outputs the decoupled noise type label and noise intensity distribution matrix. Based on the noise type label and noise intensity distribution matrix, dynamic fusion weights are assigned to the generated feature maps at each scale. At the same time, through a dynamic adjustment mechanism of the convolution kernel, the noise intensity distribution matrix is mapped to the weight bias of the convolution kernel to obtain the enhanced feature map. The enhanced feature map is normalized by pixel values to output the final denoised image.
3. The method for detecting the turning effect of the oxide layer on the surface of bars according to claim 1, characterized in that, The implementation of the normalized local space coordinate set includes: A local Cartesian coordinate system is constructed with the top left corner of the local analysis window as the origin, the width of the window as the X-axis, and the height as the Y-axis. For each pixel within the window, calculate its horizontal and vertical pixel offsets relative to the origin. Perform scale normalization to linearly map all coordinate values to the closed interval [0,1]. The normalized horizontal and vertical coordinates of each pixel are combined into two-dimensional coordinate pairs, maintaining a one-to-one correspondence with the pixels in the grayscale value sequence, thus forming a set of normalized local spatial coordinates.
4. The method for detecting the turning effect of the oxide layer on the surface of bars according to claim 1, characterized in that, When constructing the set of gray values of pixels within a window, gray-level rank normalization needs to be performed on the set of gray values of pixels within the window. This replaces the gray value of each pixel with its percentile rank in the gray-level sorting of the entire image, thus eliminating the influence of absolute gray-level scale.
5. The method for detecting the turning effect of the oxide layer on the surface of bars according to claim 1, characterized in that, The calculation of the mutual information feature value includes: Discretize the gray values within the local window into L levels, and discretize the normalized local spatial coordinates into a P×Q grid; Construct the joint probability distribution matrix of gray-level coordinates and the edge probability distribution vector; Calculate mutual information eigenvalues: ,in, For the i-th gray level, Let be the spatial coordinates of the k-th column and the q-th row. Gray levels and spatial coordinates The probability of them occurring simultaneously Gray levels The probability of occurrence Spatial coordinates The probability of occurrence.
6. The method for detecting the turning effect of the oxide layer on the surface of bars according to claim 1, characterized in that, Based on the mutual information eigenvalues of all local analysis windows, a two-dimensional mutual information feature distribution matrix is generated by sequentially combining M×N regularly arranged local analysis windows.
7. The method for detecting the turning effect of the oxide layer on the surface of bars according to claim 1, characterized in that, The one-dimensional projection adopts a weighted average strategy: for each horizontal coordinate window position, the weight is determined by a Gaussian function based on its window spatial distance, and the mutual information feature values of each column are weighted and fused by Gaussian as the vertical coordinate to generate a mutual information decay spectrum curve.
8. The method for detecting the turning effect of the oxide layer on the surface of bars according to claim 1, characterized in that, The calculation method for the energy percentage extracted from low-frequency components as a process consistency indicator is as follows: ,in This represents the complex value of the Fourier transform of the attenuation spectrum curve at frequency f. For low cutoff frequency, C represents the maximum frequency, and C is the process consistency index.
9. A method for detecting the turning effect of the oxide layer on the surface of bars according to claim 1, characterized in that, The calculation method for extracting the energy proportion of high-frequency components as a surface anomalous disturbance index is as follows: ,in, These are the standard deviation and mean of the mutual information feature distribution matrix, respectively. This is the high-frequency starting frequency.