Data line surface defect rapid nondestructive testing method based on intelligent image recognition
By constructing multi-scale image pyramid and frequency domain filtering technology, combined with morphological operations, the frequency feature confusion problem in surface defect detection of braided texture sheath data lines is solved, high-precision non-destructive detection is achieved, and detection accuracy and robustness are improved.
Patent Information
- Application Number
- CN202510735111.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-04
- Publication Date
- 2025-07-04
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the industrial production of braided textured sheath data lines, surface defect detection has problems with frequency characteristics, resulting in leakage detection rates as high as 15%-20% and false detection rates above 10%, making it difficult to achieve accurate non-destructive testing.
Using an intelligent image recognition method, a multi-scale image pyramid is constructed, combined with adaptive threshold algorithm, Fourier transform and bandpass filtering technology, weaving textures and defect signals are separated, and morphological operations and connectivity domain analysis are used to accurately locate the surface defects of the data line.
The detection accuracy is significantly improved, and the detection accuracy of broken wire defects with a diameter of 0.08mm is increased from 82% to more than 95%, solving the problems of missed detection and misjudgment caused by frequency characteristics, and ensuring the robustness and accuracy of the detection system.
Smart Images

Figure CN120259298A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image data processing, and more specifically, to a method for rapid non-destructive detection of surface defects of data cables based on intelligent image recognition. Background Art
[0002] In the industrial production of data cables with braided texture sheaths, there are significant technical problems in surface defect detection. The warp and weft interlaced texture formed by the braiding process has the characteristics of random spatial distribution and multi-scale. From the macroscopic pattern to the microscopic single-filament structure, texture signals at different scales are superimposed on each other to form a complex noise background. Among them, the problem of frequency feature confusion is particularly prominent: Traditional image detection methods rely on frequency domain analysis to separate defect features, but there is a significant overlap between the mid-low frequency signals of the braided texture and the high frequency signals generated by defects. Taking the broken wire defect with a diameter <0.1 mm as an example, the high frequency edge signal generated by it is extremely easy to be submerged by the periodic high frequency noise of the braided texture, resulting in a missed detection rate as high as 15%-20%; while the sharp edges of the thick texture in the braided structure are often misjudged as wear defects, causing a false detection rate of more than 10%. The insufficient detection accuracy caused by this frequency feature confusion has become a key technical bottleneck hindering the intelligent quality control of braided texture data cables. In view of this, we propose a method for rapid non-destructive detection of surface defects of data cables based on intelligent image recognition. Summary of the Invention
[0003] The purpose of the present invention is to provide a method for rapid non-destructive detection of surface defects of data cables based on intelligent image recognition, so as to solve the technical problems of difficult separation of defect features and low detection accuracy under the interference of complex braided texture noise.
[0004] To solve the above technical problems, the present invention provides the following technical solutions: A method for rapid non-destructive detection of surface defects of data cables based on intelligent image recognition, including the following steps: S1: Collect data cable images and perform grayscale processing; S2: Construct a multi-scale image pyramid, accurately segment the image using an adaptive threshold algorithm, and combine the Hough transform to achieve rapid detection of surface defects of the data cable; S3: Implement frequency domain separation of the braided texture and background noise through Fourier transform, filter out interference by combining band-pass filtering technology, and then enhance the defect contrast using histogram equalization; S4: Calculate the range and local standard deviation of the grayscale values within the image region to quantify the change of texture detail features; S5: Compensate for texture grayscale fluctuations through an adaptive filtering algorithm and construct a grayscale histogram; S6: Calculate the grayscale value offset, dynamically adjust the adaptive grayscale mean, and optimize the contrast; S7: Enhance the feature differences between the texture and defects, and use a linear correction algorithm to extract and optimize features; S8: Implement morphological operations using multi-directional structuring elements, and combine connected component feature analysis to accurately locate surface defects of the data line; S9: Use the Canny edge extraction algorithm to perform edge detection on the image after morphological processing, combine with the Hough circle detection algorithm, obtain the edge contour of the data line according to the detection results, and achieve the positioning and recognition of surface defects of the braided texture sheath data line through contour analysis.
[0005] The present invention performs multi-scale decomposition by constructing a three-layer Gaussian pyramid, and combines band-pass filtering technology. By retaining high-frequency defect features greater than 20 cycles / mm and suppressing medium and low-frequency texture noise of 5 - 20 cycles / mm, the braided texture and defect signals are effectively separated. Compared with traditional methods, this technology improves the detection accuracy of wire breakage defects with a diameter of 0.08 mm from 82% to over 95%, and completely solves the problems of missed detection and misjudgment caused by frequency feature confusion.
[0006] Preferably, in the step S2, the specific steps are as follows: S201: Adaptive threshold segmentation: Use the Otsu algorithm to perform adaptive threshold segmentation on the grayscale image of the data line, determine the optimal threshold by maximizing the between-class variance, and divide the image into a foreground region and a background region. The formula is: ; In the formula, represents the candidate threshold, represents the threshold the probability of foreground pixels under the threshold, represents the threshold the probability of background pixels under the threshold, represents the mean value of foreground pixels, represents the mean value of background pixels, is the optimal threshold, represents returning the parameter value that makes the objective function reach the maximum value; S202: Gaussian pyramid multi-scale decomposition: Introduce Gaussian pyramid multi-scale decomposition for each foreground segmentation region, generate image pyramids of different scales, perform Canny edge detection and circular fitting respectively, and obtain multi-scale circular foreground segmentation regions.
[0007] Preferably, in the step S3, the following steps are further included: S301: Two-dimensional Fourier transform: Perform two-dimensional Fourier transform on each multi-scale circular foreground segmentation region to convert the image from the spatial domain to the frequency domain; S302: Band - pass frequency - domain filtering: Replace low - pass filtering with band - pass filtering. By analyzing the frequency - domain distribution of the braided texture, design a band - pass filter to retain the high - frequency components corresponding to the defect features and suppress the mid - and low - frequency components corresponding to the texture noise. The frequency - domain filtering function is defined as: ; In the formula, represents the lowest spatial - frequency threshold allowed to pass in the frequency domain, is the highest spatial - frequency threshold of the image; S303: Inverse Fourier transform: Perform an inverse Fourier transform on the frequency - domain filtered image to convert the image back to the spatial domain and obtain a circular foreground segmentation image that suppresses texture noise and enhances defect features.
[0008] Preferably, in step S4, the following steps are further included: S401: Calculation of the range of gray values: For the pixel point on the th enhanced circular foreground segmentation image, the range of gray values of the circular foreground segmentation area where it is located is: In the formula, represents the set of gray values of all pixel points within the th circular area centered on the pixel point , and are respectively the maximum gray value and the minimum gray value in the set ; S402: Calculation of local standard deviation: Reflect the degree of gray - value fluctuation around the pixel point through the local standard deviation.
[0009] Preferably, in step S5, the following steps are further included: S501: Correction of the mean gray value of the texture: Before calculating the gray - level histogram, correct the mean gray value of the texture for each circular foreground area; S502: Construction of the gray - level histogram: The gray - level histogram of the th enhanced circular foreground segmentation image is: ; In the formula, represents the pixel statistic of the gray - level in the th circular foreground segmentation area , represents the th circular foreground segmentation area, represents the gray - level, is the indicator function.
[0010] Preferably, in step S6, the following steps are further included: S601: Calculation of grayscale value offset: Calculate the grayscale value offset according to the maximum value and the minimum value of the grayscale levels in the grayscale histogram, as well as the difference between the grayscale extreme values. S602: Adaptive grayscale mean value: Calculate the adaptive grayscale mean value by combining the grayscale value offset and the local standard deviation. S603: Enhance contrast: Enhance the image contrast by adjusting the grayscale value range.
[0011] Preferably, in step S7, the following specific content is included: Perform linear correction according to the local standard deviation, grayscale value range, enhanced contrast, and texture-defect differential coefficient of the pixel points.
[0012] Preferably, in step S8, the following steps are further included: S801: Direction-adjustable morphological processing: In morphological processing, use a direction-adjustable linear structural element, and select the structural element in the corresponding direction for dilation processing and erosion processing according to the main direction of the woven texture. S802: Connected component analysis: For each first circular foreground segmentation image after morphological processing, obtain multiple connected components, and perform edge detection on each connected component to obtain the edge image of each connected component.
[0013] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. The present invention performs multi-scale decomposition by constructing a three-layer Gaussian pyramid, and combines band-pass filtering technology. By retaining high-frequency defect features of >20 cycles / mm and suppressing medium- and low-frequency texture noises of 5-20 cycles / mm, the woven texture and defect signals are effectively separated. Compared with traditional methods, the detection accuracy of wire breakage defects with a diameter of 0.08 mm is increased from 82% to over 95%, completely solving the problems of missed detection and misjudgment caused by frequency feature confusion.
[0014] 2. The present invention also enhances the detection robustness dynamically and adaptively: For the grayscale fluctuations of data lines in different batches, a texture grayscale mean value correction and a contrast enhancement algorithm based on grayscale offset and local standard deviation are adopted. In a dark texture scenario, the grayscale difference between the defect and the normal area can be increased from 8 levels to over 25 levels, avoiding missed detection problems caused by light and color difference, and ensuring the universality of the detection system for different production batches.
[0015] 3. The present invention also accurately locates through direction-sensitive morphology: an adjustable structural element is introduced, the main direction of the braided texture is automatically matched based on the peak value of the frequency-domain energy, and the edge coherence of the defect is enhanced through adaptive dilation / erosion processing, increasing the edge continuity rate of broken wires in the 45° direction from 60% to 95%. Combining the connected component feature analysis to achieve sub-pixel positioning, it solves the problems of broken defect edges or excessive dilation caused by traditional morphological processing, and provides accurate coordinate information for subsequent defect classification and repair. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 It is a flowchart of the method of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0017] Example 1: As Figure 1 shown, a method for rapid non-destructive detection of surface defects of a data cable based on intelligent image recognition according to the present invention includes the following steps: S1: Collect an image of the data cable and perform grayscale processing; In the embodiment of the present invention, in step S1, the following specific contents are included: collecting an image of a data cable with a braided texture sheath and performing grayscale processing, converting the color image into a grayscale image to reduce the interference of color information on subsequent processing. The formula is expressed as: ; In the formula, represents the pixel value of the red (Red) channel in the color image. In the RGB color model, the red channel is responsible for storing the red intensity information of each pixel in the image, and its value range is usually 0 - 255. The larger the value, the more obvious the red component of the pixel; represents the pixel value of the green (Green) channel in the color image. Green is an important part of the RGB color model, and its value range is also 0 - 255. The value reflects the strength of the green component of the pixel. In the human eye visual system, green has a greater impact on brightness perception; refers to the pixel value of the blue (Blue) channel in the color image, with a value range of 0 - 255, recording the intensity of the blue component of each pixel; is the converted grayscale value, which is used to characterize the brightness of the image pixel. The range is also 0 - 255. 0 represents pure black, 255 represents pure white, and intermediate values correspond to different shades of gray. Through this formula, the information of the three channels of the color image is weighted and summed according to the sensitivity of the human eye to different colors, realizing the conversion from a color image to a grayscale image, simplifying the image information, and facilitating subsequent surface defect detection processing.
[0018] After the grayscale processing is completed, it lays the foundation for subsequent more complex image processing and defect detection operations based on the grayscale image. Next, by constructing a multi-scale image pyramid, using an adaptive threshold algorithm to accurately segment the image, and combining with the Hough transform to achieve rapid detection of defects on the data line surface, the defect information in the image is further deeply explored.
[0019] S2: By constructing a multi-scale image pyramid, using an adaptive threshold algorithm to accurately segment the image, and combining with the Hough transform to achieve rapid detection of defects on the data line surface; In the embodiment of the present invention, in the step S2, the specific steps are as follows: S201: Adaptive threshold segmentation: Use the Otsu algorithm to perform adaptive threshold segmentation on the grayscale image of the data line. Determine the optimal threshold by maximizing the between-class variance, and segment the image into a foreground region and a background region. The formula is: ; In the formula, represents the candidate threshold, which is a variable used to distinguish the foreground and the background during the image segmentation process. By continuously changing this value, the best segmentation boundary is found; represents the threshold The probability of foreground pixels below, that is, when the threshold is set to The proportion of the number of pixels belonging to the foreground part in the image to the total number of pixels; represents the threshold The probability of background pixels below, that is, when the threshold is The proportion of the number of pixels belonging to the background part in the image to the total number of pixels; represents the mean value of foreground pixels, which is the average value of the numerical values (such as grayscale values, etc.) of all foreground pixels when the threshold is set to ; represents the mean value of background pixels, that is, when the threshold is The average value of the numerical values (such as grayscale values, etc.) of all background pixels; is the optimal threshold. By calculating all candidate thresholds Make The value that reaches the maximum is , which can achieve the best segmentation of the foreground and the background; represents returning the parameter value that makes the objective function reach the maximum value.
[0020] Through the above formula, the threshold that can maximize the difference between foreground and background pixels can be automatically calculated, effectively distinguishing the target area from the background in the data line image, and laying the foundation for subsequent multi-scale feature extraction and defect detection.
[0021] S202: Gaussian pyramid multi-scale decomposition: Introduce Gaussian pyramid multi-scale decomposition for each foreground segmentation region to generate image pyramids of different scales ( ), perform Canny edge detection and circular fitting respectively to obtain multi-scale circular foreground segmentation regions. The formula for generating the -th layer image of the Gaussian pyramid is: , where represents the result of the Gaussian kernel after processing in the -th layer, which is continuously updated with iterative calculations and is used to gradually extract the braided texture features; represents the result of the Gaussian kernel of the previous layer (i.e., the -th layer), which is the basis for the current layer's calculation and retains the texture feature information extracted previously; is the Gaussian kernel with a standard deviation of , and , as the key parameter of this Gaussian kernel, can control the shape and smoothness of the Gaussian kernel by adjusting its numerical value. takes a smaller value, and the corresponding Gaussian kernel function curve is relatively sharp, tending to extract braided texture features with rich details and thinner lines in image processing; takes a larger value, and the Gaussian kernel function curve is relatively flat, which is more suitable for extracting relatively rough and contour-like braided texture features. Through the and convolution operation, the extraction of braided texture features of different thicknesses is realized.
[0022] In the process of Gaussian pyramid multi-scale decomposition, through Gaussian kernel convolution and downsampling operations at different scales, the perception of the image by the human eye at different viewing distances can be simulated, so as to effectively extract the multi-scale features of the braided texture from macro to micro. Each layer of the image not only retains the main information of the previous layer of the image, but also further reduces the resolution, making the analysis of the braided texture and defect features at different scales more comprehensive, providing a basis for accurately identifying tiny defects and complex texture structures in the follow-up.
[0023] S203: Edge detection and circular fitting: Input the foreground segmentation region at each scale into the Canny edge detector, and obtain the edge image through Gaussian filtering, non-maximum suppression, and double-threshold detection; then perform circular fitting on the edge image, and use the least squares method or the Hough transform to detect circular regions to obtain multiple multi-scale circular foreground segmentation regions.
[0024] S3: Achieve the frequency domain separation of the braided texture and background noise through Fourier transform, filter out interference by combining band-pass filtering technology, and then enhance the defect contrast using histogram equalization; In the embodiment of the present invention, in the step S3, the following steps are further included: S301: Two-dimensional Fourier Transform: Perform a two-dimensional Fourier transform on each multi-scale circular foreground segmentation region to convert the image from the spatial domain to the frequency domain. The formula is: , where represents the pixel value of the spatial domain image at the horizontal coordinate and the vertical coordinate . The value range of is from 0 to , 's value range is from 0 to . This parameter describes the grayscale or color information of the image in terms of spatial position; represents the frequency component value of the frequency domain image at the frequency domain coordinate after Fourier transform. Its physical meaning is the amplitude and phase of the corresponding frequency component in the image. By analyzing , the frequency characteristics of the image can be extracted for subsequent tasks such as defect detection; , respectively represent the dimensions of the original image in the horizontal and vertical directions, that is, the number of pixels of the image width and height. These two parameters determine the size scale of the image and directly affect the calculation range and result dimension of the Fourier transform; is the frequency domain coordinate, corresponds to the horizontal direction frequency, corresponds to the vertical direction frequency, 's value range is usually from 0 to , 's value range is from 0 to . Different combinations correspond to the distribution of different frequency components in the image. The low-frequency part describes the overall contour of the image, and the high-frequency part reflects details such as the texture of the image.
[0025] After converting the image from the spatial domain to the frequency domain through two-dimensional Fourier transform, the texture and defect information of the image are presented in different frequency components. The frequency domain distribution of the woven texture is relatively regular, mostly concentrated in the mid-low frequency part, while the defect features mainly correspond to the high-frequency components. Based on this characteristic, subsequent appropriate filtering algorithms can be designed to effectively separate the woven texture from the background noise, laying a foundation for more accurate defect feature detection.
[0026] S302: Band-pass Frequency Domain Filtering: Use band-pass filtering instead of low-pass filtering. By analyzing the frequency domain distribution of the woven texture (such as the warp and weft frequencies are 5 - 20 cycles / mm), design a band-pass filter to retain the high-frequency components (>20 cycles / mm) corresponding to the defect features and suppress the mid-low frequency components corresponding to the texture noise. The frequency domain filtering function is defined as: ; Wherein, , represents the lowest spatial frequency threshold allowed to pass in the frequency domain. This threshold is used to filter out the basic frequency information related to the braided texture of the data line, and filter out low-frequency noise or irrelevant background information below this frequency. is the highest spatial frequency threshold of the image, representing the upper limit of the highest spatial frequency that can be obtained in the dataset, which is used to limit the passing frequency range, avoid the interference of high-frequency noise on the detection result, and ensure that only the effective frequency components related to the surface defect detection of the braided texture sheath data line are retained.
[0027] Through the above band-pass filter, the interference of medium and low-frequency noise generated by the braided texture can be effectively suppressed, and the high-frequency signal corresponding to the defect feature can be accurately retained, so as to realize the effective separation of the braided texture and the background noise in the frequency domain. On this basis, in order to restore the image to the spatial domain for subsequent processing, an inverse Fourier transform operation is required.
[0028] S303: Inverse Fourier transform: Perform an inverse Fourier transform on the frequency-domain filtered image to convert the image back to the spatial domain, and obtain a circular foreground segmentation image that suppresses texture noise and enhances defect features. The formula is: ; Wherein, represents the coordinates in the spatial domain of the image, which is used to locate the pixel position on the image plane. corresponds to the horizontal direction. corresponds to the vertical direction; is the imaginary unit, satisfying , and is used to represent the complex form in the Fourier transform to simultaneously describe the amplitude and phase information of the frequency component; pi, which is used to construct a periodic frequency function in the exponential term.
[0029] After converting the image back to the spatial domain through the inverse Fourier transform, the braided texture noise in the image is effectively suppressed, and the defect features are also enhanced. However, there is still room for improvement in the defect contrast of the image at this time. In order to further highlight the difference between the defect and the normal texture, the range and local standard deviation of the gray values in the image area will be calculated subsequently to quantify the change of the texture detail features, laying a foundation for more accurate defect detection.
[0030] S4: Quantify the change of texture detail features by calculating the range and local standard deviation of the gray values in the image area; In the embodiment of the present invention, in the step S4, the following steps are further included: S401: Range calculation of gray value: For the pixel point on the th enhanced circular foreground segmentation image, the range of the gray value of the circular foreground segmentation area where it is located is: , where represents the range of gray values within the th circular region centered on the pixel point , which is used to quantify the change degree of gray values within this region. The larger its value indicates the more obvious gray difference within this region. In the surface defect detection of the braided texture sheath data cable, a larger range of gray values may imply the existence of surface defects. denotes the set composed of the gray values of all pixel points within the th circular region centered on the pixel point ; and are respectively the maximum gray value and the minimum gray value in the set . The range of gray values of this region is obtained by calculating the difference between the two.
[0031] Through the calculation of the range of gray values, the region with drastic gray changes in the image can be quickly located, providing a basis for preliminarily judging the possibility of the existence of defects. However, relying solely on the range of gray values is not sufficient to comprehensively characterize the change situation of image texture details.
[0032] S402: Local standard deviation calculation: The fluctuation degree of gray values around the pixel point is reflected through the local standard deviation, and the calculation formula is: ; where represents the standard deviation of the gray values of pixels within the local neighborhood centered on the pixel point in the th image channel, which is used to quantify the dispersion degree of gray values within this neighborhood and reflect the texture changes or defect characteristics of the local region of the image; is the local neighborhood range delimited centered on the pixel point . By limiting this range, the characteristics of the local region of the image can be focused for analysis. Usually, the shape of the neighborhood can be square, circular, etc.; is the mean value of the gray values of all pixel points within the local neighborhood in the th channel, which is used as an index to measure the average level of gray values of this neighborhood and is used for subsequent calculation of the deviation of gray values; represents the number of pixel points included in the local neighborhood . This value determines the sample size when calculating the mean value and the standard deviation, affecting the stability and representativeness of the statistical results; represents the gray value of the pixel point located at the coordinate in the th image channel, is an arbitrary pixel coordinate within the local neighborhood . By traversing The grayscale values of all pixels within are involved in the calculation of the standard deviation.
[0033] By calculating the range of grayscale values and the local standard deviation, the changes in the texture details of the image are quantified from different perspectives. The range of grayscale values highlights the overall difference in grayscale within the region, while the local standard deviation precisely depicts the degree of grayscale fluctuation around the pixel points. The two complement each other and can more comprehensively capture the regional characteristics of possible defects in the image, laying a solid data foundation for accurately compensating the grayscale fluctuations of the braided texture on the surface of the data line through an adaptive filtering algorithm, and further calculating the grayscale histogram and extracting defect features.
[0034] S5: Accurately compensate the grayscale fluctuations of the braided texture on the surface of the data line through an adaptive filtering algorithm, and on this basis, calculate the grayscale histogram to provide data support for defect feature extraction; In the embodiment of the present invention, in the step S5, the following steps are further included: S501: Texture grayscale mean correction: Before calculating the grayscale histogram, perform texture grayscale mean correction on each circular foreground region. The formula is: , where represents the grayscale value of the pixel at coordinates in the th region after processing. This value is the result of specific operations on the original grayscale value and is used for subsequent analysis of defect detection on the surface of the braided texture sheath of the data line; is the average grayscale value of the braided texture in the th region. It is obtained by calculating the mean of the grayscale values of all pixel points in the th texture region segmented by the Otsu's method (a threshold-based image segmentation algorithm that automatically calculates the optimal threshold for separating the target and background in the image based on the grayscale distribution of the image, and then segments the texture region). This parameter is used to measure the average light and dark degree of the texture in the th region and plays a role in calibrating the original grayscale value in the formula to more clearly highlight the texture features and potential defects.
[0035] Through texture grayscale mean correction, the interference caused by the grayscale fluctuations of the braided texture itself is effectively eliminated, making the grayscale distribution in different regions of the image more consistent, and providing a reliable data foundation for the accurate construction of the subsequent grayscale histogram.
[0036] S502: Grayscale histogram construction: The grayscale histogram of the th enhanced circular foreground segmentation image is: ; where Indicates the pixel statistic of the nth circular foreground segmentation region where the gray level is . This value is obtained by counting and accumulating the pixels within the region that meet specific gray level conditions, reflecting the distribution of the gray level within the region ; Represents the nth circular foreground segmentation region, which is a target region with a circular shape extracted from the overall image through a specific segmentation algorithm, used for focusing on and analyzing image features within a specific range; Indicates the gray level, usually with a value range from 0 to 255 (for 8-bit gray images), used to quantify the brightness of pixel points in the image, and is a key dimension for pixel statistics; is an indicator function, whose role is to determine whether the gray value of a pixel point meets the specified condition. When , that is, when the gray value of the pixel point with coordinates in the nth circular foreground segmentation region is equal to the specified gray level , then takes the value of 1; otherwise, it takes the value of 0. This function is the core of implementing pixel statistics logic. Through a binary judgment mechanism, pixels that meet the conditions are "selected" for accumulation; By constructing a gray histogram, the distribution of pixel points at each gray level in the image can be visually presented, providing important data basis for subsequent quantitative analysis of defect features. On this basis, by calculating the gray value offset, dynamically adjusting the adaptive gray mean, and optimizing the contrast, the gray difference between defects and normal textures can be further enhanced, creating conditions for more accurate defect feature extraction.
[0037] S6: Precise calculation of gray value offset, dynamic adjustment of adaptive gray mean, and optimization calculation of enhanced contrast; In the embodiment of the present invention, in step S6, the following steps are further included: S601: Gray value offset calculation: According to the maximum value and minimum value of the gray level in the gray histogram, as well as the gray extreme value difference, calculate the gray value offset: , where in the formula, represents the maximum value of the gray values of all pixel points in the mth image. The gray value reflects the brightness of the pixel point in the image and the gray situation of the brightest region in the image; represents the minimum value of the gray values of all pixel points in the mth image, reflecting the gray state of the darkest region in the image; is the maximum value of the number of pixels in all images to be detected. It serves as a normalization factor to eliminate the impact of differences in the number of pixels in different images on the calculation results, making the calculation results comparable among different images; is the mean of the gray value ranges of the th image. The gray value range reflects the intensity of gray changes in the image, and taking the mean is to more stably and comprehensively describe the overall characteristics of the gray changes in the image and comprehensively reflect the gray distribution of the image; By calculating the gray value offset, the offset trend of the gray distribution of the image can be effectively reflected. On this basis, combined with the degree of gray fluctuation around the pixel points reflected by the local standard deviation, the adaptive gray mean is calculated, which can further dynamically adjust the gray level of the image, making the gray distribution in the normal texture area more uniform, while highlighting the gray differences in the defect area, providing a more optimized data basis for enhancing the image contrast and accurately identifying defect features in the subsequent process.
[0038] S602: Adaptive gray mean: Combine the gray value offset and the local standard deviation to calculate the adaptive gray mean: ; In the formula, represents the number of pixels in the th circular region, which is used for normalization processing in subsequent calculations; represents the adjusted gray mean of the th circular region. This parameter is an eigenvalue obtained through specific calculations and is used for surface defect detection and analysis; are the coordinates of the image pixel point, indicating that the pixel point is located in the th circular region inside.
[0039] By calculating the adaptive gray mean, the gray distribution of the image is effectively adjusted, making the gray level in the normal texture area more uniform and stable. On this basis, the operation of enhancing the contrast further expands the gray difference between the defect and the normal texture, ensuring the stability and effectiveness of the calculation under various image conditions. By adjusting the gray value range, the defect part is made more prominent in the image, providing a clear and intuitive image basis for subsequent accurate defect feature extraction.
[0040] S603: Enhance contrast: Enhance the image contrast by adjusting the gray value range. The formula is: , in the formula, is the Characteristic parameters corresponding to a computing unit, used to quantify the feature values related to the texture or defects in a specific area on the data line surface. The change of this value can reflect the difference in surface texture or the presence of defects; is a minimum constant, usually a positive number much smaller than and Its core function is to avoid the situation where the denominator is zero when to ensure that the formula has mathematical meaning in any case.
[0041] Through the operation of enhancing contrast, the visual difference between defects and normal textures has been effectively improved. On this basis, to further accurately extract defect features, it is necessary to strengthen the feature difference between textures and defects. By introducing a linear correction algorithm, the image features are optimized, so as to achieve more accurate defect recognition and positioning.
[0042] S7: By strengthening the feature difference between textures and defects and supplemented with a linear correction algorithm, accurate feature extraction and optimization are achieved; In the embodiment of the present invention, in step S7, it specifically includes the following content: linear correction is performed according to the local standard deviation, gray value range, enhanced contrast, and texture-defect difference coefficient of pixel points: ; In the formula, , are linear correction coefficients, which are determined by experimental optimization and are used to adjust the response sensitivity of the algorithm to different texture and defect features, and balance the weights of the gray mean, standard deviation, and gray change amount in the process of pixel value enhancement; is the pixel value after linear enhancement. After calculation by the above formula, multiple first circular foreground segmentation images after adaptive linear enhancement can be obtained, highlighting potential defect areas and suppressing normal texture interference; is the texture-defect difference coefficient, and the calculation formula is , where is the texture gray standard deviation of the th region, reflecting the gray change characteristics of normal textures and serving as a reference benchmark for measuring the gray fluctuation of local regions; is a minimum constant. Introducing this constant is to avoid the situation where the denominator is zero and ensure that is meaningful in any case. Usually, it takes a very small positive number (such as ); After being processed by the linear correction algorithm, the defect features in the image have been significantly enhanced. At this time, the potential defect areas in the image have become more prominent, but the defects still need to be accurately located further.
[0043] S8: Implement morphological operations using multi-directional structural elements, and combine connected component feature analysis to accurately locate surface defects of data lines; In the embodiment of the present invention, in the step S8, the following steps are further included: S801: Direction-adjustable morphological processing: In morphological processing, use direction-adjustable linear structural elements (such as four directions of 0°, 45°, 90°, and 135°), and select the structural element in the corresponding direction for dilation processing and erosion processing according to the main direction of the weaving texture (determined by the energy peak direction in frequency domain analysis); The dilation formula is: ; The erosion formula is: ; In the formula, represents the original image, that is, the original image data without dilation or erosion operations, and each pixel point contains specific grayscale values or color information; is a direction-adjustable linear structural element, which is a small image template with a specific shape and size, used for sliding operations on the original image. By adjusting its direction, the features in different directions of the image can be processed. The shape and size of the structural element will directly affect the effects of dilation and erosion operations. For example, linear structural elements with different lengths and angles will produce different results in the processing of features such as image edges and lines; is the structural element The offset of the pixel point in the structural element relative to the coordinates of the original image. By traversing the offsets of all pixel points in the structural element , the pixel range participating in the calculation on the original image is determined; is the dilation operator. By performing this operation on the original image and the structural element , the maximum value operation is performed on the pixel values within the coverage area of the structural element , thereby expanding the boundaries of the highlighted areas or objects in the image; is the erosion operator. When the original image and the structural element perform this operation, the minimum value operation is performed on the pixel values within the coverage area of the structural element , which has the effect of shrinking the boundaries of the highlighted areas or objects in the image; Through direction-adjustable morphological processing, the image can be targeted for edge processing according to the direction of the weaving texture, effectively enhancing the coherence and clarity of the defect edges. On this basis, further through connected component analysis, the connectivity characteristics of each region in the image can be systematically analyzed, so as to more accurately locate the specific position and range of the defect.
[0044] 802: Connected Component Analysis: For each first circular foreground segmentation image after morphological processing, multiple connected components are obtained, and edge detection is performed on each connected component to obtain the edge image of each connected component.
[0045] S9: Use the Canny edge extraction algorithm to perform edge detection on the image after morphological processing, combine with the Hough circle detection algorithm, obtain the edge contour of the data line according to the detection result, and realize the positioning and recognition of surface defects (such as broken wires, jumper wires, wear, etc.) on the braided texture sheath data line through contour analysis.
[0046] Embodiment 2: Based on meeting the market demand for high-quality braided texture data lines, taking the "HyperChargePro series braided data lines" as an object, a fast and non-destructive surface defect detection method applicable to industrial production lines and real test data examples are provided. Through standardized operation procedures and actual collected data, a complete and reusable detection system is constructed: Step S1: Image acquisition and grayscale conversion; Operation: Collect the color image of the data line through an industrial camera, set the resolution to 1920×1080 pixels, and convert the color image to a grayscale image using the weighted average method to eliminate color interference.
[0047] Formula: ; Step S2: Multi-scale image pyramid and initial defect detection Adaptive threshold segmentation (Otsu algorithm): Formula: ; Objective: Automatically determine the optimal segmentation threshold between the foreground and the background by maximizing the between-class variance, and divide the image into the foreground of the data line body and the background.
[0048] Gaussian pyramid multi-scale decomposition: Scale parameter: Set A total of 3 scales to simulate texture perception at different viewing distances of the human eye.
[0049] Formula: ; Operation: Perform Canny edge detection and circular fitting on each scale image to extract braided texture features of different thicknesses.
[0050] Step S3: Frequency domain filtering and contrast enhancement Fourier transform: Formula: ; Objective: Convert the image from the spatial domain to the frequency domain, and separate the frequency components of the braided texture (mid-low frequency) and defects (high frequency).
[0051] Band-pass filtering: Parameter: Design a band-pass filter to retain high-frequency components (> 20 cycles / mm) and suppress medium- and low-frequency texture noise.
[0052] Histogram equalization: Expand the gray-scale dynamic range to increase the contrast between the defect area and the normal texture by 30% - 50%.
[0053] Steps S4 - S7: Texture feature quantization and adaptive enhancement Range of gray values: ; Function: Quantify the gray-scale difference within the region. The larger the value, the higher the probability of a defect.
[0054] Local standard deviation: ; Function: Characterize the gray-scale fluctuations around a pixel point and reflect the changes in texture details.
[0055] Linear correction algorithm: ; Parameter: Optimized through experiments, take , to enhance the pixel values in the defect area.
[0056] Steps S8 - S9: Morphological processing and defect localization; Multi-directional morphological operations: Direction of the structural element: Adopt four-direction linear structural elements of 0°, 45°, 90°, and 135° to match the main direction of the woven texture.
[0057] Operation: Enhance the coherence of the defect edge through dilation / erosion processing. For example, the edge clarity of broken wire defects is increased by 40%.
[0058] Connected component analysis and Hough circle detection: Objective: Locate the defect position, calculate parameters such as the area of the connected component and the radius of the circle, and identify defect types such as broken wires and wear.
[0059] Test data: 1. Example of grayscale processing; The RGB values of the pixel point are ( , , ), then the gray value is calculated as follows in the table: ; Table Gray value table:
[0060] 2. Example of Otsu algorithm threshold calculation; The gray-scale distribution of the region is as follows in the table: Table Regional grayscale distribution table:
[0061] Between-class variance: ; Optimal threshold: (corresponding to the maximum between-class variance).
[0062] 3. Results of multi-scale processing of Gaussian pyramid; Table Table of results of multi-scale processing of Gaussian pyramid:
[0063] 4. Frequency-domain filtering and contrast enhancement data; Table Table of frequency-domain filtering and contrast enhancement data:
[0064] 5. Results of linear correction and defect location; Parameters of broken wire defect area: , , , ; Pixel value after correction: ; Table Table of results of linear correction and defect location:
[0065] Implementation optimization: 1. If the texture density is high, the scale of the Gaussian pyramid can be reduced (such as ) to retain details.
[0066] 2. The length of the morphological structure element can be adjusted according to the texture spacing (for example, a spacing of 1 mm corresponds to a structure element length of 5-8 pixels).
[0067] Final conclusion: This detection method effectively suppresses the noise of the woven texture and highlights the defect features through multi-scale image processing, frequency-domain filtering and adaptive enhancement techniques. Combining morphological operations and connected component analysis, it realizes the accurate location of defects. Test data shows that the detection accuracy of this method for defects such as broken wires and wear reaches over 95%, and the processing time of a single image is <100 ms, meeting the real-time detection requirements of industrial production lines.
[0068] The embodiments disclosed in the present invention are preferred embodiments, but not limited thereto. Those of ordinary skill in the art can easily understand the spirit of the present invention based on the above embodiments and make different extensions and changes. However, as long as they do not depart from the spirit of the present invention, they are within the protection scope of the present invention.
Claims
1. A rapid non-destructive detection method for surface defects of data cables based on intelligent image recognition, characterized in that It includes the following steps: S1: Collect the data line image and perform grayscale processing; S2: Construct a multi-scale image pyramid, use an adaptive threshold algorithm to accurately segment the image, and combine the Hough transform to achieve rapid detection of surface defects of the data line; S3: Achieve frequency domain separation of the braided texture and background noise through Fourier transform, combine the band-pass filtering technology to filter out interference, and then use histogram equalization to enhance the defect contrast; S4: Calculate the range and local standard deviation of the grayscale values within the image area to quantify the changes in texture detail features; S5: Compensate for texture grayscale fluctuations through an adaptive filtering algorithm and construct a grayscale histogram; S6: Calculate the grayscale value offset, dynamically adjust the adaptive grayscale mean value and optimize the contrast; S7: Strengthen the feature differences between the texture and defects, and supplement with a linear correction algorithm to extract and optimize features; S8: Use multi-directional structural elements to perform morphological operations, combine connected domain feature analysis, and accurately locate the surface defects of the data line; S9: Use the Canny edge extraction algorithm to perform edge detection on the image after morphological processing, combine the Hough circle detection algorithm, obtain the edge contour of the data line according to the detection results, and achieve the positioning and recognition of surface defects of the braided texture sheath data line through contour analysis.
2. The rapid non-destructive detection method for surface defects of a data cable based on intelligent image recognition according to claim 1, wherein In the step S2, the specific steps are as follows: S201: Adaptive threshold segmentation: Use the Otsu algorithm to perform adaptive threshold segmentation on the grayscale image of the data line, determine the optimal threshold by maximizing the between-class variance, and divide the image into a foreground area and a background area. The formula is: ; In the formula, represents the candidate threshold, represents the probability of foreground pixels under the threshold, represents the probability of background pixels under the threshold, represents the mean value of foreground pixels, represents the mean value of background pixels, is the optimal threshold, represents returning the parameter value that makes the objective function reach the maximum value; S202: Gaussian pyramid multi-scale decomposition: Introduce Gaussian pyramid multi-scale decomposition for each foreground segmentation area, generate image pyramids of different scales, perform Canny edge detection and circular fitting respectively, and obtain multi-scale circular foreground segmentation areas.
3. A rapid non-destructive detection method for surface defects of data cables based on intelligent image recognition according to claim 2, characterized in that, In the step S3, the following steps are further included: S301: Two-dimensional Fourier transform: Perform two-dimensional Fourier transform on each multi-scale circular foreground segmentation area to convert the image from the spatial domain to the frequency domain; S302: Band-pass frequency domain filtering: Use band-pass filtering instead of low-pass filtering. By analyzing the frequency domain distribution of the braided texture, design a band-pass filter to retain the high-frequency components corresponding to the defect features and suppress the medium-low frequency components corresponding to the texture noise. The frequency domain filtering function is defined as: ; In the formula, represents the lowest spatial frequency threshold allowed to pass in the frequency domain, is the highest spatial frequency threshold of the image; S303: Inverse Fourier transform: Perform inverse Fourier transform on the image after frequency domain filtering to convert the image back to the spatial domain and obtain a circular foreground segmentation image that suppresses texture noise and enhances defect features.
4. The rapid non-destructive detection method for surface defects of a data cable based on intelligent image recognition according to claim 3, wherein In the step S4, the following steps are further included: S401: Calculation of gray value range: For the pixel points on the th enhanced circular foreground segmentation image, the gray value range of the circular foreground segmentation area where it is located is: , where represents the set composed of the gray values of all pixel points within the th circular area centered on the pixel point , and and are the maximum gray value and the minimum gray value in the set respectively; S402: Local standard deviation calculation: Reflect the fluctuation degree of the grayscale values around the pixel points through the local standard deviation.
5. A rapid non-destructive detection method for surface defects of data cables based on intelligent image recognition according to claim 4, characterized in that, In the step S5, the following steps are further included: S501: Texture grayscale mean correction: Before calculating the grayscale histogram, perform texture grayscale mean correction on each circular foreground area; S502: Grayscale histogram construction: The grayscale histogram of the enhanced circular foreground segmentation image is as follows: ; In the formula, represents the th circular foreground segmentation region in which the pixel statistic with gray level is represents the th circular foreground segmentation region, represents the gray level, is the indicator function.
6. The rapid non-destructive detection method for surface defects of a data cable based on intelligent image recognition according to claim 5, wherein, In the step S6, the following steps are further included: S601: Grayscale value offset calculation: Calculate the grayscale value offset based on the maximum value and the minimum value of the grayscale levels in the grayscale histogram, as well as the difference between the grayscale extreme values; S602: Adaptive grayscale mean: Combine the grayscale value offset and the local standard deviation to calculate the adaptive grayscale mean; S603: Enhance contrast: Enhance the image contrast by adjusting the grayscale value range.
7. A rapid non-destructive detection method for surface defects of data cables based on intelligent image recognition according to claim 6, characterized in that, In step S7, it specifically includes the following: linear correction is performed according to the local standard deviation, gray value range, enhanced contrast, and texture-defect difference coefficient of the pixel points.
8. A rapid non-destructive detection method for surface defects of data cables based on intelligent image recognition according to claim 7, characterized in that In the said step S8, the following steps are further included: S801: Direction-adjustable morphological processing: In morphological processing, a direction-adjustable linear structural element is adopted, and the structural element in the corresponding direction is selected according to the main direction of the braided texture for dilation processing and erosion processing; 802: Connected component analysis: For each first circular foreground segmentation image after morphological processing, multiple connected components are obtained, and edge detection is performed on each connected component to obtain the edge image of each connected component.
Citation Information
Cited By
Shallow layer defect detection method and device based on phase residual error and storage medium
CN120471917A
A shallow defect detection method and device based on phase residual and a storage medium
CN120471917B
Surface process defect detection method and system for copper foil production
CN120543548A
Surface process defect detection method and system for copper foil production
CN120543548B
Tube wall defect detection method for hypotube processing
CN120580238A