Marine metal corrosion degree detection method based on image processing

In marine metal corrosion detection, image processing technology is used to calculate the probability and characteristics of pixel points, and determine the analysis area and shadow area, which solves the problem that traditional methods are difficult to identify small raised areas, and achieves more accurate corrosion degree detection.

CN119313656BActive Publication Date: 2025-04-11XIAN HANGYU TITANIUM NEW MATERIAL TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411844273.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-04-11
Estimated Expiration
2044-12-16

AI Technical Summary

Technical Problem

Traditional image segmentation methods are difficult to accurately identify smaller raised areas on the surface of marine metal, affecting the accuracy of corrosion degree detection.

Method used

By obtaining multiple grayscale maps of marine metal samples, the probability that each pixel point belongs to the background pixel point is calculated, and the target pixel point and background pixel point are determined. Then, based on the characteristics of the target pixel point, the probability of belonging to the analysis pixel point is calculated and the analysis area is determined. Further, the inner edge pixel points and shadow areas are determined by the fluctuation characteristics of the grayscale values ​​of adjacent pixel points in the gradient direction of the edge pixel points, and finally the corrosion degree is determined based on the area proportion of the analysis area and the shadow areas.

Benefits of technology

Accurate identification of smaller raised areas on the surface of marine metal and accurate assessment of the degree of corrosion, improving the accuracy and persuasiveness of the detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119313656B_ABST
    Figure CN119313656B_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, and in particular to a method for detecting the degree of marine metal corrosion based on image processing. The method comprises the following steps: obtaining a plurality of grayscale images of marine metal samples, taking the probability that a pixel point belongs to a background pixel point as a first probability, dividing a target pixel point and a background pixel point based on the first probability, taking the probability that the target pixel point belongs to an analysis pixel point as a second probability, determining an analysis area according to the second probability, calculating the probability that the edge pixel point belongs to an inner edge pixel point according to the fluctuation characteristics of the grayscale values ​​of the edge pixel points in the analysis area and the adjacent pixel points in the gradient direction as a third probability, determining the inner edge pixel points according to the third probability, traversing the inner edge pixel points along a main direction, jointly determining a shadow area according to the traversed pixel points and preset conditions, and determining the degree of corrosion according to the area ratio of all analysis areas to all shadow areas, thereby improving the accuracy of detecting the degree of marine metal corrosion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method for detecting the degree of marine metal corrosion based on image processing. Background Art

[0002] The complexity of the marine environment makes the corrosion behavior of metal materials in the ocean affected by many factors, such as salinity, temperature, humidity and biological factors. Metal corrosion in the marine environment is often uneven, especially in the case of local corrosion (such as pitting), small protrusions will form on the metal surface. These protrusions are caused by the accumulation of corrosion products formed by chemical reactions between the metal and substances in the environment (such as oxygen, water, salt, etc.). If the metal surface is originally coated with a protective layer (such as a coating, plating, etc.), corrosion may cause local damage to these protective layers, forming smaller and more dispersed protrusions. In areas where the protective layer has been damaged, larger and more dense protrusions will be formed. These protrusions may be the result of peeling or blistering of the protective layer. In order to ensure the safe operation of marine metal structures and extend their service life, it is crucial to accurately detect and evaluate the degree of corrosion. The corrosion detection methods of the existing technology, such as electrochemical detection and ultrasonic detection, are reliable but have some shortcomings. These methods usually rely on manual operation, which is not only inefficient, but also subjective and easily affected by human factors.

[0003] In recent years, with the rapid development of computer vision and image processing technology, the detection method based on image processing is suitable for the field of marine metal corrosion detection due to its advantages of non-contact, real-time and high efficiency. For example, the Chinese patent application document with the existing application publication number CN111028229A discloses a metal or coating corrosion detection method based on image processing technology: collecting color corrosion images; preprocessing the color corrosion images to obtain preprocessed images; performing image segmentation on the preprocessed images to obtain binary images, which are images that can determine whether each pixel in the image belongs to the corrosion area or the background area; extracting the features of the binary images; and evaluating the corrosion level according to the features of the binary images. Another example is a Chinese patent document with an existing authorization announcement number of CN113484229B, which discloses a device and method for evaluating the corrosion state of metal parts under simulated marine multi-parameter conditions, wherein the corrosion state evaluation device includes two inner and outer water reservoirs, and the inner water reservoir is installed in a nested manner in the middle of the outer water reservoir. The inner and outer water reservoirs can form a circulating ecological seawater flow, which solves the technical problem that marine corrosion experiments cannot be carried out in the laboratory when there is no marine environment. The evaluation method uses a monitoring method based on an image processing method to determine the corrosion rate, and the acquired image is identified using the Otsu method and regional growth. The area of ​​the corrosion region is obtained according to the total number of pixels in the image, and the corrosion area change value is matched with the corrosion rate measured by the linear polarization method, and the corrosion rate is quickly determined through real-time image monitoring.

[0004] However, when identifying the corrosion areas on the metal surface, some protrusions caused by corrosion are small and difficult to identify, and are easily affected by light. Using traditional image segmentation methods, it is impossible to accurately and completely identify these protruding areas, resulting in inaccurate detection of the degree of marine metal corrosion. Summary of the invention

[0005] In order to solve the problem that the traditional image segmentation method cannot accurately and completely identify the smaller raised areas on the surface of marine metal, thus affecting the accuracy of the corrosion degree detection result, the present invention proposes a marine metal corrosion degree detection method based on image processing, comprising:

[0006] Acquire multiple grayscale images of the marine metal sample during the immersion process, calculate the probability that a pixel point of each grayscale image belongs to a background pixel point as a first probability, determine the target pixel point and the background pixel point based on the magnitude of the first probability, calculate the probability that the target pixel point belongs to the analysis pixel point as a second probability, and determine the analysis pixel point and the analysis area according to the magnitude of the second probability;

[0007] For each analysis area, the probability that the edge pixel belongs to the inner edge pixel of the analysis area is calculated as the third probability according to the fluctuation characteristics of the gray value of the edge pixel and its adjacent pixel in the gradient direction, and the inner edge pixel of the analysis area is determined according to the magnitude of the third probability; the average gradient direction of all the inner edge pixels is taken as the main direction of the analysis area;

[0008] The inner edge pixels are traversed along the main direction, and the shadow pixels and shadow areas are determined based on the entropy values ​​of the grayscale differences of all adjacent pixels that have been traversed and the first probability of the pixels to be traversed. The degree of corrosion is determined based on the ratio of the area of ​​all analysis areas to the area of ​​all shadow areas.

[0009] After obtaining multiple grayscale images of marine metal samples during the immersion process, this technical solution divides the target pixels and background pixels according to the probability that each pixel belongs to the background pixel. The target pixel corresponds to the raised area on the metal surface. The pixels in these raised areas are subsequently analyzed. This operation clarifies the object and basic classification of image processing, laying the foundation for the subsequent analysis of the target pixel, so that the research can focus on the raised area on the metal surface and effectively avoid the interference of background pixels. Then, by comprehensively calculating the probability that the target pixel belongs to the analysis pixel, the pixels with specific characteristics can be more comprehensively and accurately selected as analysis pixels, and then a more targeted analysis area can be determined. Screening based on the probability that the target pixel belongs to the analysis pixel can highlight those pixels and their areas that show corrosion-related characteristics in multiple feature dimensions. In this way, the subsequent analysis of these key areas will be more targeted, reducing unnecessary calculations and reducing the possibility of misjudgment. Then, the probability that the edge pixel belongs to the inner edge pixel is determined by analyzing the fluctuation characteristics of the grayscale value of the edge pixel, which is conducive to accurately identifying the internal boundary of the analysis area. Since the inner edge pixels are adjacent to the shadow area, accurately determining the inner edge is extremely critical for the subsequent accurate segmentation of the shadow area and analysis of corrosion characteristics. Determining the inner edge pixels can clarify the boundary between the analysis area and the shadow area, and the determination of the main direction provides a direction basis for the subsequent pixel traversal and shadow area determination. By traversing along the main direction to determine the shadow pixels and shadow areas, the shadow part related to the raised area can be accurately separated. The characteristics of the shadow area may be related to the degree of corrosion. Accurately identifying the shadow area helps to more comprehensively grasp the state information of the marine metal surface in this step and add more valuable information to the assessment of the degree of corrosion. Finally, the degree of corrosion is determined by comprehensively considering the relevant information of the analysis area (raised area) and the shadow area, so that multiple factors are integrated in the final corrosion degree determination link to improve the accuracy and persuasiveness of the detection results, thereby effectively solving the shortcomings of traditional methods and providing a more reliable and accurate means for the detection of marine metal corrosion.

[0010] Preferably, the calculation process of the probability that each pixel of the grayscale image belongs to a background pixel is:

[0011] For Grayscale image, for The grayscale histogram of the grayscale image is Gaussian fitted to obtain the maximum peak of the grayscale histogram;

[0012] Calculate the probability that each pixel of the grayscale image belongs to the background pixel:

[0013] ;

[0014] In the formula, It is Grayscale image The probability that a pixel belongs to a background pixel is is the preset parameter for adjusting the sequence number of the grayscale image. For the The pixel at The grayscale value in the grayscale image, For the The maximum peak value of the grayscale histogram corresponding to the grayscale image, is the absolute value symbol.

[0015] This scheme calculates the probability that a pixel belongs to a background pixel by obtaining the maximum peak value through Gaussian fitting of the grayscale histogram of adjacent grayscale images. It takes into account the grayscale change information in the time dimension, making the judgment of background pixels more dynamic and accurate, and can better adapt to the state changes of marine metal samples during the immersion process, thereby improving the accuracy and reliability of pixel classification and providing accurate basic data for subsequent analysis.

[0016] Preferably, the method for determining the target pixel and the background pixel based on the magnitude of the first probability is:

[0017] Pixel points whose first probability is greater than or equal to a preset first probability threshold are taken as background pixel points, and pixel points whose first probability is less than the preset first probability threshold are taken as target pixel points.

[0018] Preferably, the probability that the target pixel belongs to the analysis pixel satisfies the following relationship:

[0019] ;

[0020] In the formula, It is Grayscale image The probability that a target pixel belongs to the analysis pixel, It is The target pixel is at The average gray value of the grayscale image, It is Grayscale image The probability that a target pixel belongs to a background pixel is It is Grayscale image The average gray value of the eight neighboring pixels of the target pixel is The variance of the grayscale image, is the natural exponential function, It is Grayscale image The curvature degree of the target pixel, is the absolute value symbol.

[0021] This scheme comprehensively considers multiple factors such as the curvature of the target pixel, the difference between the average grayscale value and the maximum grayscale value, the probability of belonging to the background pixel, and the neighborhood grayscale mean variance to determine the probability that the target pixel belongs to the analysis pixel. It comprehensively reflects the various characteristics of the target pixel, making the determination of the analysis pixel more accurate and reliable, and thus determining a more targeted analysis area.

[0022] Preferably, the method for determining the analysis pixel point and the analysis area according to the size of the second probability is:

[0023] If the second probability that a certain target pixel belongs to the analysis pixel is greater than or equal to a preset second probability threshold, the target pixel is the analysis pixel, and region growing is performed on all analysis pixels to obtain a corresponding analysis region.

[0024] Preferably, the calculation formula for the probability that an edge pixel point belongs to an inner edge pixel point of the analysis area is:

[0025]

[0026] In the formula, It is Grayscale image The analysis area The edge pixel belongs to The third probability of the inner edge pixels of the analysis area is It is Grayscale image The analysis area The gray value of the edge pixel, , Respectively Grayscale image The analysis area The grayscale values ​​of the first and second adjacent pixels in the gradient direction of the edge pixel, is the absolute value symbol.

[0027] This scheme can effectively identify the fluctuation of the grayscale values ​​of adjacent pixels in the gradient direction of edge pixels. If the grayscale value of an edge pixel is significantly different from that of its adjacent pixels in the gradient direction, it means that the edge pixel may be an inner edge pixel of the analysis area. Determining the position of the inner edge pixel can better identify the boundary of the corrosion area, thereby improving the overall accuracy of corrosion area detection.

[0028] Preferably, the method for determining the curvature degree of the target pixel is:

[0029] The variance of the grayscale mean of the eight neighboring pixels of each target pixel in multiple consecutive grayscale images is taken as the grayscale variance of the target pixel;

[0030] Find a target pixel point on the left and right sides of each target pixel point that is closest to its grayscale variance as a reference pixel point, and calculate the curvature of each target pixel point:

[0031]

[0032] In the formula, It is Grayscale image The curvature of the target pixel. is the arccosine function, For the The direction vector formed by the target pixel and the reference pixel on the left. For the The direction vector formed by the target pixel and the reference pixel on the right, For the modulo operation, is a natural exponential function.

[0033] This scheme calculates the variance of the grayscale mean of the eight-neighborhood pixel points of the target pixel point in multiple continuous grayscale images as the grayscale variance, which reflects the stability and change characteristics of the grayscale of the target pixel point, provides important basic data for the subsequent accurate judgment of the degree of curvature, and enhances the ability to describe the local characteristics of the target pixel point. The grayscale variance is used to find the target pixels on both sides as reference pixels to calculate the degree of curvature. This method fully considers the relationship between the target pixel point and its neighboring pixels, and can more accurately quantify the degree of curvature of the target pixel point, making the capture of the shape change of the raised area more accurate and detailed. The degree of curvature reflects the local geometric characteristics of the target pixel point, and the shape change information of the raised area can be obtained by this, which is conducive to the subsequent accurate identification and distinction of different types of raised areas (such as arc-shaped highlight areas caused by illumination, etc.), because different degrees of curvature may imply different physical characteristics or corrosion states, which helps to preliminarily classify and distinguish the characteristics of the raised area in this step.

[0034] Preferably, the method for determining the inner edge pixel points of the analysis area according to the magnitude of the third probability is:

[0035] In each analysis area, if the third probability that a certain edge pixel point belongs to the inner edge pixel point of the analysis area is greater than or equal to a preset third probability threshold, the edge pixel point is the inner edge pixel point of the analysis area.

[0036] Preferably, the method for determining shadow pixels and shadow areas is:

[0037] A threshold of a preset entropy value; when the entropy value of the grayscale difference value of all adjacent pixels traversed in the main direction is less than the threshold of the entropy value, and the first probability of the pixel to be traversed is greater than the first probability threshold, stop traversing and take all the traversed pixels as shadow pixels;

[0038] All shadow pixel points obtained when the inner edge pixel points of all analysis areas are traversed along the main direction are obtained, and region growth is performed on all shadow pixel points to obtain multiple shadow areas in the grayscale image.

[0039] Preferably, the method for determining the degree of corrosion according to the ratio of the area of ​​all analysis areas to the area of ​​all shadow areas is:

[0040] The area is determined by the number of pixels, and the ratio of the cumulative number of pixels in all analysis areas and the number of pixels in all shadow areas of each grayscale image to the number of all pixels in the grayscale image is used as the corrosion degree of the marine metal sample in the grayscale image;

[0041] Calculate the average growth rate of the corrosion degree of marine metal samples in all grayscale images, as well as the final corrosion degree of marine metal samples ,in, is the average growth rate of corrosion severity, is the corrosion degree of the marine metal sample in the last grayscale image, is the degree of corrosion of the marine metal sample in the first grayscale image.

[0042] The present invention has the following effects:

[0043] The present invention analyzes the curvature of target pixels through refined feature analysis, obtains shape change information of raised areas, helps to distinguish different types of raised areas, such as arc-shaped highlight areas caused by illumination, and preliminarily classifies and identifies these features, accurately screens and analyzes pixel points, determines more targeted analysis areas, reduces unnecessary calculations and reduces the possibility of misjudgment, accurately identifies inner edge pixel points of the analysis area, clarifies the boundary between the analysis area and the shadow area, can accurately segment the shadow area, and further accurately assess the degree of corrosion, thereby achieving accurate identification of smaller raised areas on the surface of marine metals and accurate assessment of the degree of corrosion, effectively solving the shortcomings of traditional image segmentation methods in identifying smaller raised areas, and improving the accuracy of the detection results of the degree of marine metal corrosion. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:

[0045] Figure 1 It is a schematic flow chart of the method of the present invention. DETAILED DESCRIPTION

[0046] 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 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 those skilled in the art without creative work are within the scope of protection of the present invention.

[0047] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0048] Reference Figure 1 The method for detecting the degree of marine metal corrosion based on image processing provided by the present invention comprises steps S1 to S5:

[0049] S1: Acquire multiple grayscale images of the marine metal sample during immersion, calculate the probability that a pixel point of each grayscale image belongs to a background pixel point as a first probability, and determine the target pixel point and the background pixel point based on the magnitude of the first probability.

[0050] The neutral salt spray test (NSS) was used to conduct corrosion tests on marine metal samples. The marine metal samples to be tested were taken out from the salt spray test chamber every hour within 24 hours, and the taken out samples were placed on a horizontal table. The surface images of the metal samples were collected using a camera, and the noise in the collected surface images was removed using Gaussian filtering. The surface images were grayed, and the histogram equalization algorithm was used to enhance the contrast of the surface images to make them clearer.

[0051] Since a surface image is collected every hour, a total of 24 preprocessed surface images corresponding to the preprocessed grayscale images are obtained in 24 hours.

[0052] In each grayscale image, the pixels belonging to the background are usually gray, and the gradient fluctuation in their neighborhood is relatively gentle. The corrosion area is convex due to the stacking of internal corrosion products, resulting in a convex area. The pixels in the convex area are the focus of analysis, so the pixels in the convex area are called target pixels. There is a brighter arc area at the edge of one side of the convex area (that is, the analysis area in this scheme), and a black shadow area on the other side of the convex area. There are obvious differences between the pixels in these convex areas (target pixels) and the background pixels, that is, the grayscale fluctuation in the neighborhood of the target pixel is more violent. Therefore, the background pixels and target pixels in the grayscale image can be distinguished according to the grayscale fluctuation in the neighborhood of the pixel.

[0053] Among them, the calculation process of the probability that each pixel of the grayscale image belongs to the background pixel is:

[0054] For any grayscale image, a rectangular coordinate system is established with the pixel point in the lower left corner as the center, the horizontal axis to the right as the horizontal axis, and the vertical axis upward as the vertical axis. Take the grayscale image as an example, first get the adjacent grayscale image, and calculate the The grayscale histogram of a grayscale image shows the distribution of different gray levels (brightness levels) in the grayscale image. For a grayscale image, the frequency of each grayscale level is calculated and plotted into a histogram. If the background pixels occupy a larger area in the grayscale image, then in the grayscale histogram, the grayscale representing the background color will appear at a higher frequency, which means that the grayscale value of the background pixels will form an obvious peak in the histogram.

[0055] Gaussian fitting is performed on these three grayscale histograms respectively. Gaussian fitting refers to the use of Gaussian function (normal distribution curve) to approximate the data distribution in the histogram. For the grayscale histogram, the grayscale levels with significant frequencies can be found through fitting, especially those peaks representing the background. By performing Gaussian fitting on the grayscale histogram, the maximum peak in each grayscale histogram can be found. The maximum peak corresponds to the most frequently occurring grayscale level, which is likely to be the grayscale level of the background pixel. The maximum peak values ​​of the grayscale histogram of the grayscale image are recorded as , , .

[0056] For Grayscale image For each pixel, calculate the probability that it belongs to the background pixel:

[0057]

[0058] In the formula, It is Grayscale image The probability that a pixel belongs to a background pixel is taken as the first probability. is the preset parameter for adjusting the sequence number of the grayscale image. For the The pixel at The grayscale value in the grayscale image, For the The maximum peak value of the grayscale histogram corresponding to the grayscale image, The values ​​of ,when When it is -1, Indicates The pixel at The grayscale value in the grayscale image and the The maximum peak value of the grayscale histogram of the grayscale image is When it is 0, Indicates The pixel at The grayscale value in the grayscale image and the The maximum peak value of the grayscale histogram of the grayscale image is When is 1, Indicates The pixel at The grayscale value in the grayscale image and the The maximum peak value of the grayscale histogram of the grayscale image, is the absolute value symbol.

[0059] In this formula, the denominator represents the cumulative value of the difference between the grayscale value of the pixel in the continuous grayscale image and the maximum peak value of the grayscale histogram of the grayscale image. The smaller the cumulative value, the smaller the grayscale difference between the pixel and the background pixel of the grayscale image. The closer the pixel is to the background pixel, the more likely it is to be a background pixel, and vice versa.

[0060] Next, for any pixel of any grayscale image, the first probability of the pixel is calculated according to this method, and the method for determining the target pixel and the background pixel based on the magnitude of the first probability is:

[0061] The preset first probability threshold is 0.5 (empirical value, adjustable). If the first probability of a pixel is greater than or equal to 0.5, the pixel is a background pixel. Otherwise, if the first probability of the pixel is less than 0.5, the pixel is taken as a target pixel.

[0062] According to the method in this step, background pixels and target pixels in all grayscale images can be divided.

[0063] S2: Calculate the probability that the target pixel belongs to the analysis pixel as a second probability, and determine the analysis pixel and the analysis area according to the second probability.

[0064] First, the curvature of each target pixel is determined according to the angle between each target pixel and the vectors formed by other target pixels on both sides thereof.

[0065] For any target pixel, obtain the variance of the grayscale mean of its eight neighborhood pixels in multiple continuous grayscale images as the grayscale variance of the target pixel. Then, find a target pixel on the left and right sides of the target pixel that is closest to its grayscale variance as a reference pixel, and get two reference pixels in total.

[0066] For example, in In the grayscale image, The coordinates of the target pixel are , No. The coordinates of the reference pixel on the left side of the target pixel are , No. The coordinates of the reference pixel on the right side of the target pixel are , then The direction vector formed by the target pixel and the reference pixel on its left is: , No. The direction vector formed by the target pixel and the reference pixel on its right is: , then In the grayscale image, The curvature degree of each target pixel is:

[0067]

[0068] In the formula, It is Grayscale image The curvature of the target pixel. is the arccosine function, For the The direction vector formed by the target pixel and the reference pixel on the left. For the The direction vector formed by the target pixel and the reference pixel on the right, For modulo operation. Indicates The difference between the angle between the direction vector formed by the target pixel and its two reference pixels and 180 degrees. The smaller the difference is, the The more likely the target pixel and its two reference pixels are on the same straight line, the more likely it is that the texture belongs to the metal sample itself. Conversely, the greater the difference, the more likely the texture is. The more curved the line formed by the target pixel and its two reference pixels, the The more likely a target pixel belongs to the highlighted arc area in the convex area.

[0069] Next, based on the degree of curvature of the target pixel, the difference between the average grayscale value and the maximum grayscale value of the target pixel in the adjacent grayscale image, the probability that the target pixel belongs to the background pixel, and the variance of the grayscale mean in the neighborhood of the target pixel in the adjacent grayscale image, the probability that the target pixel belongs to the analysis pixel is calculated as the second probability, and the analysis pixel and analysis area are determined according to the size of the second probability.

[0070] Since the target pixel is a pixel of a raised area formed by corrosion, and the raised area includes an arc-shaped area on one edge and a shadow area adjacent to the other side of the arc-shaped area, and since the raised area is caused by corrosion, both the arc-shaped area and the shadow area are parts of the corrosion.

[0071] The characteristics of the pixels in the arc area are high brightness and large grayscale values. The outer edge of the arc area is adjacent to the background pixels, and the inner edge is adjacent to the shadow area. The outer edge of the arc area serves as the boundary between the arc area and the background pixels. The grayscale values ​​of the pixels in the arc area are different from those of the background pixels. Therefore, the fluctuation of the grayscale values ​​around the pixels in the arc area is large. The inner edge of the arc area serves as the boundary between the analysis area and the shadow area. The grayscale values ​​of the pixels in the shadow area are small, and the difference with the grayscale values ​​of the background pixels is small. Therefore, the fluctuation of the grayscale values ​​around the pixels in the shadow area is small.

[0072] In this step, the analysis pixels in the target pixels are first obtained, that is, in order to obtain the pixels in the convex area that belong to the arc area, the probability of each target pixel belonging to the analysis pixel is calculated according to the following formula:

[0073]

[0074] In the formula, It is Grayscale image The probability that the target pixel belongs to the analysis pixel is taken as the second probability. The larger the second probability value is, the more likely the target pixel belongs to the analysis pixel. It is The target pixel is at The average gray value of the grayscale image, It is Grayscale image The average gray value of the eight neighboring pixels of the target pixel is The variance of the grayscale image, It is Grayscale image The greater the curvature, the more likely the target pixel is to be a pixel in the highlighted arc area, that is, the more likely the target pixel is to be an analysis pixel. is a natural exponential function.

[0075] In this formula, express The difference from the maximum grayscale value of 255, the smaller the difference, the The more likely a target pixel is to be a pixel in the bright arc area, that is, the larger the gray value of the target pixel is, the more likely it is to be an analysis pixel. It is Grayscale image The probability that a target pixel belongs to a background pixel is is a natural exponential function.

[0076] In this formula , although in step S1 the pixels of the grayscale image are divided into background pixels and target pixels according to the probability that each pixel belongs to the background pixel, the essence is to use the pixels with a high probability of belonging to the background pixel as the background pixel, and the pixels with a low probability of belonging to the background pixel as the target pixel. Therefore, although it is a target pixel here, it can still obtain the probability that it belongs to the background pixel, but the probability value is smaller. If the first The smaller the probability that a target pixel belongs to a background pixel, the more likely the target pixel belongs to a pixel in a highlighted arc area, that is, the more likely the target pixel is an analysis pixel.

[0077] In this formula, Can reflect the The fluctuation of the average grayscale value of the eight neighborhood pixels of the target pixel in this continuous grayscale image. The larger the variance, the greater the fluctuation. The target pixel is likely to be a pixel in the highlighted arc area, that is, the target pixel is more likely to be the analysis pixel.

[0078] The formula is obtained by adding the curvature As coefficients and Multiplying can enhance those with higher curvature and larger grayscale values ​​( The value of is small) in these areas, which usually correspond to important features in the image, such as the edge of an object, and combined with the probability that the target pixel belongs to the background pixel, this feature can be made more prominent. If the gray value of a target pixel and the probability that the target pixel belongs to the background pixel both meet the conditions, and the greater the curvature of the target pixel, the greater the possibility that the target pixel is the analysis pixel. In this way, the pixels that meet the gray value and probability conditions but do not meet the curvature conditions can be excluded. These pixels correspond to the straight texture edges in the grayscale image.

[0079] In summary, the greater the curvature of a target pixel, the more likely it is to be an analysis pixel. The smaller the difference between the average grayscale value and the maximum grayscale value of a grayscale image, the more likely the target pixel is to be the analysis pixel. If the probability that a target pixel belongs to a background pixel is smaller, the more likely the target pixel is to be the analysis pixel. If the variance of the average grayscale value of the eight-neighborhood pixels of a target pixel in multiple consecutive grayscale images is larger, it means that the grayscale fluctuation around the target pixel is greater, and it is more likely to be the analysis pixel.

[0080] Next, the method for determining the analysis pixel point and the analysis area according to the size of the second probability is:

[0081] The preset second probability threshold is 0.6 (empirical value, which can be set by yourself). If the second probability of a target pixel point is greater than or equal to 0.6, the target pixel point is the analysis pixel point. If the second probability of the target pixel point is less than 0.6, the target pixel point is not the analysis pixel point.

[0082] Finally, according to this method, all analysis pixels in the target pixel of each grayscale image can be obtained, and then region growing is performed on all analysis pixels to obtain multiple analysis regions composed of analysis pixels, that is, multiple highlighted arc regions.

[0083] S3: For each analysis area, according to the fluctuation characteristics of the grayscale values ​​of the edge pixel and its adjacent pixels in the gradient direction, the probability that the edge pixel belongs to the inner edge pixel of the analysis area is calculated as the third probability, and the inner edge pixel of the analysis area is determined according to the size of the third probability.

[0084] In order to distinguish the inner edge pixels and the outer edge pixels of the analysis area, specifically, the inner edge is close to the shadow area, and the outer edge is close to the background. Since the inner edge is close to the shadow area, the grayscale value fluctuates more, while the outer edge is close to the background, the grayscale value fluctuates less. Through this difference, the inner edge pixels and the outer edge pixels can be distinguished.

[0085] Therefore, in this step, edge detection is first performed on each analysis area to obtain its edge pixels, and the fluctuation of the gray value of each edge pixel in the gradient direction is analyzed, and then the probability of each edge pixel belonging to the inner edge pixel is calculated. Grayscale image The analysis area Take the edge pixel as an example and get the The two pixels that are adjacent to each other in the gradient direction of the edge pixel are calculated. The edge pixel belongs to The probability of the inner edge pixels of the analysis area is:

[0086]

[0087] In the formula, It is Grayscale image The analysis area The edge pixel belongs to The probability of the inner edge pixels of the analysis area is taken as the third probability. It is Grayscale image The analysis area The gray value of the edge pixel, , Respectively Grayscale image The analysis area The grayscale values ​​of the first and second adjacent pixels in the gradient direction of the edge pixel, For normalization operation, is the absolute value symbol.

[0088] This formula takes into account that the inner edge pixels of the analysis area (highlighted arc area) are usually close to the shadow area, and the grayscale value difference between the inner edge pixels and the pixels in the shadow area is large, while the outer edge pixels of the analysis area are usually close to the background area, and the grayscale value difference between the outer edge pixels and the pixels in the background area is small.

[0089] Therefore, for an edge pixel, the grayscale value difference between it and its two adjacent pixels along its gradient direction is calculated. The larger the average value of the difference, that is, the larger the grayscale value difference between the edge pixel and its adjacent pixels, the more likely the edge pixel is to be an inner edge pixel. When the average value of the difference is smaller, the more likely the edge pixel is to be an outer edge pixel.

[0090] Next, the method for determining the inner edge pixel points of the analysis area according to the magnitude of the third probability is:

[0091] The third probability threshold is preset to 0.7 (empirical value, which can be set by yourself). The edge pixels whose third probability is greater than or equal to 0.7 in each analysis area are taken as the inner edge pixels of the analysis area, and the edge pixels whose third probability is less than 0.7 in each analysis area are taken as the outer edge pixels of the analysis area.

[0092] S4: taking the average gradient direction of all inner edge pixels as the main direction of the analysis area, traversing each inner edge pixel along the main direction, and determining shadow pixels and shadow areas according to the traversed pixels and preset conditions.

[0093] After determining the inner edge pixels, traverse the pixels in a certain direction, starting from the inner edge pixels and traversing along a certain direction until the background pixels are traversed. During the traversal process, the shadow pixels are determined according to the stability of the grayscale difference between the traversed pixels and the inner edge pixels. If the grayscale difference between the traversed pixels and the inner edge pixels is small and relatively stable, these pixels are more likely to be shadow pixels.

[0094] In this step, the average gradient direction of all inner edge pixels of each analysis area is used as the main direction of the analysis area, an inner edge pixel is selected as the starting point, and traversal is performed along the main direction, moving one pixel each time. During the traversal process, the entropy value of the difference between the gray values ​​of all adjacent pixels that have been traversed is continuously calculated. The threshold of the entropy value is preset to 0.2 (empirical value, which can be set by yourself). The traversal is continuously performed. When the entropy value is less than 0.2 and the first probability of the next pixel is greater than the first probability threshold, that is, the probability that the next pixel belongs to the background pixel is greater than 0.5, the traversal is stopped. At this time, all the pixels traversed by the inner edge pixel are regarded as shadow pixels.

[0095] This operation can judge the stability of grayscale value changes through the change in entropy of the grayscale difference of adjacent pixels, and the first probability can determine whether it has reached the background area. The stability of grayscale value changes is judged by the entropy value to ensure traversal to the real shadow area. By combining the entropy value and the probability of background pixels, it can be ensured that the traversal will not stop prematurely due to a single condition, that is, it is avoided that the traversal is stopped prematurely when only half of the shadow area is traversed because the entropy value is very small, thereby ensuring the comprehensiveness of the detection. This method not only improves the robustness and accuracy of the detection, but also enhances the flexibility of the method.

[0096] All inner edge pixels of each analysis area are traversed according to this method to obtain all shadow pixels. Regional growth is performed on all shadow pixels in each grayscale image to obtain multiple shadow areas in the grayscale image. Each raised area in the grayscale image caused by corrosion contains an analysis area (highlighted arc area) and a shadow area.

[0097] S5: Determine the degree of corrosion based on the ratio of the area of ​​all analysis areas to the area of ​​all shadow areas in the grayscale image.

[0098] The area is determined by the number of pixels. The ratio of the cumulative number of pixels in all analysis areas and the number of pixels in all shadow areas of each grayscale image to the number of all pixels in the grayscale image is used as the corrosion degree of the marine metal sample in the grayscale image. As an example, the marine metal sample is The degree of corrosion in the grayscale image :

[0099]

[0100] In the formula, For the The number of pixels in all analysis areas of the grayscale image, For the The number of pixels in all shadow areas of a grayscale image.

[0101] According to the corrosion degree of the marine metal samples in every two adjacent (adjacent in acquisition time) grayscale images, the corrosion degree growth rate is calculated, and the average corrosion degree growth rate of the marine metal samples in all grayscale images is calculated based on all the collected grayscale images.

[0102] Finally, the ultimate corrosion extent of the marine metal samples was calculated

[0103]

[0104] in, is the average growth rate of corrosion severity, is the corrosion degree of the marine metal sample in the last grayscale image (the grayscale image collected at the 24th hour), is the corrosion degree of the marine metal sample in the first grayscale image (the grayscale image collected at the first hour). is the absolute value symbol. In the formula, It is the difference between the corrosion degree of the marine metal sample in the first grayscale image and the corrosion degree in the last grayscale image. When the difference is larger and the average growth rate of the corrosion degree is larger, it means that the marine metal sample corrodes quickly and seriously, and its corrosion degree is considered to be larger, and vice versa.

[0105] Furthermore, the corrosion threshold is set to 0.5 (experience value, can be set by yourself). When the corrosion degree of marine metal samples is high, it can be considered that they need to be destroyed. At that time, the corrosion degree of marine metal samples was considered to be relatively small and they were retained.

[0106] In the description of this specification, "multiple" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.

[0107] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.

Claims

1. A method for detecting the degree of marine metal corrosion based on image processing, characterized in that: include: Acquire multiple grayscale images of the marine metal sample during the immersion process, calculate the probability that a pixel point of each grayscale image belongs to a background pixel point as a first probability, determine the target pixel point and the background pixel point based on the magnitude of the first probability, calculate the probability that the target pixel point belongs to the analysis pixel point as a second probability, and determine the analysis pixel point and the analysis area according to the magnitude of the second probability; The target pixel corresponds to the raised area on the metal surface; The method for determining the target pixel and the background pixel based on the size of the first probability is: Pixels whose first probability is greater than or equal to a preset first probability threshold are taken as background pixels, and pixels whose first probability is less than the preset first probability threshold are taken as target pixels; The probability that the target pixel belongs to the analysis pixel satisfies the following relationship: ; In the formula, It is Grayscale image The probability that a target pixel belongs to the analysis pixel, It is The target pixel is at The average gray value of the grayscale image, It is Grayscale image The probability that a target pixel belongs to a background pixel is It is Grayscale image The average gray value of the eight neighboring pixels of the target pixel is The variance of the grayscale image, is the natural exponential function, It is Grayscale image The curvature degree of each target pixel; The method for determining the analysis pixel point and the analysis area according to the size of the second probability is: If the second probability that a certain target pixel point belongs to the analysis pixel point is greater than or equal to the preset second probability threshold, the target pixel point is the analysis pixel point, and region growing is performed on all analysis pixels points to obtain the corresponding analysis region; For each analysis area, the probability that the edge pixel belongs to the inner edge pixel of the analysis area is calculated as the third probability according to the fluctuation characteristics of the gray value of the edge pixel and its adjacent pixel in the gradient direction, and the inner edge pixel of the analysis area is determined according to the magnitude of the third probability; the average gradient direction of all the inner edge pixels is taken as the main direction of the analysis area; The inner edge pixels are traversed along the main direction, and the shadow pixels and shadow areas are determined based on the entropy values ​​of the grayscale differences of all adjacent pixels that have been traversed and the first probability of the pixels to be traversed. The degree of corrosion is determined based on the ratio of the area of ​​all analysis areas to the area of ​​all shadow areas.

2. The method for detecting the degree of marine metal corrosion based on image processing according to claim 1 is characterized in that: The calculation process of the probability that each pixel of the grayscale image belongs to the background pixel is: For Grayscale image, for The grayscale histogram of the grayscale image is Gaussian fitted to obtain the maximum peak of the grayscale histogram; Calculate the probability that each pixel of the grayscale image belongs to the background pixel: ; In the formula, It is Grayscale image The probability that a pixel belongs to a background pixel is is the preset parameter for adjusting the sequence number of the grayscale image. For the The pixel at The grayscale value in the grayscale image, For the The maximum peak value of the grayscale histogram corresponding to the grayscale image, is the absolute value symbol.

3. The method for detecting the degree of marine metal corrosion based on image processing according to claim 1 is characterized in that: The calculation formula for the probability that an edge pixel belongs to an inner edge pixel of the analysis area is: ; In the formula, It is Grayscale image The analysis area The edge pixel belongs to The probability of the inner edge pixels of the analysis area is It is Grayscale image The analysis area The gray value of the edge pixel, , Respectively Grayscale image The analysis area The grayscale values ​​of the first and second adjacent pixels in the gradient direction of the edge pixel, For normalization operation, is the absolute value symbol.

4. The method for detecting the degree of marine metal corrosion based on image processing according to claim 1 is characterized in that: The method for determining the curvature degree of the target pixel is: The variance of the grayscale mean of the eight neighboring pixels of each target pixel in multiple consecutive grayscale images is taken as the grayscale variance of the target pixel; Find a target pixel point on the left and right sides of each target pixel point that is closest to its grayscale variance as a reference pixel point, and calculate the curvature of each target pixel point: ; In the formula, It is Grayscale image The curvature of the target pixel. is the arccosine function, For the The target pixel and the reference pixel on the left The direction vector formed by For the The target pixel and the reference pixel on the right The direction vector formed by For the modulo operation, is a natural exponential function.

5. The method for detecting the degree of marine metal corrosion based on image processing according to claim 1 is characterized in that: The method for determining the inner edge pixel points of the analysis area according to the size of the third probability is: In each analysis area, if the third probability that a certain edge pixel point belongs to the inner edge pixel point of the analysis area is greater than or equal to a preset third probability threshold, the edge pixel point is the inner edge pixel point of the analysis area.

6. The method for detecting the degree of marine metal corrosion based on image processing according to claim 1 is characterized in that: The method for determining shadow pixels and shadow areas is: A threshold of a preset entropy value; when the entropy value of the grayscale difference of all adjacent pixels traversed in the main direction is less than the threshold of the entropy value, and the first probability of the pixel to be traversed is greater than the first probability threshold, stop traversing and take all the traversed pixels as shadow pixels; All shadow pixel points obtained when the inner edge pixel points of all analysis areas are traversed along the main direction are obtained, and region growth is performed on all shadow pixel points to obtain multiple shadow areas in the grayscale image.

7. The method for detecting the degree of marine metal corrosion based on image processing according to claim 1 is characterized in that: The method for determining the degree of corrosion based on the ratio of the area of ​​all analysis areas to the area of ​​all shadow areas is: The area is determined by the number of pixels, and the ratio of the cumulative number of pixels in all analysis areas and the number of pixels in all shadow areas of each grayscale image to the number of all pixels in the grayscale image is used as the corrosion degree of the marine metal sample in the grayscale image; Calculate the average growth rate of the corrosion degree of marine metal samples in all grayscale images, as well as the final corrosion degree of marine metal samples ,in, is the average growth rate of corrosion severity, is the corrosion degree of the marine metal sample in the last grayscale image, is the corrosion degree of the marine metal sample in the first grayscale image, is the absolute value symbol, It is a normalization operation.

Citation Information

Patent Citations

  • Metal or coating corrosion detection method based on image processing technology

    CN111028229A

  • A device and method for assessing the corrosion status of metals under simulated marine multi-parameter conditions.

    CN113484229B

  • Cover defect detection method based on image processing

    CN106251352A

  • Aluminum alloy auto part mold defect detection method based on image processing

    CN117011297A