X-ray-based high-voltage cable buffer layer ablation defect detection method and device
By using a high-stability X-ray source and a high-resolution detector combined with an image processing algorithm, the noise and artifact problems in X-ray detection are solved, and accurate detection and automatic identification of high-voltage cable buffer layer defects are achieved.
Patent Information
- Application Number
- CN202510363752.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-26
- Publication Date
- 2025-08-22
AI Technical Summary
In the detection of high-voltage cable buffer layer, existing X-ray detection technology is susceptible to environmental noise, scattered rays and equipment instability, poor image quality, and large data volumes, and difficult to quickly and accurately determine the type of fault.
The more stable X-ray source COMET ray source iXRS-450X and high-resolution low-noise detector VAREX XRD 1621 surface array detector are used, combining rotation detection ring and image processing algorithms, including median filtering, Wiener filtering and iterative threshold segmentation to remove salt and pepper noise and automatically identify defects.
Improve image quality, reduce noise and artifacts, ensure detection accuracy and visualization, and enable automatic identification of defect types and locations.
Smart Images

Figure CN120522201A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cable defect detection, and in particular to an X-ray-based method for detecting ablation defects in a high-voltage cable buffer layer. Background Art
[0002] Cross-linked polyethylene (XLPE) insulated cables have become a mainstream choice for urban power transmission projects due to their excellent electrical and mechanical properties, simple manufacturing process, and easy installation and maintenance. In recent years, numerous cable defects caused by buffer layer erosion have occurred in cities both domestically and internationally. Damage or defects in the buffer layer, such as erosion, wear, or cracks, can lead to more serious cable failures, even fires or power outages. Therefore, regular inspection of the buffer layer of high-voltage cables is crucial to maintaining the normal operation of power systems.
[0003] Current methods for detecting ablation defects in high-voltage cable buffer layers include ultrasonic testing, infrared thermal imaging, capacitance imaging, high-frequency electromagnetic testing, and X-ray testing. Ultrasonic testing uses sound waves to penetrate the cable's buffer and insulation layers to detect internal ablation, voids, or delamination defects. Ultrasonic waves propagating through the material are reflected at the defect, and analysis of the echo signal can determine the defect's location and size. Infrared thermal imaging detects differences in heat distribution between the cable's surface and interior to identify areas of overheating or ablation. Ablation defects affect the cable's internal thermal conductivity, leading to localized temperature anomalies. Infrared thermal imaging cameras can detect these temperature anomalies contactlessly. Capacitance imaging detects defects by analyzing changes in capacitance across different cable sections. Buffer layer ablation causes changes in the material's electrical properties, which can be detected using capacitance imaging equipment. High-frequency electromagnetic testing uses high-frequency electromagnetic waves to penetrate non-conductive materials, identifying changes in their electromagnetic properties caused by ablation or delamination, thereby detecting ablation defects in non-conductive materials such as cable buffer layers. X-ray testing uses radiation to penetrate the cable and image its interior, effectively identifying internal ablation defects, pores, or changes in material density. In contrast, CT scanning can generate three-dimensional images, providing more precise internal defect location and morphological analysis.
[0004] Compared with infrared testing, ultrasonic testing, magnetic particle testing, and eddy current testing, the X-ray-based high-voltage cable buffer layer ablation defect detection method has the following advantages:
[0005] 1. Non-contact and non-destructive testing:
[0006] X-ray inspection is a completely non-contact inspection technology that does not require direct contact with the material being inspected. Therefore, it has no impact on the surface of the workpiece and will not cause mechanical damage or deformation to the workpiece. This makes it particularly suitable for high-value or sensitive materials or parts, such as those in aerospace, electronic components, and other fields.
[0007] 2. Visualize the internal structure:
[0008] Unlike many other inspection technologies, X-rays can penetrate the surface of materials and directly visualize the internal structure. This makes it an important tool for discovering internal defects (such as pores, cracks, and inclusions) in materials or parts without destroying the sample.
[0009] 3. Applicable to various materials:
[0010] X-ray inspection is applicable to a wide range of materials, including metals, non-metals, composites, plastics, and ceramics. Especially when inspecting materials with varying densities, X-rays can clearly reveal differences in their internal structures. Compared to high-frequency electromagnetic testing (which is only applicable to non-conductive materials), X-rays offer greater versatility in material selection.
[0011] 4. Wide detection range:
[0012] Compared to infrared thermal imaging testing (which relies on surface temperature differences), X-rays have excellent penetration capabilities and can detect materials ranging from a few millimeters to several meters thick (depending on the energy of the X-ray source). This flexibility in the detection depth range gives it a unique advantage when detecting ablation defects in the buffer layer of high-voltage cables through the cable outer sheath and aluminum sheath.
[0013] However, in actual applications, the use of X-rays to detect high-voltage cable buffer faults often encounters the following three problems:
[0014] (1) Affected by environmental noise, scattered rays and equipment instability, noise or artifacts appear in the image, interfering with the accurate judgment of defects;
[0015] (2) When X-rays penetrate a thick cable buffer layer, the signal may be significantly attenuated, resulting in reduced image quality and affecting detection accuracy;
[0016] (3) X-ray detection generates a large amount of data, especially the processing and analysis of 3D imaging data, which requires high-performance computing equipment and professional image reconstruction algorithms. There is a lack of algorithmic support for complex imaging methods, making it difficult for maintenance personnel to make effective judgments on the imaging results in the first place.
[0017] Therefore, it is necessary to combine effective imaging optimization technology with the special scenario of high-voltage cable buffer layer detection to deal with problems arising in practical applications. Summary of the Invention
[0018] The purpose of the present invention is to provide an X-ray-based method for detecting ablation defects in the buffer layer of a high-voltage cable. By selecting a more stable X-ray source and a detector with higher resolution and lower noise, the fluctuation of X-ray intensity is reduced to capture more accurate images, thereby improving common problems in practical applications such as poor imaging effects and many artifacts that make it impossible for operators to accurately determine the type of fault during the detection process of general X-ray detection equipment.
[0019] In order to solve the above-mentioned technical problems, the present invention is achieved as follows:
[0020] The present invention provides an X-ray-based high-voltage cable buffer layer ablation defect detection device, comprising: an X-ray source, a detector, a rotating detection ring, a cable fixing and supporting device, a control and data processing platform, and a mobile device, wherein the X-ray source and the detector are respectively fixed on the rotating detection ring and arranged relative to each other; the rotating detection ring is rotatably mounted on the mobile device; the cable fixing and supporting device is mounted on the mobile device and arranged in parallel with the rotating detection ring; the control and data processing platform is electrically connected to the X-ray source, the detector, and the rotating detection ring.
[0021] Optionally, the X-ray source is a COMET ray source iXRS-450X.
[0022] Optionally, the detector is a VAREX XRD 1621 area array detector.
[0023] The present invention provides a method for detecting ablation defects of a high-voltage cable buffer layer based on an X-ray, based on the above-mentioned high-voltage cable buffer layer ablation defect detection device based on an X-ray, comprising the following steps:
[0024] Step S1, passing the high-voltage cable to be tested through the rotating detection ring and supporting it with a cable fixing and supporting device;
[0025] Step S2: setting the X-ray source parameters and detector acquisition parameters according to the material, size and detection requirements of the high-voltage cable;
[0026] Step S3, emitting X-rays to the high-voltage cable through an X-ray source, receiving the X-rays that pass through the high-voltage cable through a detector, and converting the received X-rays into image data;
[0027] Step S4, determining whether the suspected salt and pepper noise point in the image data is a salt and pepper noise point, and if so, executing step S5;
[0028] Step S5, performing median filtering on the salt and pepper noise points and outputting a preliminary filtered image;
[0029] Step S6, performing Wiener filtering on the preliminary filtered image to output a grayscale image;
[0030] Step S7, using an iterative threshold segmentation method to perform defect image segmentation on the grayscale image;
[0031] Step S8: Automatically identify defects and faults on the segmented defective images.
[0032] Preferably, the X-ray source is a COMET ray source iXRS-450X; and the detector is a VAREX XRD 1621 area array detector.
[0033] Preferably, in step S3, converting the received X-rays into image data specifically includes:
[0034] The received X-rays are converted into electrical signals by the detector;
[0035] Amplification is performed by a signal amplification unit composed of a low noise amplifier and an adjustable gain amplifier;
[0036] The amplified electrical signal is converted into a corresponding digital signal through an analog-to-digital conversion unit;
[0037] An image reconstruction algorithm is used to generate image data corresponding to the high-voltage cable from the digital signal.
[0038] Preferably, in step S4, determining whether the suspected salt and pepper noise point in the image data is a salt and pepper noise point specifically includes:
[0039] In step S41, the following formula is used to preliminarily determine whether the suspected salt and pepper noise point in the image data is a salt and pepper noise point. If it is preliminarily determined to be a salt and pepper noise point, step S42 is executed:
[0040]
[0041] Where (x, y) represents the center pixel; f(x, y) represents the grayscale value; A is the point preliminarily determined to be salt and pepper noise; B is the non-salt and pepper noise point; Min[f(x, y)] is the minimum grayscale value in the selected window; Max[f(x, y)] is the maximum grayscale value in the selected window;
[0042] Step S42: performing neighborhood grayscale difference analysis on each salt and pepper noise point one by one to determine whether the grayscale difference exceeds a grayscale difference judgment threshold. If so, the point is a salt and pepper noise point; if not, the point is a non-salt and pepper noise point.
[0043] Preferably, step S42 specifically includes:
[0044] Step S421: defining a grayscale difference judgment threshold t to determine whether the grayscale value of the central salt and pepper noise point is significantly different from that of other salt and pepper noise points in its neighborhood;
[0045] Step S422: Calculate the grayscale difference judgment threshold t using the following formula:
[0046]
[0047] Step S423, calculate the grayscale difference d between the central salt and pepper noise point and other salt and pepper noise points in its neighborhood by the following formula: ij :
[0048] d ij =∑∑|f(x+i,y+i)-f(x,y)|;
[0049] Step S424, determine the grayscale difference d ij Is it greater than the grayscale difference judgment threshold t? If so, execute step S425; if not, return to execute step S423;
[0050] Step S425: Determine the grayscale difference d between the central salt and pepper noise point and other salt and pepper noise points in its neighborhood. ij Is the number P greater than the grayscale difference judgment threshold t greater than or equal to 5? If so, the central salt and pepper noise point is judged to be a salt and pepper noise point; if not, the central salt and pepper noise point is judged to be a non-salt and pepper noise point.
[0051] Preferably, step S7 specifically includes:
[0052] Step S71, specifying the threshold difference d, and then setting the initial threshold T0 for dividing a grayscale image into foreground and background parts; wherein the initial threshold T0 is the maximum grayscale value X in a grayscale image. max and the grayscale minimum value X min The average value is expressed as follows:
[0053]
[0054] In step S72, the average grayscale values of the foreground and background are calculated respectively, and then a new threshold value is calculated, which is expressed as follows:
[0055]
[0056] Among them, T1 is the new threshold iterated after improvement; the average grayscale values of the foreground and background are represented as Z0 and Z1 respectively;
[0057] Step S73, determining whether the difference between the initial threshold value T0 and the new threshold value T1 is less than the threshold difference d; if the difference is greater than d, executing step S64; if the difference is less than d, executing step S65;
[0058] Step S74: Using the new threshold value T1 as the new threshold value, continue to repeat steps S72 and S73;
[0059] In step S75 , the new threshold value T1 is used as the final threshold value for segmentation, thereby obtaining a defect image segmented by the iterative threshold segmentation method.
[0060] Preferably, after step S8, the following steps are further included:
[0061] Step S9: Mark the type, location, and size of the defect in detail and generate a test report;
[0062] Step S10: storing the detection report.
[0063] Compared with the prior art, the present invention has the following beneficial effects:
[0064] 1. The present invention realizes effective image reconstruction, which can remove salt and pepper noise to the greatest extent while retaining as much original details and edge information of the cable image as possible, effectively improving the image quality and reducing noise and artifacts.
[0065] 2. The present invention effectively avoids the equalization of low-frequency areas affecting the effective information enhancement effect of the image, thereby improving the visualization effect of the image.
[0066] 3. The present invention makes a reasonable judgment on the degree of image noise and can eliminate artifacts caused by the non-uniformity of the detection equipment.
[0067] 4. The present invention can accurately extract defect features and automatically identify defect types based on image features to facilitate operators to better handle faults. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. Those skilled in the art can also derive other drawings based on these drawings without inventive work, among which:
[0069] Figure 1 Schematic diagram of the structure of the X-ray-based high-voltage cable buffer layer ablation defect detection device provided by the present invention;
[0070] Figure 2 Schematic diagram of the process of the X-ray-based high-voltage cable buffer layer ablation defect detection method provided by the present invention;
[0071] Figure 3 This is a grayscale difference analysis flow chart provided by the present invention. DETAILED DESCRIPTION
[0072] The following will clearly and completely describe the technical solutions of the present invention in conjunction with the present invention. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.
[0073] See Figure 1 As shown, the present invention provides an X-ray-based high-voltage cable buffer layer ablation defect detection device, comprising: an X-ray source 1, a detector 2, a rotating detection ring 3, a cable fixing and supporting device 4, a control and data processing platform 5, and a mobile device 6. The X-ray source 1 and the detector 2 are respectively fixed on the rotating detection ring 3 and arranged relatively spaced apart; the rotating detection ring 3 is rotatably mounted on the mobile device 6; the cable fixing and supporting device 4 is mounted on the mobile device 6 and arranged in parallel with the rotating detection ring 3; the control and data processing platform 5 is electrically connected to the X-ray source 1, the detector 2, and the rotating detection ring 3.
[0074] The device operates as follows: After activating the X-ray source 1, the rays penetrate the cable, and the detector 2 receives the rays and generates an image. A rotating detection ring 3 rotates the X-ray source 1 and detector 2 during the inspection process, acquiring comprehensive information about the internal structure of the cable's buffer layer from multiple angles. The control panel of the control and data processing platform 5 allows the operator to adjust the X-ray source 1's intensity and detection angle based on the specific requirements of the cable, ensuring clear and accurate imaging.
[0075] In a specific embodiment, in order to improve common problems in actual applications such as poor imaging effects and numerous artifacts that make it impossible for operators to accurately determine the type of fault during the inspection process of general X-ray inspection equipment, in this application, the X-ray source 1 is a more stable COMET ray source iXRS-450X, and the detector 2 is a VAREX XRD 1621 type array detector with higher resolution and low noise, thereby reducing the fluctuation of X-ray intensity and capturing more accurate images.
[0076] Recombination Figure 2 As shown, the present invention provides a method for detecting ablation defects of a high-voltage cable buffer layer based on an X-ray based high-voltage cable buffer layer ablation defect detection device, comprising the following steps:
[0077] Step S1: Pass the high-voltage cable to be tested through the rotating detection ring 3 and support it with the cable fixing and supporting device 4;
[0078] Step S2, setting the parameters of the X-ray source 1 and the acquisition parameters of the detector according to the material, size and detection requirements of the high-voltage cable;
[0079] Step S3, X-ray source 1 emits X-rays to the high-voltage cable, and detector 2 receives the X-rays that pass through the high-voltage cable and converts the received X-rays into image data;
[0080] Step S4, determining whether the suspected salt and pepper noise point in the image data is a salt and pepper noise point, and if so, executing step S5;
[0081] Step S5, performing median filtering on the salt and pepper noise points and outputting a preliminary filtered image;
[0082] Step S6, performing Wiener filtering on the preliminary filtered image to output a grayscale image;
[0083] Step S7, using an iterative threshold segmentation method to perform defect image segmentation on the grayscale image;
[0084] Step S8, automatically identifying defects and faults on the segmented defect image;
[0085] Step S9: Mark the type, location, and size of the defect in detail and generate a test report;
[0086] Step S10: storing the detection report.
[0087] In step S3, converting the received X-rays into image data specifically includes:
[0088] The received X-rays are converted into electrical signals by the detector;
[0089] Amplification is performed by a signal amplification unit composed of a low noise amplifier and an adjustable gain amplifier;
[0090] The amplified electrical signal is converted into a corresponding digital signal through an analog-to-digital conversion unit;
[0091] An image reconstruction algorithm is used to generate image data corresponding to the high-voltage cable from the digital signal.
[0092] Recombination Figure 3 As shown, in step S4, determining whether the suspected salt and pepper noise point in the image data is a salt and pepper noise point specifically includes:
[0093] In step S41, the following formula is used to preliminarily determine whether the suspected salt and pepper noise point in the image data is a salt and pepper noise point. If it is preliminarily determined to be a salt and pepper noise point, step S42 is executed:
[0094]
[0095] Where (x, y) represents the center pixel; f(x, y) represents the grayscale value; A is the point preliminarily determined to be salt and pepper noise; B is the non-salt and pepper noise point; Min[f(x, y)] is the minimum grayscale value in the selected window; Max[f(x, y)] is the maximum grayscale value in the selected window;
[0096] Step S42: performing neighborhood grayscale difference analysis on each salt and pepper noise point one by one to determine whether the grayscale difference exceeds a grayscale difference judgment threshold. If so, the point is a salt and pepper noise point; if not, the point is a non-salt and pepper noise point.
[0097] Further, step S42 specifically includes:
[0098] Step S421: defining a grayscale difference judgment threshold t to determine whether the grayscale value of the central salt and pepper noise point is significantly different from that of other salt and pepper noise points in its neighborhood;
[0099] Step S422: Calculate the grayscale difference judgment threshold t using the following formula:
[0100]
[0101] Step S423, calculate the grayscale difference d between the central salt and pepper noise point and other salt and pepper noise points in its neighborhood by the following formula: ij :
[0102] d ij =∑∑|f(x+i,y+i)-f(x,y)|;
[0103] Step S424, determine the grayscale difference d ij Is it greater than the grayscale difference judgment threshold t? If so, execute step S425; if not, return to execute step S423;
[0104] Step S425: Determine the grayscale difference d between the central salt and pepper noise point and other salt and pepper noise points in its neighborhood. ij Is the number P greater than the grayscale difference judgment threshold t greater than or equal to 5? If so, the central salt and pepper noise point is judged to be a salt and pepper noise point; if not, the central salt and pepper noise point is judged to be a non-salt and pepper noise point.
[0105] This application targets salt and pepper noise points by combining median filtering and Wiener filtering, which not only removes salt and pepper noise and Gaussian noise to the greatest extent possible, but also preserves as much of the original details and edge information of the cable image as possible. By combining the two different filtering methods, when removing noise from the cable image, it is possible to distinguish which pixels are contaminated by salt and pepper noise. Different filtering methods can be used to process different noise points, thus achieving an ideal filtering effect and achieving high-quality processing results for mixed noise.
[0106] Step S7 specifically includes:
[0107] Step S71, specifying the threshold difference d, and then setting the initial threshold T0 for dividing a grayscale image into foreground and background parts; wherein the initial threshold T0 is the maximum grayscale value X in a grayscale image. max and the grayscale minimum value X min The average value is expressed as follows:
[0108]
[0109] In step S72, the average grayscale values of the foreground and background are calculated respectively, and then a new threshold value is calculated, which is expressed as follows:
[0110]
[0111] Among them, T1 is the new threshold iterated after improvement; the average grayscale values of the foreground and background are represented as Z0 and Z1 respectively;
[0112] Step S73, determining whether the difference between the initial threshold value T0 and the new threshold value T1 is less than the threshold difference d; if the difference is greater than d, executing step S64; if the difference is less than d, executing step S65;
[0113] Step S74: Using the new threshold value T1 as the new threshold value, continue to repeat steps S72 and S73;
[0114] In step S75 , the new threshold value T1 is used as the final threshold value for segmentation, thereby obtaining a defect image segmented by the iterative threshold segmentation method.
[0115] Furthermore, in step S7, the iterative threshold segmentation method is an iterative threshold segmentation morphological processing algorithm, which uses morphological operations such as erosion, dilation, opening, and closing to extract defect features from tiny points. Dilation and erosion are a pair of dual operations. The opening operation is to erode the image first and then dilate it. It is mainly used to separate objects in fine areas and eliminate isolated points, and smooth the target image without significantly changing the boundary range. Conversely, the closing operation first dilates the target image and then erodes it. Through morphological operations, the cable defect image is filtered out of isolated points while the original defect features are nearly unchanged, so that the cable defect image meets the feature extraction standards.
[0116] In step S8, the segmented defect image is automatically identified for defect faults, including but not limited to ablation, cracks, bubbles or cavities, foreign matter inclusions, and delamination.
[0117] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0118] Furthermore, it should be noted that the scope of the methods and characterization methods in the embodiments of the present invention is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in reverse order depending on the functions involved. For example, the described methods may be performed in an order different from that described, and various steps may be added, omitted, or combined. In addition, features described with reference to certain examples may be combined in other examples.
[0119] The above describes the embodiments of the present invention, but the present invention is not limited to the above specific implementation methods. The above specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are protected by the present invention.
Claims
1. An X-ray based high voltage cable buffer layer ablation defect detection device, characterized in that: include: An X-ray source, a detector, a rotating detection ring, a cable fixing and supporting device, a control and data processing platform, and a mobile device. The X-ray source and the detector are respectively fixed on the rotating detection ring and arranged relative to each other; the rotating detection ring is rotatably installed on the mobile device; the cable fixing and supporting device is installed on the mobile device and arranged in parallel with the rotating detection ring; the control and data processing platform is electrically connected to the X-ray source, the detector, and the rotating detection ring.
2. The X-ray-based high-voltage cable buffer layer ablation defect detection device according to claim 1, characterized in that: The X-ray source is the COMET ray source iXRS-450X.
3. The X-ray-based high-voltage cable buffer layer ablation defect detection device according to claim 1, characterized in that: The detector is a VAREX XRD 1621 area array detector.
4. A method for detecting ablation defects of a high-voltage cable buffer layer based on an X-ray based high-voltage cable buffer layer ablation defect detection device according to any one of claims 1 to 3, characterized in that: The steps include: Step S1, passing the high-voltage cable to be tested through the rotating detection ring and supporting it with a cable fixing and supporting device; Step S2: setting the X-ray source parameters and detector acquisition parameters according to the material, size and detection requirements of the high-voltage cable; Step S3, emitting X-rays to the high-voltage cable through an X-ray source, receiving the X-rays that pass through the high-voltage cable through a detector, and converting the received X-rays into image data; Step S4, determining whether the suspected salt and pepper noise point in the image data is a salt and pepper noise point, and if so, executing step S5; Step S5, performing median filtering on the salt and pepper noise points and outputting a preliminary filtered image; Step S6, performing Wiener filtering on the preliminary filtered image to output a grayscale image; Step S7, using an iterative threshold segmentation method to perform defect image segmentation on the grayscale image; Step S8: Automatically identify defects and faults on the segmented defective images.
5. The method according to claim 4, characterized in that The X-ray source is a COMET ray source iXRS-450X; the detector is a VAREX XRD 1621 area array detector.
6. The method according to claim 4, characterized in that In step S3, converting the received X-rays into image data specifically includes: The received X-rays are converted into electrical signals by the detector; Amplification is performed by a signal amplification unit composed of a low noise amplifier and an adjustable gain amplifier; The amplified electrical signal is converted into a corresponding digital signal through an analog-to-digital conversion unit; An image reconstruction algorithm is used to generate image data corresponding to the high-voltage cable from the digital signal.
7. The method according to claim 6, characterized in that In step S4, determining whether the suspected salt and pepper noise point in the image data is a salt and pepper noise point specifically includes: In step S41, the following formula is used to preliminarily determine whether the suspected salt and pepper noise point in the image data is a salt and pepper noise point. If it is preliminarily determined to be a salt and pepper noise point, step S42 is executed: Where (x, y) represents the center pixel; f(x, y) represents the grayscale value; A is the point preliminarily determined to be salt and pepper noise; B is the non-salt and pepper noise point; Min[f(x, y)] is the minimum grayscale value in the selected window; Max[f(x, y)] is the maximum grayscale value in the selected window; Step S42: performing neighborhood grayscale difference analysis on each salt and pepper noise point one by one to determine whether the grayscale difference exceeds a grayscale difference judgment threshold. If so, the point is a salt and pepper noise point; if not, the point is a non-salt and pepper noise point.
8. The method according to claim 7, characterized in that Step S42 specifically includes: Step S421: defining a grayscale difference judgment threshold t to determine whether the grayscale value of the central salt and pepper noise point is significantly different from that of other salt and pepper noise points in its neighborhood; Step S422: Calculate the grayscale difference judgment threshold t using the following formula: Step S423, calculate the grayscale difference d between the central salt and pepper noise point and other salt and pepper noise points in its neighborhood by the following formula: ij : d ij =∑∑|f(x+i,y+i)-f(x,y)|; Step S424, determine the grayscale difference d ij Is it greater than the grayscale difference judgment threshold t? If so, execute step S425; if not, return to execute step S423; Step S425: Determine the grayscale difference d between the central salt and pepper noise point and other salt and pepper noise points in its neighborhood. ij Is the number P greater than the grayscale difference judgment threshold t greater than or equal to 5? If so, the central salt and pepper noise point is judged to be a salt and pepper noise point; if not, the central salt and pepper noise point is judged to be a non-salt and pepper noise point.
9. The method according to claim 8, characterized in that Step S7 specifically includes: Step S71, specifying the threshold difference d, and then setting the initial threshold T0 for dividing a grayscale image into foreground and background parts; wherein the initial threshold T0 is the maximum grayscale value X in a grayscale image. max and the grayscale minimum value X min The average value is expressed as follows: In step S72, the average grayscale values of the foreground and background are calculated respectively, and then a new threshold value is calculated, which is expressed as follows: Among them, T1 is the new threshold iterated after improvement; the average grayscale values of the foreground and background are represented as Z0 and Z1 respectively; Step S73, determining whether the difference between the initial threshold value T0 and the new threshold value T1 is less than the threshold difference d; if the difference is greater than d, executing step S64; if the difference is less than d, executing step S65; Step S74: Using the new threshold value T1 as the new threshold value, continue to repeat steps S72 and S73; In step S75 , the new threshold value T1 is used as the final threshold value for segmentation, thereby obtaining a defect image segmented by the iterative threshold segmentation method.
10. The method according to claim 8, characterized in that After step S8, the following steps are also included: Step S9: Mark the type, location, and size of the defect in detail and generate a test report; Step S10: storing the detection report.