## 3 Rapid Quality Screening and Defect Feature Extraction Algorithm on the Strip Steel Surface
### Strip Steel Edge and Background Region Automatic Detection
Corresponding to gray-scale value of each row and column, the algorithm calculated the maximum gray-scale values (R\({}_{\text{Max}}\), C\({}_{\text{Max}}\)), minimum gray-scale values (R\({}_{\text{Min}}\), C\({}_{\text{Min}}\)) and average gray-scale values (R\({}_{\text{Avg}}\), C\({}_{\text{Avg}}\)) for each row and column, where Global\({}_{\text{Avg}}\) is the global average gray-scale value of the image and \(\mu\) is the threshold coefficient of the defect (\(\mu\) ranging from 20% to 30%). In this paper, \(\mu\) was set at 30%. (1) If the difference [C\({}_{\text{Max}}\)-C\({}_{\text{Min}}\)] between the maximum gray-scale value and minimum gray-scale value on the vertical projection is not within (1 \(\pm\)\(\mu\)) Global\({}_{\text{Avg}}\), the column of the image is defect-free. (2) If the [C\({}_{\text{Max}}\)-C\({}_{\text{Min}}\)] and C\({}_{\text{Avg}}\) on the vertical projection is in the range of (1 \(\pm\)\(\mu\)) Global\({}_{\text{Avg}}\), the column of the image is a defective image. (3) If the [C\({}_{\text{Max}}\)-C\({}_{\text{Min}}\)] in (1 \(\pm\)\(\mu\)) Global\({}_{\text{Avg}}\), but C\({}_{\text{Avg}}\) < (1 - 2\(\mu\)) Global\({}_{\text{Avg}}\), the average gray projection value in this column is too low. This means the column of the image is the transform region between the strip steel edge and background. (4) If extended two times the length of the transform region across columns, it is the false defect region. (5) If the [C\({}_{\text{Max}}\)-C\({}_{\text{Min}}\)] is not within (1 \(\pm\)\(\mu\)) Global\({}_{\text{Avg}}\) and C\({}_{\text{Avg}}\) are much smaller (over 10 times) than the value of Global\({}_{\text{Avg}}\). This means the average gray projection value of the column is too low and the column is background. (6) If the [C\({}_{\text{Max}}\)-C\({}_{\text{Min}}\)] is not within (1 \(\pm\)\(\mu\)) Global\({}_{\text{Avg}}\), but C\({}_{\text{Avg}}\) is 1.5 times to 2 times as much as Global\({}_{\text{Avg}}\), the column of the image is a highlighted defective. Before image pre-processing, the strip steel image should be digitally transformed into a gray-scale image. Firstly, define two one-dimensional matricews R[M] and C[N], where M, N is the number of rows and columns of the image. With the help of two arrays to store the image's average gray-scale values on horizontal and vertical projections, the paper used the following algorithm to detect images. The pseudo-code of strip steel surface rapid quality screening and the defect feature extraction algorithm based on gray-scale projection are shown below in Algorithm 1:  
Figure 4: Strip steel defect acquisition region processed by the Canny edge detection operator. ```
Input: original image matrix \(f(i,j)\), Size = M \(\times\) N, ie[0, M \(-\) 1], je [0, N \(-\) 1] Output: ROI Defect Region
```  
**Step 1. Calculate Initial Values for int R = 0, R \(\leq\) i, R++; \(\triangle\)Calculate the matrix by rows, fixed the rows first for int j = 0; j \(\leq\) N \(-\) 1, j++; \(\triangle\)Iterate through the columns of the matrix \(\{\rm f(R_{j})\}\), Size = M \(\times\) 1 \(\rm R_{Max}=Max(f(R_{j}))\), Size = 1 \(\times\) 1 \(\rm R_{Min}=Min(f(R_{j}))\), Size = 1 \(\times\) 1 \(\rm R_{Avg}=Sum(f(R_{j}))/M\), Size = 1 \(\times\) 1 \(\rm Add\ R_{Avg}\) into R[M], Return R[M], Size = M \(\times\) 1 \(\triangle\)The same principle is used to calculate the matrix by column to obtain C[N], Size = 1 \(\times\) N \(\rm Global_{Avg}[M,N]=Sum(R[M])/M\) Or Sum(C[N])/N, Size = 1 \(\times\) 1 Step 2. Confirm Detection Region ifR\({}_{Avg}\) Or C\({}_{Avg}<<\rm Global_{Avg}[M,N]\); \(\triangle\)The row or column is the background area \(\rm Defect\) the Row or Column with low projection value  Add rest of area into Confirm Detection Region Step 3.