A Method for Extracting Corrosion Features of a Highly Reflective Surface
By converting the RGB image of the environmental test sample into a saturation image, and applying the grayscale symbiosis matrix and K-means classification method, the corrosion characteristics of the highly reflective surface samples are extracted, and the problems of high detection cost, strong subjectivity and low accuracy in the prior art are solved, and efficient and accurate defect detection is achieved.
Patent Information
- Application Number
- CN202210196590.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-02
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2042-03-02
AI Technical Summary
In the existing environmental tests, defect detection of high-reflective surface samples has problems such as high manual inspection costs, strong subjectivity of detection results, and low detection accuracy.
Corrosion images of different scale features are extracted by converting the RGB images of the original corrosion samples into saturation images and applying a grayscale symbiosis matrix in different resolution images of the image pyramid. Then, using the edge statistical information of the initially extracted corrosion characteristics, unsupervised classification based on K-means is performed to remove interference terms, and efficient and highly robust extraction of corrosion characteristics of high-reflective surfaces is achieved.
It realizes fast and accurate defect detection of high-reflective surface samples, reduces labor costs, and improves detection efficiency and accuracy.
Smart Images

Figure CN114596271B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a rapid detection method for environmental tests, and particularly to a surface defect detection method for corrosion specimens with high reflectivity characteristics, belonging to the field of environmental tests. Background Art
[0002] Environmental testing is a common method for verifying whether materials and products meet the effectiveness of the expected quality goals in research and development, design, and manufacturing. Evaluating the damage degree of the specimens under test in environmental testing is an important part of environmental testing. Salt spray environmental testing is a type of environmental testing, and the test objects are specimens made of metal materials such as steel materials and aluminum alloy materials. After the test, it is necessary to evaluate the damage degree of these tested materials. The traditional evaluation uses the method of manually visually inspecting the specimens. This detection method requires a large amount of manpower and material resources, and the subjectivity of the detection results is strong. The detection results are easily affected by the experience and fatigue of the detection personnel. There have been relevant studies using machine vision methods to replace manual visual measurement. However, when these vision measurement devices face the photographed surface with high reflectivity, the photographing device will also form an image through the reflection of the surface of the object under test, forming a black shadow area on the surface of the object under test, resulting in uneven illumination intensity of the photographed image, affecting the extraction of the truly required detection target, and causing low accuracy of the detection results. Summary of the Invention
[0003] In order to solve the problems of high cost of manual detection, strong subjectivity of detection results, and low detection accuracy in the existing defect detection of environmental test specimens. The main purpose of a corrosion image feature extraction method for corrosion environmental tests disclosed by the present invention is: to provide a method for quickly detecting defects of specimens after environmental tests by taking pictures. By converting the original RGB image of the corrosion specimen into a saturation image, the corrosion feature area is more obvious compared with the background; by applying the gray-level co-occurrence matrix in the images of different resolutions of the image pyramid, corrosion images with different scale features are extracted; through the edge statistical information of the preliminarily extracted corrosion features, after performing unsupervised classification based on K-means on these edge statistical information, the removal of interference items in the initially extracted targets is realized, and the efficient and highly robust extraction of corrosion features on the reflective surface is realized.
[0004] The object of the present invention is achieved by the following technical solutions.
[0005] A corrosion feature extraction method applicable to specimens with high-reflective surfaces disclosed by the present invention includes the following steps:
[0006] Step 1: Calculate the saturation of the original color image to obtain a saturation image with the same size as the original image;
[0007] Step 2: Downsample the original image size saturation image, and downsample the downsampled image again. Repeat this process multiple times to obtain a saturation image pyramid composed of multiple multi-resolution images;
[0008] Step 3: For each image at each resolution in the saturation image pyramid, calculate the gray-level co-occurrence matrices in four directions of 0°, 90°, 180°, and 270° at a distance of N with each pixel as the center within a sliding window of an appropriate size radius, and calculate the contrast of the gray-level co-occurrence matrix of each central pixel as the energy value of this central pixel to form a texture energy map;
[0009] The appropriate size is one-tenth of the minimum defect size;
[0010] Step 3.1: Take an image at a certain resolution in the saturation image pyramid, select a certain pixel in the image, use this pixel as the center, with a radius of K, select (2K - 1)×(2K - 1) pixels in the image to establish a window. If the image pixels in the window exceed the image boundary, the exceeded part is filled in by the mirror method;
[0011] Step 3.2: Within this window, calculate the gray-level co-occurrence matrices in four directions of 0°, 90°, 180°, and 270° at a distance of N respectively, and calculate the contrasts C0, C 90 、C 180 、C 270 of the gray-level co-occurrence matrices in the four directions, calculate the maximum value among C0, C 90 、C 180 、C 270 as the energy value of the central pixel of this window;
[0012] Step 3.3: Repeat Step 3.1 and Step 3.2, traverse all pixels of this image in the saturation image pyramid to obtain the texture energy map of this image;
[0013] Step 3.4: Repeat Step 3.3 to obtain the texture energy map corresponding to each image in the saturation image pyramid;
[0014] Step 4: By the method of adaptive threshold, calculate all the texture energy maps obtained in Step 3 to obtain a binary template of "corrosion feature mask" including real corrosion features and "pseudo-corrosion" caused by reflections in the environment;
[0015] Step 4.1: For each texture energy map, perform segmentation by the method of adaptive threshold to obtain an alternative region mask of corrosion features under each resolution image;
[0016] Step 4.2: Restore the alternative region mask obtained in Step 4.1 to the original image size by means of cubic interpolation to obtain the binarization template of the "erosion feature mask".
[0017] Step Five: Merge the binarization templates of the "erosion feature mask" at each resolution in the saturation image pyramid to obtain the "initially extracted erosion feature mask" of the original image size.
[0018] Step Six: Perform a logical operation on the "initially extracted erosion feature mask" and the original image to obtain multiple connected regions; use morphological methods to extract the edges of the "initially extracted erosion feature mask" of the original image size; then calculate the gradient vectors of all pixels on the edge region, and perform feature extraction on the gradient vectors of all edges to obtain the edge statistical information of each connected region.
[0019] Step 6.1: Calculate the connected regions for the "initially extracted erosion feature mask" to obtain multiple connected regions.
[0020] Step 6.2: Select a connected region, and perform a morphological operation of first dilating and then eroding on this connected region with the structuring element [1,1; 1,1] to obtain the positions of the edge pixels.
[0021] Step 6.3: For each connected region D k of the edge region A k , 1 ≤ k ≤ n, calculate the central pixel P0(x0,y0) of the connected region D k ; starting from the pixel P0, for each pixel P k of the edge region A i (x i ,y i ) ∈ A k as the end point, establish multiple connection lines, and calculate the angle θ i of each connection line; then, with the pixel P i as the center, along the angle θ i , respectively take t pixels inside and outside the connected region boundary, and the vector G(g1,g2,…g 2t+1 ) composed of the gray values of the 2t + 1 pixels is the gradient vector of the pixel P k of the edge region A i .
[0022] Step 6.4: Repeat Step 6.3 to calculate the gradient vectors of all pixels P k on the edge region A i (x i ,y i ) ∈ A k , and perform feature extraction on the gradient vectors of all edges to obtain the edge statistical information of each connected region D kEdge statistical information; the features include: standard deviation, mean, median;
[0023] Step Seven: Use the K-means method of unsupervised classification to remove the "pseudo-corrosion features" caused by the shadow of the imaging device from the "initially extracted corrosion feature mask". The remaining image area is the true corrosion feature, realizing the efficient and highly robust extraction of the defect features of the corrosion sample on the highly reflective surface.
[0024] Beneficial effects
[0025] 1. A method for extracting corrosion features of samples with highly reflective surfaces disclosed by the present invention uses an image processing algorithm to analyze the corrosion features of environmental test samples instead of manual visual inspection. Compared with visual inspection, only a single image of the corrosion sample needs to be collected to complete the detection, reducing the labor cost while improving the detection efficiency and accuracy.
[0026] 2. A method for extracting corrosion features of samples with highly reflective surfaces disclosed by the present invention constructs a gradient vector by using the edge pixels in the image, and removes the "pseudo-corrosion features" formed by the shadow of the imaging device in the image from the true corrosion features. The method disclosed by the present invention improves the detection efficiency of corrosion features compared with the extraction method directly using image segmentation.
[0027] 3. A method for extracting corrosion features of samples with highly reflective surfaces disclosed by the present invention classifies the standard deviation, mean, and median of the gradient vectors of each alternative region by using the K-means method of unsupervised classification. Compared with using deep learning methods, which require a large number of images for manual annotation and network training, the method disclosed by the present invention can simply and efficiently identify the corrosion regions in the image, saving the time of manual annotation and sample training. Description of the drawings
[0028] Figure 1 It is a flowchart of the method for extracting corrosion features of samples with highly reflective surfaces disclosed by the present invention;
[0029] Figure 2 It is the process images generated during Steps One to Five. Among them, Figure a is the original image; Figure b is the saturation image pyramid; Figure c is the initially extracted corrosion feature mask
[0030] Figure 3 It is the content used for calculating edge statistical information in Step Six.
[0031] Figure 4 It is the corrosion feature images before and after removing the "pseudo-corrosion features" after Steps Six and Seven; among them, Figure a is the corrosion feature image before removing the "pseudo-corrosion features"; Figure b is the corrosion feature image after removing the "pseudo-corrosion features". Detailed implementation mode
[0032] To better illustrate the purpose and advantages of the present invention, the following further describes the invention content in conjunction with the attached drawings and examples.
[0033] A method for extracting corrosion features applicable to high-reflective surface samples disclosed in this embodiment processes the corrosion images of high-reflective surface samples in environmental tests, and can efficiently extract the corrosion features in a batch of samples. Compared with the traditional manual visual inspection, the entire detection process only needs to obtain the detection images of the sample surface, reducing the detection cost and improving the detection efficiency. Through the method proposed in this embodiment, the interference of "pseudo-corrosion features" caused by the shadow of the imaging device on the detection result can be reduced, and the defect detection accuracy of high-reflective surface samples can be improved.
[0034] As Figure 1 shown, a method for extracting corrosion features applicable to high-reflective surface samples disclosed in this embodiment is specifically implemented as follows:
[0035] Step 1: Calculate the saturation of the original color image to obtain a saturation image with the same size as the original image;
[0036] To calculate the saturation image of the original image, the following method is used for calculation:
[0037] For the pixel P at the i-th row and j-th column in the original image i,j , the saturation S i,j The calculation formula is as follows:
[0038]
[0039] where R i,j is the gray value of the red channel of this pixel P i,j , G i,j is the gray value of the green channel of this pixel P i,j , B i,j is the gray value of the blue channel of this pixel P i,j .
[0040] Step 2: Downsample the saturation image with the size of the original image, and then downsample the downsampled image again. Do this N times to obtain a saturation image pyramid composed of N + 1 multi-resolution images. Usually, N = 3 is taken;
[0041] Step 3: For each image at each resolution in the saturation image pyramid, with each pixel as the center, calculate the gray-level co-occurrence matrices in the four directions of 0°, 90°, 180°, and 270° at a distance of 1 within a sliding window with an appropriate size radius, and calculate the contrast of each direction gray-level co-occurrence matrix as the value of this central pixel to form a texture energy map;
[0042] Step 3.1: Take an image at a certain resolution in the saturation image pyramid, select a certain pixel in the image, and use this pixel as the center and a radius of K to select (2K - 1)×(2K - 1) pixels in the image to establish a window. If the image pixels in the window exceed the image boundary, the exceeded part is filled by the mirror method;
[0043] Step 3.2: Within this window, calculate the gray-level co-occurrence matrices in four directions of 0°, 90°, 180°, and 270° respectively, and calculate the contrast C0, C 90 、C 180 、C 270 of the gray-level co-occurrence matrices in the four directions. Calculate the maximum value among C0, C 90 、C 180 、C 270 as the texture energy value of the central pixel of this window;
[0044] Step 3.3: Repeat Step 3.1 and Step 3.2, traverse all the pixels of this image in the saturation image pyramid to obtain the texture energy map of this image;
[0045] Step 3.4: Repeat Step 3.3 to obtain the texture energy maps corresponding to each image in the saturation image pyramid;
[0046] Step Four: By the method of adaptive threshold, calculate all the texture energy maps obtained from the saturation image pyramid to obtain a binary template of the "corrosion feature mask" including both real corrosion features and "pseudo-corrosion" caused by reflections in the environment;
[0047] Step 4.1: For each texture energy map, perform segmentation by the method of adaptive threshold to obtain an alternative region mask of corrosion features at each resolution image;
[0048] Step 4.2: Restore the alternative region masks at each resolution obtained in Step 4.1 to the original image size by the method of cubic interpolation;
[0049] Step Five: Merge the "corrosion feature masks" at each resolution in the saturation image pyramid to obtain an "initially extracted corrosion feature mask" of the original image size;
[0050] Figure 2 Shows the process from Step One to Step Five. (a) is the original image; (b) is the saturation image pyramid; (c) is the initially extracted corrosion feature mask.
[0051] Step 6: Perform a logical operation on the "initially extracted corrosion feature mask" and the original image to obtain multiple connected components; use morphological methods to extract the edges of the "initially extracted corrosion feature mask" with the size of the original image; then calculate the gradient vectors of all pixels on the edge region, and perform feature extraction on the gradient vectors of all edges to obtain the edge statistical information of each connected component;
[0052] Step 6.1: Perform an 8-connected component calculation on the "initially extracted corrosion feature mask" to obtain multiple connected components D1, D2, … D n , where n is the number of connected components;
[0053] Step 6.2: For each connected component D k , 1 ≤ k ≤ n, perform a morphological operation of dilation followed by erosion on this connected component with the structuring element [1,1; 1,1] to obtain the edge region A k of this connected component D k ;
[0054] Step 6.3: For the edge region A k of each connected component D k , 1 ≤ k ≤ n, calculate the central pixel P0(x0, y0) of the edge region A k . Taking the central pixel P0 as the starting point and a certain pixel P k (x i , y i ) ∈ A i of this connected component's edge region A k as the end point, establish a connection line, calculate the angle of this connection line, and obtain the connection line angle θ i . After that, with the edge region pixel P0 as the center, along the angle θ i , respectively take t pixels inside and outside the connected component boundary. The vector G(g1, g2, … g 2t+1 ) composed of the gray values of the edges of these 2t + 1 pixels is the gradient vector of the edge region A k pixel P i ;
[0055] Step 6.4: Repeat Step 6.3 for all pixels P k on the edge region A i (x i , y i ) ∈ A k , calculate the gradient vectors of the edges, and use statistical methods for these edge gradient vectors to obtain the edge statistical information of each connected component D k ;
[0056] Step 6.4.1: For each pixel P k on the edge region A k of each connected component Dq (x q , y q ) ∈ A k , calculate the standard deviation S of all elements of the gradient vector of the pixel P q where q is the average value of g1, g2, … g
[0057]
[0058] Step 6.4.2: Repeat Step 6.4.1 to obtain the standard deviation S corresponding to all pixels P on the edge region A Take the average value of these standard deviations 2t+1 This average value
[0059] is the edge statistical information of the connected domain D k q q k
[0060] Figure 3 Figure shows the "connected domain edge region", "connected domain center pixel", "connection line between connected domain edge pixel and center pixel", and "pixels constituting the edge gradient vector" used in calculating the edge statistical information in Step 6
[0061]
[0062] Figure 4
[0063] Step 7: Use the K-means method to perform unsupervised classification on the edge statistical information of all connected domains D1, D2, … D n Remove the connected domain of "pseudo-corrosion feature" caused by the shadow of the imaging device from all connected domains of the "initially extracted corrosion feature mask", and the remaining image area is the real corrosion feature, completing the extraction of the corrosion feature of the highly reflective surface sample Figure shows the corrosion feature images before and after removing the "pseudo-corrosion feature" caused by the device shadow through Step 6 and Step 7. (a) is the image without removing the "pseudo-corrosion feature" caused by the device shadow, and (b) is the real corrosion feature image after removing the "pseudo-corrosion feature" caused by the device shadow
[0062] Figure 4
[0063] The above specific description further details the purpose, technical solution, and beneficial effects of the invention. It should be understood that the above is only a specific embodiment of the present invention and is not used to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention
Claims
1. A method for extracting corrosion features applicable to samples with highly reflective surfaces, characterized in that: including the following steps, Step 1: Calculate the saturation of the original color image to obtain a saturation image with the same size as the original image; Step 2: Downsample the saturation image of the original image size, and downsample the downsampled image again. Repeat this process multiple times to obtain a saturation image pyramid composed of multiple multi-resolution images; Step 3: For each image at each resolution in the saturation image pyramid, with each pixel as the center, calculate the gray-level co-occurrence matrix in four directions of 0°, 90°, 180°, and 270° at a distance of N within a sliding window with an appropriate size radius, and calculate the contrast of the gray-level co-occurrence matrix of each central pixel as the energy value of this central pixel to form a texture energy map; The appropriate size is one-tenth of the minimum defect size; Step 4: By using the method of adaptive threshold, calculate all the texture energy maps obtained in Step 3 to obtain a binary template of the "corrosion feature mask" including real corrosion features and "pseudo-corrosion" caused by reflections in the environment; Step 5: Merge the binary templates of the "corrosion feature mask" at each resolution in the saturation image pyramid to obtain the "preliminary extracted corrosion feature mask" of the original image size; Step 6: Perform a logical operation on the "preliminary extracted corrosion feature mask" and the original image to obtain multiple connected regions; use the morphological method to extract the edges of the "preliminary extracted corrosion feature mask" of the original image size; then calculate the gradient vectors of all pixels in the edge region, and extract the features of all the gradient vectors of the edges to obtain the edge statistical information of each connected region; Step 7: By using the K-means method, perform unsupervised classification on the edge statistical information of all connected domains D1, D2, … D n to remove the "pseudo-corrosion features" caused by the shadow of the imaging device from the "initially extracted corrosion feature mask", and the remaining image area is the true corrosion feature, so as to extract the defect features of the corrosion sample on the highly reflective surface. 2. The method for extracting corrosion features applicable to samples with highly reflective surfaces according to claim 1, characterized in that: The implementation method of Step 3 is as follows, Step 3.1: Take an image at a certain resolution in the saturation image pyramid, select a pixel in the image, with this pixel as the center and a radius of K, select (2K - 1)×(2K - 1) pixels in the image to establish a window. If the image pixels in the window exceed the image boundary, the exceeded part is filled by the mirror method; Step 3.2: Inside this window, calculate the gray-level co-occurrence matrices in four directions of 0°, 90°, 180°, and 270° at a distance of N respectively, and calculate the contrasts C0, C 90 , C 180 , C 270 , calculate the maximum value among C0, C 90 , C 180 , C 270 , and use it as the energy value of the central pixel of this window; Step 3.3: Repeat Step 3.1 and Step 3.2 to traverse all the pixels of this image in the saturation image pyramid to obtain the texture energy map of this image; Step 3.4: Repeat Step 3.3 to obtain the texture energy map corresponding to each image in the saturation image pyramid.
3. The method for extracting corrosion features applicable to samples with highly reflective surfaces according to claim 2, characterized in that: The implementation method of Step 4 is as follows, Step 4.1: For each texture energy map, perform segmentation by using the method of adaptive threshold to obtain an alternative region mask of corrosion features under each resolution image; Step 4.2: Restore the alternative region mask obtained in Step 4.1 to the original image size by using the method of cubic interpolation to obtain the binary template of the "corrosion feature mask".
4. The method for extracting corrosion features applicable to samples with highly reflective surfaces according to claim 1 or 2, characterized in that: The implementation method of Step 6 is as follows, Step 6.1: Calculate the connected regions of the "preliminary extracted corrosion feature mask" to obtain multiple connected regions; Step 6.2: Select a connected region and perform a morphological operation of first dilating and then eroding on this connected region with a structural element [1,1;1,1] to obtain the edge pixel positions; Step 6.3: For each connected component D k 's edge region A k , 1 ≤ k ≤ n, calculate the central pixel P0(x0, y0) of the connected component D k ; starting from the pixel P0, for each pixel P k in the edge region A i (x i , y i ) ∈ A k as the end point, establish multiple connection lines, and calculate the angle θ i of each connection line; then, with the pixel P i as the center, along the angle θ i , respectively take t pixels inside and outside the boundary of the connected component. The vector G(g1, g2,... g 2t+1 ) composed of the gray values of 2t + 1 pixels is the gradient vector of the pixel P k in the edge region A i . Step 6.4: Repeat Step 6.3 to calculate the edge region A k for all pixels P i (x i , y i ) ∈ A k of the gradient vectors, perform feature extraction on the gradient vectors of all edges to obtain the edge statistical information of each connected domain D k ; The features include: standard deviation, mean, median.
Citation Information
Patent Citations
Sea-sky-line detection method and system based on gray level co-occurrence matrix and Hough transformation
CN109978869A
Concave-convex mark visual detection method based on neighborhood decision and gray level co-occurrence matrix description
CN112233116A