Steel surface defect image high-speed detection method based on local annular comparison
Through the detection method based on local annular contrast, the problem that the prior art cannot effectively detect regional defects on the steel surface is solved, and accurate detection of longitudinal and regional defects is achieved, which simplifies the detection process and reduces the computational complexity.
Patent Information
- Application Number
- CN202510073088.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-17
- Publication Date
- 2025-05-13
AI Technical Summary
The existing steel surface defect detection algorithm can only detect longitudinal defects, such as gaps and scratches, and cannot effectively detect regional defects, such as pits, and morphological methods are difficult to remove noise under the roughness of the steel surface.
The high-speed detection method of steel surface defect image based on local annular contrast is adopted. By taking photos and collecting and greying the image, the average value of each column of pixels is calculated, the difference threshold between the background and the steel surface is preset, the background image is removed, the mean filtering and local annular contrast processing are performed, the defective pixel points are identified, and the surface defects of steel are extracted.
It realizes accurate detection of longitudinal and regional defects of steel surfaces, reduces calculation complexity, simplifies the detection process, is suitable for online inspection, and has great application potential.
Smart Images

Figure CN119991607A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a computer vision image processing method, and in particular to a high-speed detection method for steel surface defect images based on local annular contrast. Background Art
[0002] During the hot rolling process, the detection of steel surface quality is of great significance. Due to the high speed and high temperature conditions, traditional non-destructive testing technology cannot work effectively. In recent years, more and more steel mills tend to use machine vision technology to detect defects on the steel surface in real time. It can quickly detect abnormal images, thereby greatly reducing the amount of data that needs to be processed in subsequent steps, thus saving a lot of time.
[0003] Through the existing technical search, it is found that there are mainly the following methods: using edge-preserving filtering technology and adopting a double threshold method to detect defects in wound high-speed steel; using the theory of support vector machine (SVM) to detect gap defects on the surface of steel; using Snake projection and discrete wavelet transform methods to detect gap defects.
[0004] Although the above three algorithms are less time-consuming, they can only detect longitudinal defects such as gaps and scratches. For some regional defects, such as pits, these algorithms cannot effectively detect them. Morphology is also used to detect steel defects in real time, but when using it, the shape and size of the template are difficult to determine. In addition, due to the roughness of the steel surface, the morphological method cannot remove noise that is shaped like block spots.
[0005] From the above content, it can be seen that the existing algorithms can only detect certain specific types of steel surface defects, so there is an urgent need to study a detection algorithm with good versatility. Summary of the invention
[0006] In order to solve the problems existing in the background technology, the purpose of the present invention is to provide a high-speed detection method for steel surface defect images based on local annular contrast. Compared with the background technology, the recognition method is simpler, the surface defect detection effect is better and the object practicability is wider.
[0007] The present invention is a real-time detection algorithm for steel surface defects, which can accurately detect regional and longitudinal defects and save time.
[0008] The steps of the technical solution adopted by the present invention to solve its technical problem are as follows:
[0009] 1) Take photos of the steel surface and convert it into grayscale to obtain the original grayscale image Image source , calculate the original image Image source The pixel mean of each column of pixels;
[0010] 2) Preset the difference threshold T between the background pixels and the steel surface pixels B , and according to the pixel mean and difference threshold T of each column of pixels B In the original image Image source Find the left boundary B l and right boundary B r ;
[0011] 3) According to the left boundary B l and right boundary B r , in the original image Image source Remove the background image and extract the detection image Image detect ;
[0012] 4) Detection image Image detect Perform mean filtering and local ring contrast processing to obtain defective pixels;
[0013] 5) Obtain the detection image Image based on the defective pixels detect The steel surface defects in the image are also used as the original image Image source Surface defects of steel.
[0014] The step 1) is specifically as follows:
[0015]
[0016] Where: M j —Original Image source The pixel mean of the jth column; m—original image Image source The number of rows, i.e. the height of the image; g ij —Original Image source The gray value of the pixel in the i-th row and j-th column;
[0017] Use the above formula to loop and obtain the pixel mean of each column.
[0018] In step 2), the left boundary is obtained by processing in the following manner:
[0019] Traverse the original image Image from left to right source For each column of pixels in , for each current j-th column pixel, use the following formula to determine whether it satisfies:
[0020] M j+1 -M j-1 >T B
[0021] M j+1 +M j+2 -M j-1 -Mj-2 >2×T B
[0022] Where: M j+1 —The mean value of the pixels in the j+1th column; M j+2 、M j-1 and M j-2 Same meaning as above; T B —The difference threshold between the pixels of the background and the pixels of the steel surface;
[0023] If the current j-th column pixel satisfies the above two formulas, the current j-th column pixel is used as the left boundary B l = j; thus looping from right to left to determine each column j, locating to the right boundary B r =j.
[0024] If the current j-th column pixel does not satisfy the above two formulas, the current j-th column pixel will not be processed;
[0025] For the two columns of pixels at the left and right edges of the image, in the above calculation process, the pixels and their values in the missing columns are not involved in the calculation.
[0026] In step 3), the right boundary is obtained by processing in the following manner:
[0027] Traverse the original image Image from left to right source For each column of pixels in , for each current j-th column pixel, use the following formula to determine whether it satisfies:
[0028] M j-1 -M j+1 >T B
[0029] M j-1 +M j-2 -M j+1 -M j+2 >2×T B
[0030] Where: M j-1 —The mean value of the pixels in the j-1th column; M j+1 、M j-2 and M j+2 Same meaning as above; T B —The difference threshold between the pixels of the background and the pixels of the steel surface;
[0031] If the current j-th column pixel satisfies the above two formulas, the current j-th column pixel is used as the right boundary B r = j; thus looping from right to left to determine each column j, locating to the right boundary B r =j.
[0032] If the current j-th column pixel does not satisfy the above two formulas, the current j-th column pixel is not processed.
[0033] For the two columns of pixels at the left and right edges of the image, in the above calculation process, the pixels and their values in the missing columns are not involved in the calculation.
[0034] The step 3) is specifically as follows: source , extract the left boundary B l and right boundary B r The image area between is used as the detection image Image detect . Except for the left boundary B l and right boundary B r The image area outside the image area between is the background image.
[0035] The step 4) is specifically as follows: 4.1) detecting the image Image detect Perform 5x5 mean filtering;
[0036] 4.2) Filtered detection image Image detect Perform local annular traversal processing, traverse each pixel and determine whether it is a defect mark point;
[0037] 4.3) Re-traverse the detection image Image according to the defect marking point of each pixel detect For each pixel in the adjacent area, the pixel whose mark point count value exceeds the preset threshold is taken as the defective pixel point, thereby obtaining the defective pixel point.
[0038] The step 4.2) is specifically as follows:
[0039] 4.2.1) Traverse each pixel as the center point c to obtain the pixel mean S of its neighboring points c :
[0040] In step 4.2.1), the current pixel is used as the center point c, and a circle is established to obtain the neighboring points of each center point c and their pixel means.
[0041] A circle with the center point c as the center and a radius of R is established. All pixels on the circle are taken as the neighboring points of the center point c. A total of P neighboring points are obtained, and then the pixel mean of all neighboring points of the center point c is calculated:
[0042]
[0043] Where: S c —The pixel mean of the neighboring points of the center point c; P—the number of neighboring points; k—the index of the neighboring point; g—the number of neighboring points; k —Grayscale value of neighboring pixels;
[0044] 4.2.2) According to the pixel mean S of the neighboring points of the center point c c Calculate and process to obtain the defect gray value threshold T of the current center point c c :
[0045] According to the pixel mean S c Calculate the correction factor A according to the following formula c Then the defect gray value threshold T is obtained c :
[0046] A c =1-0.0016×S c
[0047] T c =S c ×A c
[0048] Where: A c —Correction factor, T c —Defect gray value threshold;
[0049] 4.2.3) According to the defect gray value threshold T c The center point c is judged and assigned a value to locate the defect mark point:
[0050] First, calculate the mark value of the center point c according to the following formula:
[0051]
[0052] Where: F c —The center point c is the mark value of the defect mark point; g c —Grayscale value of the center point c;
[0053] Then make a judgment:
[0054] When F c =1, the pixel at the center point c is used as the defect marking point;
[0055] When F c When =0, the pixel at the center point c is not a defect mark point.
[0056] In the above calculation process, for the pixels at the edge of the image, the pixels at the vacant positions outside the image on the circle line do not participate in the calculation.
[0057] In step 4.3), the current pixel is taken as the center point c and the following processing is performed:
[0058] 4.3.1) First, extract the center point c and the N points below it in the vertical direction. In the specific implementation, N is set to 5, and the number of points marked as defective marking points among the N points is calculated; specifically, the counting function can be set to loop 5 times, count the number of the center point c and the total number of 5 points below it, and set the count value Na of the number of defective marking points. If the mark value of a point among the N points is 1, execute formula N a =N a +1, where: N a —The count value of the number of defect marking points, initially 0.
[0059] Then use the following formula to determine whether it exceeds the preset first threshold value T a Then determine whether the center point c is a defective pixel:
[0060]
[0061] Where: R c —Whether the center point c is the first mark value of the defective pixel; T a —The first numerical threshold; N a —The count value of the number of defective marking points among N points;
[0062] When R c =1, the pixel at the center point c is regarded as a defective pixel, and step 4.3.2) is skipped and the process ends;
[0063] When R c = 0, the pixel at the center point c is not a defective pixel, and the process goes to step 4.3.2);
[0064] 4.3.2) Extract the center point c and its 9 points in four specific directions, and calculate the number of defect marking points among the 9 points; specifically, the counting function can be set to loop 9 times, and the count value Na of the number of defect marking points can be set. If the marking value of a point among the 9 points is 1, execute formula N b =N b +1, where: N b —The count value of the number of defect marking points, initially 0.
[0065] Then use the following formula to determine whether it exceeds the preset second value threshold T a Then determine whether the center point c is a defective pixel:
[0066]
[0067] Where: R c '—the second marking value of whether the center point c is a defective pixel; T a —The second numerical threshold; N a—The count value of the number of defective marking points among the 9 points;
[0068] When R c When '=1, the pixel at the center point c is regarded as a defective pixel;
[0069] When R c When '=0, the pixel at the center point c is not a defective pixel.
[0070] The 9 points in the step 4.3.2) are the center point c itself, two pixels consecutively adjacent to the center point c along the lower left direction of the image, two pixels consecutively adjacent to the center point c along the lower right direction of the image, the first and third pixels adjacent to the center point c along the lower direction of the image, and the first and third pixels adjacent to the center point c along the horizontal right direction of the image.
[0071] In the step 5), a connected domain is extracted based on the defective pixel points obtained previously, and a connected domain is formed by connecting multiple defective pixel points together. A connected domain formed by connecting multiple defective pixel points together is taken as a defect, thereby obtaining the steel surface defect of the test image.
[0072] The present invention mainly extracts steel from the background first, takes the mean value of the pixel points on the circular area line after mean filtering, calculates the threshold and compares and identifies the defective marking points, and takes the marking points in the adjacent area whose count value exceeds the threshold as defective pixel points, thereby obtaining the steel surface defects in the test image.
[0073] The present invention has the following beneficial effects:
[0074] The present invention utilizes the local grayscale difference characteristics of steel surface defect images and completes image feature extraction by improving local annular contrast to locate defects. It has a particularly good detection effect on longitudinal defects and regional defects, does not require manual debugging and settings, and can adaptively identify.
[0075] The present invention overcomes the problem of requiring a large number of image training features and high computational complexity, and only requires comparison of pixels around the image itself, thereby effectively reducing preparation time and having application potential in online computer vision detection of steel.
[0076] The algorithm of the method of the present invention is simple to implement through program engineering, and has great application potential in computer vision online detection of steel surfaces. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] Figure 1 is a flow chart of the method of the present invention.
[0078] Figure 2 Schematic diagram of a sample image of a defect-free steel surface in Example 1 of the present invention.
[0079] Figure 3 Schematic diagram of a steel surface image sample with pits in Example 1 of the present invention.
[0080] Figure 4 Schematic diagram of an image sample of an overfilled steel surface in Example 1 of the present invention.
[0081] Figure 5-Figure 7 They are Figure 2-Figure 4 Schematic diagram of steel surface image samples after background removal.
[0082] Figure 8 The following figure shows an example of the process of selecting three circles with radii 3, 4, and 5 on an image.
[0083] Fig. 9 yes Figure 8 A ring example image with a radius of 3 is selected at the corresponding pixel position.
[0084] Fig.10 Taking point c as an example, the point positions selected for determining longitudinal defects and regional defects are shown.
[0085] Fig.11 The mask image of the longitudinal defect is shown, and the white dots are the pixels marked as longitudinal defects.
[0086] Fig.12 The mask image of regional defects is shown, and the white dots are pixels marked as regional defects. DETAILED DESCRIPTION
[0087] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.
[0088] like Figure 1 As shown, this embodiment and its implementation are as follows:
[0089] 1) Take photos of the steel surface and convert it into grayscale to obtain the original grayscale image Image source , calculate the original image Image source The pixel mean of each column of pixels;
[0090]
[0091] Where: M j —Original Image source The pixel mean of the jth column; m—original image Image source The number of rows, i.e. the height of the image; g ij —Original Image source The gray value of the pixel in the i-th row and j-th column;
[0092] Use the above formula to loop and obtain the pixel mean of each column.
[0093] by Figure 2 For example, for an image with a width of 512 and a height of 1024, the above formula is used to calculate that the pixel mean of columns 0 to 144 is 0, the pixel mean of columns 145 to 236 is 128, the pixel mean of columns 237 to 291 is 255, the pixel mean of columns 292 to 383 is 128, and the pixel mean of columns 384 to 511 is 0.
[0094] Note: In fact, due to the presence of noise, the mean values of each column of pixels are slightly different. For the convenience of presentation, a unified three pixel values of 0, 128, and 255 are used to represent them.
[0095] 2) Preset the difference threshold T between the background pixels and the steel surface pixels B Since the background is completely black, the pixel difference between the background and the two sides of the steel is more than 120, and the difference threshold T B You can take 80.
[0096] And according to the pixel mean and difference threshold T of each column of pixels B In the original image Image source Find the left boundary B l and right boundary B r ;
[0097] On the one hand, the left border is obtained by the following method:
[0098] Traverse the original image Image from left to right source For each column of pixels in , for each current j-th column pixel, use the following formula to determine whether it satisfies:
[0099] Mj +1 -Mj -1 >T B
[0100] Mj +1 +Mj +2 -Mj -1 -Mj -2 >2×T B
[0101] Where: M j+1 —The mean value of the pixels in the j+1th column; M j+2 、M j-1 and M j-2 Same meaning as above; T B —The difference threshold between the pixels of the background and the pixels of the steel surface;
[0102] If the current j-th column pixel satisfies the above two formulas, the current j-th column pixel is used as the left boundary B l = j; thus looping from right to left to determine each column j, locating to the right boundary B r =j.
[0103] If the current j-th column pixel does not satisfy the above two formulas, the current j-th column pixel is not processed.
[0104] In this embodiment, the calculation is incremented in the above two formulas starting from j=0. When j=144,
[0105] M 144+1 (128)-M 144-1 (0)>T B (80) and
[0106] M 144+1 (128)+M 144+2 (128)-M 144-1 (0)-M 144-2 (0)>2×T B (160)
[0107] If the conditions are met, select B l =144 is the left boundary of steel.
[0108] On the other hand, the right border is obtained by the following process:
[0109] Traverse the original image Image from left to right source For each column of pixels in , for each current j-th column pixel, use the following formula to determine whether it satisfies:
[0110] Mj -1 -Mj +1 >T B
[0111] Mj -1 +Mj -2 -Mj +1 -Mj +2 >2×T B
[0112] Where: M j-1 —The mean value of the pixels in the j-1th column; M j+1 、M j-2 and M j+2 Same meaning as above; T B —The difference threshold between the pixels of the background and the pixels of the steel surface;
[0113] If the current j-th column pixel satisfies the above two formulas, the current j-th column pixel is used as the right boundary B r= j; thus looping from right to left to determine each column j, locating to the right boundary B r =j.
[0114] If the current j-th column pixel does not satisfy the above two formulas, the current j-th column pixel is not processed.
[0115] In this embodiment, the above two formulas are calculated in descending order starting from j=511. When j=384,
[0116] M 384-1 (128)-M 384+1 (0)>T B (80), and
[0117] M 384-1 (128)+M 384-2 (128)-M 384+1 (0)-M 384+2 (0)>2×T B (160)
[0118] If the conditions are met, select B r =384 is the right boundary of steel.
[0119] Note: Figure 3 , Figure 4 The middle steel part has defects, which leads to the mean pixel value and Figure 2 Different, but the background part is completely black, so the way to take the boundary is universal.
[0120] 3) According to the left boundary B l and right boundary B r , in the original image Image source Remove the background image and extract the detection image Image detect ;
[0121] Specifically, in the original image Image source , extract the left boundary B l and right boundary B r The image area between is used as the detection image Image detect ,get Figure 5 , Figure 6 , Figure 7 . Except for the left boundary B l and right boundary B r The image area outside the image area between is the background image.
[0122] 4) Detection image Image detect Perform mean filtering and two-pass processing to obtain defective pixels;
[0123] 4.1) Detection image Image detect Perform 5x5 mean filtering;
[0124] 4.2) Filtered detection image Image detect Traverse each pixel and determine whether each pixel is a defect mark point;
[0125] 4.2.1) Traverse each pixel as the center point c to obtain the pixel mean S of its neighboring points c :
[0126] In step 4.2.1), the current pixel is used as the center point c, and a circle is established to obtain the neighboring points of each center point c and their pixel means.
[0127] A circle with the center point c as the center and a radius of R is established. All pixels on the circle are taken as the neighboring points of the center point c. A total of P neighboring points are obtained, and then the pixel mean of all neighboring points of the center point c is calculated:
[0128]
[0129] Where: S c —The pixel mean of the neighboring points of the center point c; P—the number of neighboring points; k—the index of the neighboring point; g—the number of neighboring points; k —Grayscale value of neighboring pixels.
[0130] Figure 8 Three circles with radii 3, 4, and 5 are shown. Select the circle with radius 3, corresponding to Fig. 9 The pixel values of the 16 neighboring points on the circle are 49, 50, 51.......64. Substitute it into the above formula to calculate the pixel mean S of the neighboring points c =56.5.
[0131] 4.2.2) According to the pixel mean S of the neighboring points of the center point c c Calculate and process to obtain the defect gray value threshold T of the current center point c c :
[0132] According to the pixel mean S c Calculate the correction factor A according to the following formula c Then the defect gray value threshold T is obtained c :
[0133] A c =1-0.0016×S c
[0134] T c =S c ×A c
[0135] Where: Ac —Correction factor, T c —Defect gray value threshold.
[0136] In this embodiment, S c Substitute into the above formula to get the correction coefficient A c =0.9096, A c and S c Substitute into the above formula to get the defect gray value threshold T c =51.4.
[0137] 4.2.3) According to the defect gray value threshold T c The center point c is judged and assigned a value to locate the defect mark point:
[0138] First, calculate the mark value of the center point c according to the following formula:
[0139]
[0140] Where: F c —The center point c is the mark value of the defect mark point; g c —Grayscale value of the center point c;
[0141] Then make a judgment:
[0142] When F c =1, the pixel at the center point c is used as the defect marking point;
[0143] When F c When =0, the pixel at the center point c is not a defect mark point.
[0144] In this example, the gray value of a central point g c =49, T c =51.4 is substituted into the above formula to obtain the mark value F of the defect mark point c =1, it is a defect mark point.
[0145] Loop through the detection image Image detect For each pixel point, after executing step 4.2), the corresponding mark value of each pixel point is obtained, and whether it is a defect mark point, and then proceed to step 4.3).
[0146] 4.3) Re-traverse the detection image Image according to the defect marking point of each pixel detect For each pixel in the adjacent area, the pixel whose mark point count value exceeds the preset threshold is taken as the defective pixel point, thereby obtaining the defective pixel point.
[0147] Specifically, take the current pixel as the center point c, traverse each pixel point to determine the count value of the marker points in the adjacent area, such as Fig.10 shown.
[0148] 4.3.1) First, extract the center point c and the N points below it in the vertical direction. In the specific implementation, N is set to 5, and the number of points marked as defective marking points among the N points is calculated; specifically, the counting function can be set to loop 5 times, count the number of the center point c and the total number of 5 points below it, and set the count value Na of the number of defective marking points. If the mark value of a point among the N points is 1, execute formula N a =N a +1, where: N a —The count value of the number of defect marking points, initially 0.
[0149] Then use the following formula to determine whether it exceeds the preset first threshold value T a Then determine whether the center point c is a defective pixel:
[0150]
[0151] Where: R c —Whether the center point c is the first mark value of the defective pixel; T a —The first numerical threshold; N a —The count value of the number of defective marking points among N points;
[0152] When R c =1, the pixel at the center point c is regarded as a defective pixel, and step 4.3.2) is skipped and the process ends;
[0153] When R c = 0, the pixel at the center point c is not a defective pixel, and the process goes to step 4.3.2).
[0154] In this example, we first determine whether it is a longitudinal defect, the center point c and the following 4 points, and obtain the number of defects marked as N a , take the threshold T a is 3, and we can substitute it into the above formula to judge if N a >3, it is a vertical defect pixel, and as a defective pixel, this step is repeated for the next pixel.
[0155] 4.3.2) Extract the center point c and a total of 9 points in four specific directions relative to it. The 9 points are the center point c itself, two pixels consecutively adjacent to the center point c along the lower left direction of the image, two pixels consecutively adjacent to the center point c along the lower right direction of the image, the first and third pixels adjacent to the center point c along the lower direction of the image, and the first and third pixels adjacent to the center point c along the horizontal right direction of the image.
[0156] Then calculate the number of defective marking points among the 9 points; specifically, the counting function can be set to loop 9 times, and the count value Na of the number of defective marking points is set. If the marking value of a point among the 9 points is 1, the formula N is executed. b =N b +1, where: N b —The count value of the number of defect marking points, initially 0.
[0157] Then use the following formula to determine whether it exceeds the preset second value threshold T a Then determine whether the center point c is a defective pixel:
[0158]
[0159] Where: R c '—the second marking value of whether the center point c is a defective pixel; T a —The second numerical threshold; N a —The count value of the number of defective marking points among the 9 points;
[0160] When R c When '=1, the pixel at the center point c is regarded as a defective pixel;
[0161] When R c When '=0, the pixel at the center point c is not a defective pixel.
[0162] Then determine whether it is a regional defect, the center point c and a total of 9 points in 4 directions, and get the number N marked as defects b . Take the threshold T a is 6, and we can substitute it into the above formula to judge if N b >6 are pixels with regional defects and are considered defective pixels.
[0163] 5) Obtain the detection image Image based on the defective pixels detect The steel surface defects in the image are also used as the original image Image source Surface defects of steel.
[0164] Specifically, a connected domain is extracted based on the defective pixel points obtained previously, a connected domain is formed by connecting multiple defective pixel points together, and a connected domain formed by connecting multiple defective pixel points together is taken as a defect, so as to obtain the steel surface defect of the test image.
[0165] After all pixels are judged, all marked defective pixels indicate the location of defects on the steel surface. Fig.11 , Fig.12 shown.
[0166] After multiple implementations of the embodiments, the accuracy of the method of the present invention reached 95%.
[0167] The above specific implementation modes are used to explain the present invention rather than to limit the present invention. Any modification and change made to the present invention within the spirit of the present invention and the protection scope of the claims shall fall within the protection scope of the present invention.
Claims
1. A high-speed detection method for steel surface defect images based on local annular contrast, characterized by: The method comprises the following steps: 1) Take a photo of the steel surface to obtain the original grayscale image Image source , calculate the original image Image source The pixel mean of each column of pixels; 2) Preset the difference threshold T between the background pixels and the steel surface pixels B , and according to the pixel mean and difference threshold T of each column of pixels B In the original image Image source Find the left boundary B l and right boundary B r ; 3) According to the left boundary B l and right boundary B r , in the original image Image source Remove the background image and extract the detection image Image detect ; 4) Detection image Image detect Perform mean filtering and local ring contrast processing to obtain defective pixels; 5) Obtain the detection image Image based on the defective pixels detect Surface defects of steel.
2. The method for high-speed detection of steel surface defect images based on local annular contrast according to claim 1, characterized in that: The step 1) is specifically as follows: Where: M j —Original Image source The pixel mean of the jth column; m—original image Image source The number of rows, i.e. the height of the image; g ij —Original Image source The grayscale value of the pixel in the i-th row and j-th column.
3. The method for high-speed detection of steel surface defect images based on local annular contrast according to claim 1, characterized in that: In the step 2), the left boundary is obtained by processing in the following manner: Traverse the original image Image from left to right source For each column of pixels in , for each current j-th column pixel, use the following formula to determine whether it satisfies: M j+1 -M j-1 >T B M j+1 +M j+2 -M j-1 -M j-2 >2×T B Where: M j+1 —The mean value of the pixels in the j+1th column; T B —The difference threshold between the pixels of the background and the pixels of the steel surface; If the current j-th column pixel satisfies the above two formulas, the current j-th column pixel is used as the left boundary B l =j; If the current j-th column pixel does not satisfy the above two formulas, the current j-th column pixel is not processed.
4. The method for high-speed detection of steel surface defect images based on local annular contrast according to claim 1, characterized in that: In step 3), the right boundary is obtained by processing in the following manner: Traverse the original image Image from left to right source For each column of pixels in , for each current j-th column pixel, use the following formula to determine whether it satisfies: M j-1 -M j+1 >T B M j-1 +M j-2 -M j+1 -M j+2 >2×T B Where: M j-1 —The mean pixel value of the j-1th column; T B —The difference threshold between the pixels of the background and the pixels of the steel surface; If the current j-th column pixel satisfies the above two formulas, the current j-th column pixel is used as the right boundary B r =j; If the current j-th column pixel does not satisfy the above two formulas, the current j-th column pixel is not processed.
5. The method for high-speed detection of steel surface defect images based on local annular contrast according to claim 1, characterized in that: The step 3) is specifically as follows: source , extract the left boundary B l and right boundary B r The image area between is used as the detection image Image detect .
6. The method for high-speed detection of steel surface defect images based on local annular contrast according to claim 1, characterized in that: The step 4) is specifically as follows: 4.1) Detection image Image detect Perform 5x5 mean filtering; 4.2) Filtered detection image Image detect Perform local annular traversal processing, traverse each pixel and determine whether it is a defect mark point; 4.3) Re-traverse each pixel according to the defective marking point of each pixel to obtain the defective pixel point.
7. The method for high-speed detection of steel surface defect images based on local annular contrast according to claim 6, characterized in that: The step 4.2) is specifically as follows: 4.2.1) Traverse each pixel as the center point c to obtain the pixel mean S of its neighboring points c : A circle with the center point c as the center and a radius of R is established. All pixels on the circle are regarded as the neighboring points of the center point c, and then the pixel mean of all the neighboring points of the center point c is calculated: Where: S c —The pixel mean of the neighboring points of the center point c; P—the number of neighboring points; k—the index of the neighboring point; g—the number of neighboring points; k —Grayscale value of neighboring points; 4.2.2) According to the pixel mean S of the neighboring points of the center point c c Calculate and process to obtain the defect gray value threshold T of the current center point c c : According to the pixel mean S c Calculate the correction factor A according to the following formula c Then the defect gray value threshold T is obtained c : A c =1-0.0016×S c T c =S c ×A c Where: A c —Correction factor, T c —Defect gray value threshold; 4.2.3) According to the defect gray value threshold T c The center point c is judged and assigned a value to locate the defect mark point: First, calculate the mark value of the center point c according to the following formula: Where: F c —The center point c is the mark value of the defect mark point; g c —Grayscale value of the center point c; Then make a judgment: When F c =1, the center point c is used as the defect marking point; When F c When =0, the center point c is not a defect marking point.
8. The method for high-speed detection of steel surface defect images based on local annular contrast according to claim 6, characterized in that: In step 4.3), the current pixel is taken as the center point c and the following processing is performed: 4.3.1) First, extract the center point c and the N points below it in the vertical direction, and calculate the number of defect points marked among the N points; Then use the following formula to determine whether it exceeds the preset first threshold value T a Then determine whether the center point c is a defective pixel: Where: R c —Whether the center point c is the first mark value of the defective pixel; T a —The first numerical threshold; N a —The count value of the number of defective marking points among N points; When R c =1, the center point c is regarded as the defective pixel, and step 4.3.2) is skipped and the process ends; When R c = 0, the center point c is not a defective pixel, and the process goes to step 4.3.2); 4.3.2) Extract the center point c and its 9 points in four specific directions, and calculate the number of defect points marked among the 9 points; Then use the following formula to determine whether it exceeds the preset second value threshold T a Then determine whether the center point c is a defective pixel: Where: R c '—the second marking value of whether the center point c is a defective pixel; T a —The second numerical threshold; N a —The count value of the number of defective marking points among the 9 points; When R c When '=1, the center point c is regarded as the defective pixel; When R c When '=0, the center point c is not a defective pixel.
9. The method for high-speed detection of steel surface defect images based on local annular contrast according to claim 8, characterized in that: The 9 points in the step 4.3.2) are the center point c itself, two pixels consecutively adjacent to the center point c along the lower left direction of the image, two pixels consecutively adjacent to the center point c along the lower right direction of the image, the first and third pixels adjacent to the center point c along the lower direction of the image, and the first and third pixels adjacent to the center point c along the horizontal right direction of the image.
10. The method for high-speed detection of steel surface defect images based on local annular contrast according to claim 1, characterized in that: In the step 5), a connected domain is extracted based on the defective pixel points obtained previously, and a plurality of defective pixel points are connected together to form a connected domain as a defect, thereby obtaining the steel surface defect of the test image.