Cold-rolled strip steel surface defect rapid detection method based on four-neighborhood difference

Through the detection method based on four neighborhood differentials, the defect area of ​​the cold-rolled strip surface is quickly identified and segmented, and the problem of high computing complexity in the prior art is solved, and efficient and accurate online detection is achieved.

CN119477854APending Publication Date: 2025-02-18HEBEI PUYANG IRON & STEEL +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411582989.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-07
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The existing cold-rolled strip surface defect detection methods have high computational complexity and are difficult to meet the real-time requirements of online inspection.

Method used

Using a fast detection method based on four neighborhood differences, the sample image of cold-rolled strip is obtained, the integral map is calculated and divided into sub-blocks, the gray mean characteristics and four neighborhood differences of each sub-block are calculated, and the double threshold method and region are used. Growth algorithms to identify and merge defect areas.

Benefits of technology

It realizes the rapid and accurate separation of defect areas, reduces detection time, improves detection speed and detection rate, and is suitable for various types of cold-rolled strip surface defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119477854A_ABST
    Figure CN119477854A_ABST
Patent Text Reader

Abstract

The invention provides a cold-rolled strip steel surface defect rapid detection method based on four-neighborhood difference, which comprises the following steps: acquiring a sample image of cold-rolled strip steel, and calculating an integrogram of the sample image in combination with a dynamic programming mode; uniformly dividing the sample image into a plurality of sub-blocks with the same size by using the integrogram, and calculating the gray average feature of each sub-block; calculating a difference value between each sub-block and the four-neighborhood sub-blocks by using the gray mean value features, selecting the maximum difference value as a four-neighborhood difference value of the sub-blocks, and generating a four-neighborhood difference graph; according to the four-neighborhood difference graph, dividing a difference value by adopting a dual-threshold method, and calibrating whether each sub-block is a defect region or not to obtain a defect sub-block and a non-defect sub-block; and combining adjacent defect sub-blocks by using a region growing algorithm to obtain a complete defect region of the sample image. According to the method, the defect area can be quickly and accurately segmented, and the requirement of online detection is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of cold-rolled strip surface defect detection, and in particular to a cold-rolled strip surface defect rapid detection method based on four-neighborhood difference. Background Art

[0002] Cold-rolled strip steel refers to hot-rolled strip steel and steel plate, which are rolled into strip steel and thin plates by cold rolling mill at room temperature. The general thickness is 0.1-3 mm and the width is 100-2000 mm. Cold-rolled strip or plate has the advantages of good surface finish, good flatness, high dimensional accuracy and good mechanical properties. Various defects are prone to occur on the surface of cold-rolled strip steel, which mainly include black spots, pressure spots, roughness problems, etc. Therefore, surface defect detection of cold-rolled strip steel is an important link to ensure product quality. Although existing defect detection methods such as SIFT, SURF and other algorithms have good detection effects, they have high computational complexity and are difficult to meet the real-time requirements of online detection. Therefore, the present invention proposes a rapid detection method for surface defects of cold-rolled strip steel based on four-neighborhood difference to solve the above problems. Summary of the invention

[0003] In order to overcome the shortcomings of the prior art, the purpose of the present invention is to provide a method for rapid detection of surface defects of cold-rolled strip steel based on four-neighborhood difference, which can quickly and accurately segment the defective area and meet the requirements of online detection.

[0004] To achieve the above object, the present invention provides the following solution: a method for rapid detection of surface defects of cold-rolled strip steel based on four-neighborhood difference, comprising the following steps:

[0005] Acquire a sample image of the cold-rolled steel strip, and calculate an integral image of the sample image by combining a dynamic programming method;

[0006] Using the integral image, the sample image is evenly divided into a plurality of sub-blocks of the same size, and a grayscale mean feature of each sub-block is calculated;

[0007] Utilizing the grayscale mean feature, calculating the difference between each of the sub-blocks and the four neighborhood sub-blocks, selecting the largest difference value as the four neighborhood difference value of the sub-block, and generating a four neighborhood difference map;

[0008] According to the four-neighborhood difference graph, a double threshold method is used to divide the difference value, and each of the sub-blocks is marked as a defective area to obtain a defective sub-block and a non-defective sub-block;

[0009] Adjacent defect sub-blocks are merged using a region growing algorithm to obtain a complete defect region of the sample image.

[0010] Optionally, obtaining a sample image of the cold-rolled steel strip and calculating an integral image of the sample image in combination with a dynamic programming method include:

[0011] Obtain all pixel points and the image origin in the sample image, and calculate the pixel value from each pixel point to the image origin by a recursive formula in combination with dynamic programming, and calculate the sum of the pixel values; the formula for the sum of the pixel values ​​is:

[0012] I(x,y)=f(x,y)+I(x-1,y)+I(x,y-1)-I(x-1,y-1)

[0013] Among them, (x, y) is the pixel point, I(x-1, y) is the integral value of the left pixel, I(x, y-1) is the integral value of the upper pixel, and I(x-1, y-1) is the integral value of the upper left pixel.

[0014] Optionally, using the integral image, the sample image is evenly divided into a plurality of sub-blocks of the same size, and a grayscale mean feature of each sub-block is calculated, including:

[0015] Set the sub-block size and calculate the integral according to the properties of the integral map. Figure 4 The integral value of each corner point is obtained to obtain the sum of pixels in the sub-block, and then the sum of pixels in the sub-block is divided by the area of ​​the sub-block to obtain the grayscale mean feature of each sub-block; the calculation formula of the grayscale mean feature is:

[0016]

[0017] Among them, (x1, y1) is the coordinate of the upper left corner of the sub-block, (x2, y2) is the coordinate of the lower right corner of the sub-block, w and h are the width and height of the sub-block respectively, and I(x, y) is the value of the integral image at the point (x, y).

[0018] Optionally, the calculation formula for the four-neighborhood difference value is:

[0019] D(i,j)=max(D up (i,j),D down (i,j),D left (i,j),D right (i,))

[0020] Among them, (i,j) is a sub-block, D up (i, j) is the grayscale mean of the upper neighboring sub-block of the sub-block, D down (i, j) is the grayscale mean of the next neighboring sub-block, D left (i, j) is the grayscale mean of the left neighboring sub-block, D right (i, j) is the grayscale mean of the right neighboring sub-block.

[0021] Optionally, according to the four-neighborhood difference graph, a double threshold method is used to divide the difference value, and each sub-block is marked as a defective area to obtain a defective sub-block and a non-defective sub-block, including:

[0022] Calculate the mean of the difference values, and add the mean to 2-3 times the standard deviation to obtain a high threshold for detecting obvious boundaries, and then calculate 0.4-0.6 times the high threshold to obtain a low threshold for detecting weak boundaries;

[0023] The high threshold and the low threshold are used to perform defect judgment on each sub-block in the four-neighborhood difference graph; the judgment formula is:

[0024]

[0025] Among them, Label(i,j)=2 represents a strong defect point, Label(i,j)=1 represents a weak defect point, and Label(i,j)=0 represents a background point.

[0026] Optionally, the implementation of the region growing algorithm includes:

[0027] S1. Construct an empty candidate point queue, set a strong defect point as a seed point, and add the seed point to the empty candidate point queue;

[0028] S2. When the candidate point queue is not empty, take a seed point from the candidate point queue and check the 8 neighboring points of the selected seed point;

[0029] S3. When there is a point in the 8 neighborhood points that has not been visited and Label(i,j)≥1, the point is marked as visited, the candidate point queue is returned, and the Label value of the point is updated to 2;

[0030] S4. Repeat steps S2-S3 until the candidate point queue is empty, obtain all points with Label=2, and form a complete defect area.

[0031] Optionally, the expression of the region growing algorithm is:

[0032] R(p)={n∈N(p)|Label(n)≥1∧Visited(n)=false}

[0033] Where n is a point in the 8-neighborhood point set, R(p) is the growth region of point p, N(p) is the 8-neighborhood point set of point p, Label(n) represents the label value of point n, and Visited(n) represents whether point n has been visited.

[0034] The present invention discloses the following technical effects by providing a method for rapid detection of surface defects of cold-rolled strip steel based on four-neighborhood difference:

[0035] 1. High detection efficiency: Compared with SIFT, SURF and other algorithms, the average detection time of this method is significantly reduced, which greatly improves the detection speed. And under appropriate parameter settings, this method can achieve a high level of defect detection rate.

[0036] 2. Strong applicability: This method is applicable to various types of surface defects of cold-rolled strip, including scars, white spots, slag inclusions, interlayers, holes, etc.

[0037] 3. Simple implementation: This method is based on simple image processing operations and is easy to implement and optimize.

[0038] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0040] Figure 1 A schematic diagram of a method flow chart provided by an embodiment of the present invention;

[0041] Figure 2 A schematic diagram of an input image provided by an embodiment of the present invention;

[0042] Figure 3 A schematic diagram of the blocks of an input image provided by an embodiment of the present invention;

[0043] Figure 4 A schematic diagram of a plane of four-neighborhood difference results provided by an embodiment of the present invention;

[0044] Figure 5 A three-dimensional schematic diagram of the four-neighborhood difference result provided by an embodiment of the present invention;

[0045] Figure 6 A schematic diagram of the high and low threshold plane division provided by an embodiment of the present invention;

[0046] Figure 7 A schematic diagram of a neighborhood differential stereo image with multiple peaks provided by an embodiment of the present invention;

[0047] Figure 8 A schematic diagram of the final defect area segmentation result provided by an embodiment of the present invention;

[0048] Fig. 9 A schematic diagram of the segmentation results of defective regions of common cold-rolled strip provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0049] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0050] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0051] like Figure 1 As shown, the present invention provides a method for rapid detection of surface defects of cold-rolled strip steel based on four-neighborhood difference, comprising the following steps:

[0052] 1. If Figure 1 As shown, the method includes:

[0053] 1. Obtain a sample image f(x, y) of a cold-rolled steel strip, and calculate the integral image I(x, y) of the sample image by combining dynamic programming. Including:

[0054] Obtain all pixel points (x, y) and the image origin (0, 0) in the sample image, and calculate the pixel value from each pixel point to the image origin by a recursive formula in combination with dynamic programming, and calculate the sum of the pixel values; the formula for the sum of the pixel values ​​is:

[0055]

[0056] I(x,y)=f(x,y)+I(x-1,y)+I(x,y-1)-I(x-1,y-1)

[0057] Among them, (x, y) is the pixel point, I(x-1, y) is the integral value of the left pixel, I(x, y-1) is the integral value of the upper pixel, and I(x-1, y-1) is the integral value of the upper left pixel (since the upper left corner area is calculated repeatedly, it needs to be subtracted once).

[0058] This recursive method only needs to scan the image once, and the time complexity is O(n), where n is the total number of image pixels. The calculated integral image will be used for the rapid extraction of subsequent sub-block features.

[0059] 2. Using the integral image, evenly divide the sample image into multiple sub-blocks (i, j) of the same size, and calculate the grayscale mean feature of each sub-block. Including:

[0060] Set the sub-block size. The selection of sub-block size needs to consider: 1) Typical size of defects: The sub-block cannot be too large to lose defect details; 2) Computational efficiency: The sub-block cannot be too small to avoid increasing the amount of calculation; 3) Noise suppression: The appropriate sub-block size can suppress the impact of local noise.

[0061] According to the properties of the integral graph, the integral is calculated Figure 4 The integral value of each corner point is obtained to obtain the sum of pixels in the sub-block, and then the sum of pixels in the sub-block is divided by the area of ​​the sub-block to obtain the grayscale mean feature of each sub-block; the calculation formula of the grayscale mean feature is:

[0062]

[0063] Among them, (x1, y1) is the coordinate of the upper left corner of the sub-block, (x2, y2) is the coordinate of the lower right corner of the sub-block, w and h are the width and height of the sub-block respectively, and I(x, y) is the value of the integral image at the point (x, y).

[0064] The above formula uses the properties of the integral image for calculation. This method avoids pixel-by-pixel accumulation and reduces the time complexity of sub-block feature calculation from O(w×h) to O(1). The grayscale mean feature of the sub-block reflects the overall brightness level of the area, providing a basis for subsequent defect detection.

[0065] 3. Using the grayscale mean feature, calculate the difference between each sub-block (i, j) and the four neighborhood sub-blocks, select the largest difference value as the four neighborhood difference value of the sub-block, and generate a four neighborhood difference map;

[0066] For each sub-block (i, j) in the image, calculate the absolute value of the grayscale mean difference between it and the four adjacent sub-blocks above, below, left, and right:

[0067] D up (i,j)=|M(i,j)-M(i-1,j)|D down (i,j)=|M(i,j)-M(i+1,j)|

[0068] D left (i,j)=|M(i,j)-M(i,j-1)|D right (i,j)=|M(i,j)-M(i,j+1)|

[0069] Among them, M(i,j) is the grayscale mean feature of sub-block (i,j).

[0070] Then take the maximum value of these four difference values ​​as the four-neighborhood difference value D(i,j) of the sub-block. The calculation formula of the four-neighborhood difference value D(i,j) is:

[0071] D(i,j)=max(D up (i,j),D down (i,j),D left (i,j),D right (i, j))

[0072] Among them, (i,j) is a sub-block, D up (i, j) is the grayscale mean of the upper neighboring sub-block of the sub-block, D down (i, j) is the grayscale mean of the next neighboring sub-block, D left (i, j) is the grayscale mean of the left neighboring sub-block, D right (i, j) is the grayscale mean of the right neighboring sub-block.

[0073] The reasons for choosing the maximum difference value are:

[0074] 1) The grayscale difference between the defective area and the normal area is usually large;

[0075] 2) The maximum value can highlight the defect boundary;

[0076] 3) Helps to suppress the influence of background noise;

[0077] After all sub-blocks are calculated, the four-neighborhood difference map D of the entire image is obtained. The larger the value in the difference map, the more significant the grayscale change, which may be the location of the defect boundary. This method based on local difference has the advantages of simple and efficient calculation, insensitivity to illumination changes, and effective detection of defect edges.

[0078] 4. Based on the four-neighborhood difference graph, the double threshold method is used to divide the difference value, and each sub-block is marked as a defective area to obtain defective sub-blocks and non-defective sub-blocks. Including:

[0079] Set the high threshold T h and low threshold T l (T h >T l ), a defect judgment is performed on each sub-block in the four-neighborhood difference graph according to a high threshold and a low threshold; the judgment formula is:

[0080]

[0081] in:

[0082] Label(i,j)=2 indicates strong defect points, where the difference value is greater than the high threshold, and these points have a high probability of being defect areas;

[0083] Label(i,j)=1 indicates weak defect points, and the difference value is between the high and low thresholds. These points may be defect areas;

[0084] Label(i,j)=0 indicates background points, where the difference value is less than the low threshold, and these points are most likely normal areas.

[0085] The high and low thresholds are set based on:

[0086] 1) High threshold T h It is usually set to the difference image mean plus 2-3 times the standard deviation to reliably detect obvious defect boundaries;

[0087] 2) Low threshold T l Usually set to 0.4-0.6 times the high threshold to detect weaker defect boundaries;

[0088] 3) The ratio of the two thresholds can be adjusted according to the detection rate and false alarm rate requirements in actual applications.

[0089] The advantages of high and low thresholds are:

[0090] 1) Able to effectively distinguish obvious defects, suspicious defects and normal areas;

[0091] 2) Through subsequent region growing, weak defect points can be connected to strong defect points to improve the integrity of detection;

[0092] 3) It has good noise resistance and avoids the over-segmentation or under-segmentation problem caused by a single threshold.

[0093] 5. Use a region growing algorithm to merge the adjacent defect sub-blocks to obtain a complete defect region of the sample image.

[0094] The implementation process of the region growing algorithm includes:

[0095] S1. Construct an empty candidate point queue Q, set the strong defect point as the seed point s, and add the seed point s to the empty candidate point queue Q;

[0096] S2. When the candidate point queue Q is not empty, a seed point p is taken out from the candidate point queue Q, and the 8 neighboring points N(p) of the selected seed point p are checked;

[0097] S3. When there is a point n that has not been visited and Label(i,j)≥1 among the 8 neighborhood points N(p), point n is marked as visited, point n is returned to the candidate point queue Q, and the Label value of point n is updated to 2;

[0098] S4. Repeat steps S2-S3 until the candidate point queue Q is empty, and all points with a Label value of 2 constitute a complete defect area.

[0099] The expression of the region growing algorithm is:

[0100] R(p)={n∈N(p)|Label(n)≥1∧Visited(n)=false}

[0101] Where n is a point in the 8-neighborhood point set, R(p) is the growth region of point p, N(p) is the 8-neighborhood point set of point p, Label(n) represents the label value of point n, and Visited(n) represents whether point n has been visited.

[0102] The advantages of this region growing method are:

[0103] 1) Start growing from the strong defect point to ensure the reliability of the test results;

[0104] 2) Adjacent defective areas can be effectively merged through 8-neighborhood connectivity judgment;

[0105] 3) Only consider points whose label value is not less than 1, avoiding expansion into the background area;

[0106] 4) The iterative process adapts to the defect shape and can obtain a complete defect outline.

[0107] The termination condition of region growing is that the queue Q is empty, indicating that no more adjacent points that meet the conditions can be found. All points with a Label value of 2 finally constitute a complete defect region.

[0108] 2. Take a sample image with a size of 128×128 pixels and a single-channel grayscale image as an example for detection:

[0109] 1. If Figure 2 As shown, the surface image of the cold-rolled steel strip to be inspected is input

[0110] 2. Calculate the integral image of the input image. The calculation formula of the integral image I(x,y) is:

[0111] I(x,y)=i(x,y)+I(x-1,y)+I(x,y-1)-I(x-1,y-1)

[0112] in:

[0113] I(x,y) is the value of the integral graph at point (x,y);

[0114] i(x,y) is the pixel value of the original image at point (x,y);

[0115] I(x-1,y) is the value of the integral graph at the point (x-1,y);

[0116] I(x,y-1) is the value of the integral graph at the point (x,y-1);

[0117] I(x-1,y-1) is the value of the integral graph at the point (x-1,y-1).

[0118] 3. Divide the image evenly into 4×4 pixel sub-blocks, such as Figure 3 As shown. The integral image is used to quickly calculate the grayscale mean of all pixels in each sub-block as the feature value of the sub-block. The mean calculation formula of sub-block (i, j) is:

[0119]

[0120] in:

[0121] M(i,j) is the grayscale mean of sub-block (i,j);

[0122] I(x2,y2) is the value of the lower right corner of the sub-block in the integral image;

[0123] I(x1-1,y2) is the value of the intersection of a pixel outside the left boundary of the sub-block and the lower boundary in the integral image;

[0124] I(x2,y1-1) is the value of the intersection of the right boundary of the sub-block and a pixel outside the upper boundary in the integral image;

[0125] I(x1-1,y1-1) is the value of a pixel outside the upper left corner of the sub-block in the integral image.

[0126] 4. Calculate the four-neighborhood difference value of each sub-block. The result of the four-neighborhood difference is as follows: Figure 4 and Figure 5 As shown. For sub-block (i, j), the calculation formula of its four-neighborhood difference value D(i, j) is:

[0127] D(i,j)=max(|M(i,j)-M(i-1,j)|, |M(i,j)-M(i+1,j)|, |M(i,j)-M(i,j-1)|, |M(i,j)-M(i,j+1)|)

[0128] in:

[0129] D(i,j) is the difference value of the four neighborhoods of sub-block (i,j);

[0130] M(i,j) is the grayscale mean of the current sub-block;

[0131] M(i-1,j) is the grayscale mean of the adjacent sub-block above;

[0132] M(i+1,j) is the grayscale mean of the adjacent sub-block below;

[0133] M(i,j-1) is the grayscale mean of the adjacent sub-block on the left;

[0134] M(i,j+1) is the grayscale mean of the adjacent sub-block on the right.

[0135] 5. Set high and low thresholds. In this embodiment, the high threshold is set to 10 and the low threshold is set to 5.5. Threshold division is performed on the four-neighborhood difference graph:

[0136] If D(i,j)>T h , it is marked as a defective sub-block;

[0137] If D(i,j) <T l , it is marked as background sub-block;

[0138] If T l ≤D(i,j)≤T h , it is marked as a pending sub-block.

[0139] High and low threshold strategies such as Figure 6 As shown in the figure, the upper plane represents the high threshold and the lower plane represents the low threshold. The grayscale difference value is divided into three areas according to the high and low thresholds: the sub-blocks greater than the high threshold are marked as defective sub-blocks; the sub-blocks less than the low threshold are marked as background sub-blocks; the sub-blocks less than the high threshold and greater than the low threshold are marked as pending sub-blocks. When there are defective sub-blocks in the eight neighborhoods of the pending sub-block, they are upgraded to defective sub-blocks.

[0140] 6. Use the eight-neighborhood region growth method to merge defective sub-blocks. For each defective sub-block (i, j), check the sub-blocks (i+m, j+n) in its eight-neighborhood, where m, n∈{-1,0,1}. If (i+m,j+n) is a defective sub-block or a pending sub-block, merge it into the current defective region. Repeat this process until no further merging is possible.

[0141] like Figure 7 As shown in the figure, the grayscale in the defective area often fluctuates in many places, and there may be multiple grayscale difference value peaks, which results in the marked defective area being multiple independent sub-blocks. However, the defective area is usually composed of multiple connected defective sub-blocks, so it is necessary to merge multiple sub-blocks marked as defects into a larger defective area.

[0142] 7. Output the final defect area segmentation result. The final segmentation result is as follows: Figure 8 As shown in the figure: From the segmentation results, it can be seen that this method can accurately identify and locate the surface defects of the cold-rolled strip

[0143] 3. Other types of sample images as examples:

[0144] Other typical cold-rolled strip surface defect area segmentation results are as follows: Fig. 9 As shown. This figure shows five typical surface defects of cold-rolled strip steel, each defect contains four sample images. All defect areas are accurately marked by black rectangular frames, as follows:

[0145] Scars: They appear as irregular raised or sunken areas with various shapes, some are long and thin, and some are blocky.

[0146] White spots: appear as irregular patches with brightness significantly higher than the surrounding areas, with large variations in size and shape.

[0147] Slag inclusions: usually appear as long, thin black lines or dot-like defects in different directions.

[0148] Interlayer: A phenomenon characterized by the separation of surface layers, forming irregular cracks or debonding areas.

[0149] Holes / Foreign Objects: Dark areas that appear as round or irregular shapes and may be surface depressions or attached foreign objects.

[0150] From the segmentation results, it can be seen that this method can accurately identify and locate various types of cold-rolled strip surface defects. Whether it is a large area of ​​white spots or a small slag inclusion, it can be accurately framed. This shows that the segmentation method based on four-neighborhood difference has good adaptability and accuracy, and can be effectively applied to the actual cold-rolled strip surface defect detection.

[0151] Through the above steps, the defective area on the surface of the cold-rolled strip can be segmented quickly and accurately. In practical applications, the method can appropriately adjust the sub-block size, threshold and other parameters according to the specific production line conditions and image features to obtain the best detection effect. For example, the detection accuracy and calculation speed can be balanced by adjusting the sub-block size, or the detection rate and false detection rate can be controlled by adjusting the high and low thresholds.

[0152] Therefore, the present invention provides a method for rapid detection of surface defects of cold-rolled strip steel based on four-neighborhood difference, which can quickly and accurately segment the defective area and meet the requirements of online detection.

[0153] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0154] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A method for rapid detection of surface defects of cold-rolled strip steel based on four-neighborhood difference, characterized in that: The following steps are involved: Acquire a sample image of the cold-rolled steel strip, and calculate an integral image of the sample image by combining a dynamic programming method; Using the integral image, the sample image is evenly divided into a plurality of sub-blocks of the same size, and a grayscale mean feature of each sub-block is calculated; Utilizing the grayscale mean feature, calculating the difference between each of the sub-blocks and the four neighborhood sub-blocks, selecting the largest difference value as the four neighborhood difference value of the sub-block, and generating a four neighborhood difference map; According to the four-neighborhood difference graph, a double threshold method is used to divide the difference value, and each of the sub-blocks is marked as a defective area to obtain a defective sub-block and a non-defective sub-block; Adjacent defect sub-blocks are merged using a region growing algorithm to obtain a complete defect region of the sample image.

2. The method for rapid detection of surface defects of cold-rolled strip steel based on four-neighborhood difference according to claim 1 is characterized in that: Acquiring a sample image of a cold-rolled steel strip and calculating an integral image of the sample image in combination with a dynamic programming method, including: Obtain all pixel points and the image origin in the sample image, and calculate the pixel value from each pixel point to the image origin by a recursive formula in combination with dynamic programming, and calculate the sum of the pixel values; the formula for the sum of the pixel values ​​is: I(x,y)=f(x,y)+I(x-1,y)+I(x,y-1)-I(x-1,y-1) Among them, (x, y) is the pixel point, I(x-1, y) is the integral value of the left pixel, I(x, y-1) is the integral value of the upper pixel, and I(x-1, y-1) is the integral value of the upper left pixel.

3. The method for rapid detection of surface defects of cold-rolled strip steel based on four-neighborhood difference according to claim 2 is characterized in that: Using the integral image, the sample image is evenly divided into a plurality of sub-blocks of the same size, and the grayscale mean feature of each sub-block is calculated, including: The sub-block size is set, and according to the properties of the integral image, the integral values ​​of the four corner points of the integral image are calculated to obtain the sum of pixels in the sub-block, and then the sum of pixels in the sub-block is divided by the area of ​​the sub-block to obtain the grayscale mean feature of each sub-block; the calculation formula of the grayscale mean feature is: Among them, (x1, y1) is the coordinate of the upper left corner of the sub-block, (x2, y2) is the coordinate of the lower right corner of the sub-block, w and h are the width and height of the sub-block respectively, and I(x, y) is the value of the integral image at the point (x, y).

4. The method for rapid detection of surface defects of cold-rolled strip steel based on four-neighborhood difference according to claim 3 is characterized in that: The calculation formula of the four-neighborhood difference value is: D(i,j)=max(D up (i,j),D down (i,j),D left (i,j),D right (i,j)) Among them, (i,j) is a sub-block, D up (i, j) is the grayscale mean of the upper neighboring sub-block of the sub-block, D down (i, j) is the grayscale mean of the next neighboring sub-block, D left (i, j) is the grayscale mean of the left neighboring sub-block, D right (i, j) is the grayscale mean of the right neighboring sub-block.

5. The method for rapid detection of surface defects of cold-rolled strip steel based on four-neighborhood difference according to claim 4, characterized in that: According to the four-neighborhood difference graph, a double threshold method is used to divide the difference value, and each sub-block is marked as a defective area to obtain defective sub-blocks and non-defective sub-blocks, including: Calculate the mean of the difference values, and add the mean to 2-3 times the standard deviation to obtain a high threshold for detecting obvious boundaries, and then calculate 0.4-0.6 times the high threshold to obtain a low threshold for detecting weak boundaries; The high threshold and the low threshold are used to perform defect judgment on each sub-block in the four-neighborhood difference graph; the judgment formula is: Among them, Label(i,j)=2 represents a strong defect point, Label(i,j)=1 represents a weak defect point, and Label(i,j)=0 represents a background point.

6. The method for rapid detection of surface defects of cold-rolled strip steel based on four-neighborhood difference according to claim 5, characterized in that: The implementation process of the region growing algorithm includes: S1. Construct an empty candidate point queue, set a strong defect point as a seed point, and add the seed point to the empty candidate point queue; S2. When the candidate point queue is not empty, take a seed point from the candidate point queue and check the 8 neighboring points of the selected seed point; S3. When there is a point in the 8 neighborhood points that has not been visited and Label(i,j)≥1, the point is marked as visited, the candidate point queue is returned, and the Label value of the point is updated to 2; S4. Repeat steps S2-S3 until the candidate point queue is empty, obtain all points with Label=2, and form a complete defect area.

7. The method for rapid detection of surface defects of cold-rolled strip steel based on four-neighborhood difference according to claim 6, characterized in that: The expression of the region growing algorithm is: R(p)={n∈N(p)|Label(n)≥1∧Visited(n)=false} Where n is a point in the 8-neighborhood point set, R(p) is the growth region of point p, N(p) is the 8-neighborhood point set of point p, Label(n) represents the label value of point n, and Visited(n) represents whether point n has been visited.