A method and system for detecting oxide film defects on the surface of aluminum metal materials
By calculating the initial characteristics and relative depth confidence of pinholes in the oxide film on the surface of aluminum castings, combined with grayscale images and oxide film thickness, the problem of low defect detection accuracy in the prior art is solved, and higher detection accuracy is achieved and credibility.
Patent Information
- Application Number
- CN202411259855.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-09-10
AI Technical Summary
The prior art cannot accurately capture the characteristics of pinholes in the oxide film on the surface of aluminum castings, resulting in a decrease in the accuracy of defect detection.
By obtaining the grayscale image of the surface of aluminum castings and the thickness of the oxide film, the initial characteristics, relative depth confidence and edge rules of the pinholes are calculated, and defect detection is performed based on the pinhole distribution density and gradient information in the local block.
The accuracy of pinhole depth calculation and the accuracy of oxide film defect detection are improved, ensuring the credibility of the detection results.
Smart Images

Figure CN118799307B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method and system for detecting oxide film defects on the surface of an aluminum metal material. Background Art
[0002] After the blank manufacturing process is completed, aluminum castings usually undergo a series of surface treatments to improve their performance and appearance. Anodizing is a common surface treatment method. Anodizing is to place aluminum castings in a specific electrolyte and form a dense oxide film on the surface of the aluminum castings by electrolysis. It can significantly improve the corrosion resistance, wear resistance and hardness of aluminum castings, including corrosion from air, moisture, acid and alkali, etc. Therefore, anodizing, plating treatment, plastic spraying, etc. can form a protective film on the surface of aluminum castings, thereby greatly improving its corrosion resistance. However, in the process of forming the oxide film on the surface of aluminum castings, due to improper treatment during the oxidation process or uneven film layer, defects such as small holes may appear on the surface of the oxide film, namely pinholes. When the pinhole depth is large, the substrate will be directly exposed, reducing the protective performance of the film layer, making it appear uneven or flawed in appearance. Existing technologies use threshold segmentation to detect pinholes in the oxide film on the surface of aluminum castings. Pinholes in the oxide film on the surface of aluminum castings may have different sizes and shapes (such as round, elliptical, irregular, etc.), which requires considering their unique features when calculating each pinhole. However, the threshold segmentation method often fails to accurately capture these features, thereby reducing the accuracy of oxide film defect detection on the surface of aluminum metal materials. Summary of the invention
[0003] The present invention provides a method and system for detecting oxide film defects on the surface of aluminum metal materials to solve the existing problems.
[0004] The present invention provides a method and system for detecting oxide film defects on the surface of aluminum metal materials using the following technical solutions:
[0005] An embodiment of the present invention provides a method for detecting oxide film defects on the surface of aluminum metal material, the method comprising the following steps:
[0006] Obtaining a grayscale image of the surface of an aluminum casting and the thickness of an oxide film on the surface of the aluminum casting; in the grayscale image of the surface of the aluminum casting, recording pixels whose normalized values of gradient amplitudes are greater than or equal to a preset first judgment threshold as target pixels, and recording a connected domain formed by consecutive adjacent target pixels as a pinhole;
[0007] The grayscale image of the aluminum casting surface is equally divided into several regional blocks. The initial features of each pinhole are obtained according to the gradient amplitude of each pixel point in each pinhole, the number of pinholes in each local block, and the number of pixels. The relative depth confidence of each pinhole is obtained according to the initial features of each pinhole, the number of pixels at the edge of each pinhole, and the number of pixels in each pinhole.
[0008] According to the relative depth confidence of each pinhole and the thickness of the oxide film on the surface of the aluminum casting, the defect detection result of the oxide film on the surface of the aluminum casting is obtained.
[0009] Furthermore, the initial features of each pinhole are obtained according to the gradient amplitude of each pixel point in each pinhole, the number of pinholes in each local block, and the number of pixels, and the specific steps include the following:
[0010] The ratio of the number of pinholes in each area block to the number of pixels in each area block is recorded as the distribution density of the pinholes in each area block;
[0011] The initial features of each pinhole are obtained according to the distribution density of the pinholes in each area block, the gradient amplitude of each pixel point in each pinhole and the number of pixels in the pinhole.
[0012] Furthermore, the specific calculation formula for obtaining the initial features of each pinhole according to the distribution density of the pinholes in each area block, the gradient amplitude of each pixel in each pinhole, and the number of pixels in the pinhole is:
[0013]
[0014] in, Indicates The initial characteristics of the pinholes, Indicates The distribution density of pinholes in the area where the pinholes are located, Indicates The number of pixels in a pinhole, Indicates The pinhole The gradient amplitude of each pixel, Represents pi.
[0015] Furthermore, the relative depth confidence of each pinhole is obtained according to the initial features of each pinhole, the number of pixels at the edge of each pinhole, and the number of pixels in each pinhole, and the specific steps include the following:
[0016] Use the least square method to fit a circle to each pinhole, and get the fitting circle corresponding to each pinhole;
[0017] Construct a vector from each edge pixel point of each fitting circle to the center of the fitting circle based on the direction and distance from each edge pixel point of each fitting circle to the center of the fitting circle;
[0018] Calculate the angle between the vector from each edge pixel point of each fitting circle to the center of the fitting circle and the gradient of each edge pixel point, preset an angle threshold, and record the edge pixel point whose angle value is less than or equal to the preset angle threshold as the dominant pixel point corresponding to the pinhole;
[0019] According to the number of dominant pixels corresponding to each pinhole, the number of pixels at the edge of each pinhole, and the number of pixels within the pinhole, the degree of edge regularity of each pinhole is obtained;
[0020] According to the regularity of the edge of each pinhole and the initial features of each pinhole, the relative depth confidence of each pinhole is obtained.
[0021] Furthermore, according to the number of dominant pixels corresponding to each pinhole, the number of pixels at the edge of each pinhole, and the number of pixels in the pinhole, a specific calculation formula for obtaining the edge regularity of each pinhole is:
[0022]
[0023] in, Indicates The edge regularity of each pinhole, Indicates The number of pixels at the edge of the pinhole, Indicates The number of pixels in a pinhole, Indicates The number of dominant pixels corresponding to each pinhole, represents pi, is an exponential function with a natural constant as its base.
[0024] Furthermore, the specific calculation formula for obtaining the relative depth confidence of each pinhole according to the edge regularity of each pinhole and the initial features of each pinhole is:
[0025]
[0026] in, Indicates The relative depth confidence of the pinholes, Indicates The edge regularity of each pinhole, Indicates The initial characteristics of the pinholes, Indicates The distribution density of pinholes in the area where the pinholes are located.
[0027] Furthermore, the method of obtaining the defect detection result of the oxide film on the surface of the aluminum casting according to the relative depth confidence of each pinhole and the thickness of the oxide film on the surface of the aluminum casting comprises the following specific steps:
[0028] According to the relative depth confidence of each pinhole and the gray value of each pixel, the relative depth of each pinhole is obtained;
[0029] According to the thickness of the oxide film on the surface of the aluminum casting and the relative depth of each pinhole, the defect detection result of the oxide film on the surface of the aluminum casting is obtained.
[0030] Furthermore, the relative depth of each pinhole is obtained according to the relative depth confidence of each pinhole and the gray value of each pixel, and the specific steps include the following:
[0031] The first The grayscale mean of all pixels in the pinhole is The normalized value of the product of the relative depth confidence of the pinholes is recorded as The relative depth of the pinholes.
[0032] Furthermore, the method of obtaining the defect detection result of the oxide film on the surface of the aluminum casting according to the thickness of the oxide film on the surface of the aluminum casting and the relative depth of each pinhole includes the following specific steps:
[0033] The normalized value of the thickness of the oxide film on the surface of the aluminum casting is times as the reference threshold. When the relative depth of a pinhole is less than or equal to the reference threshold, the pinhole is marked as a slight defect area. When the relative depth of a pinhole is greater than a reference threshold, the pinhole is marked as a serious defect area; is the preset quantity threshold.
[0034] The present invention also proposes a system for detecting oxide film defects on the surface of aluminum metal materials, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program stored in the memory to implement the steps of the aforementioned method for detecting oxide film defects on the surface of aluminum metal materials.
[0035] The beneficial effects of the technical solution of the present invention are:
[0036] In the embodiment of the present invention, a plurality of pinholes in the grayscale image of the surface of the aluminum casting and the thickness of the oxide film on the surface of the aluminum casting are obtained;
[0037] According to the gradient amplitude of each pixel point in each pinhole, the number of pinholes in each local block and the number of pixels, the relative depth confidence of each pinhole is obtained; according to the distribution of pinholes in the local area, the influence of the state of the oxide film in the local area on the pinhole depth is obtained, which ensures the accuracy of the pinhole depth calculation and further improves the accuracy of the oxide film defect detection on the surface of aluminum castings. According to the relative depth confidence of each pinhole and the thickness of the oxide film on the surface of the aluminum casting, the detection result of the oxide film defect on the surface of the aluminum casting is obtained. So far, the present invention calculates the relative depth of the pinhole according to the distribution density of the pinholes in the local area, the gradient information of the edge pixel points and the degree to which the pinholes conform to the distribution law. The credibility of the relative depth calculation is guaranteed, and the accuracy of the oxide film defect detection on the surface of the aluminum casting is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] 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 or the description of the prior art 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 work.
[0039] Figure 1 The present invention is a flowchart of the steps of a method for detecting oxide film defects on the surface of aluminum metal materials. DETAILED DESCRIPTION
[0040] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the method and system for detecting defects in the surface oxide film of aluminum metal materials proposed by the present invention, its specific implementation, structure, features and effects, in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0041] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0042] The specific scheme of the method and system for detecting oxide film defects on the surface of aluminum metal materials provided by the present invention is described in detail below with reference to the accompanying drawings.
[0043] See also Figure 1 , which shows a flow chart of the steps of a method for detecting oxide film defects on the surface of aluminum metal material provided by an embodiment of the present invention, the method comprising the following steps:
[0044] Step S001: Obtain a grayscale image of the surface of an aluminum casting and the thickness of an oxide film on the surface of the aluminum casting; in the grayscale image of the surface of the aluminum casting, record the pixel points whose normalized values of the gradient amplitude are greater than or equal to a preset first judgment threshold as target pixel points, and record the connected domain formed by continuous adjacent target pixel points as pinholes.
[0045] A high-resolution industrial camera is used to collect the surface image of the aluminum casting and grayscale it to obtain the grayscale image of the aluminum casting surface. At the same time, the eddy current thickness measurement method is used to obtain the thickness of the oxide film on the surface of the aluminum casting.
[0046] It should be noted that: in the process of collecting the surface image of the aluminum casting, the lighting conditions should be stable to reduce the impact of lighting changes on the image quality. Among them, grayscale and eddy current thickness measurement are both well-known technologies, and the specific methods are not introduced here.
[0047] Due to the tiny size of the pinhole, traditional detection methods may not be able to accurately capture the details of the pinhole due to insufficient resolution. This requires the detection equipment to have extremely high resolution and sensitivity to ensure that the tiny pinhole can be clearly identified and measured.
[0048] Tiny defects such as pinholes will cause a sudden change in grayscale value on the grayscale image of the aluminum casting surface, which is manifested as a peak in the gradient value in the gradient image. That is, the pixel point at the pinhole has a sharp change in grayscale value, so its gradient value is usually large. The grayscale value of the pixel point in the background area changes relatively slowly, and the gradient value is small. By setting a suitable threshold, these gradient value peaks (i.e., target pixel points) can be distinguished from the background.
[0049] The canny edge operator is used to obtain the gradient amplitude of all pixels in the grayscale image of the aluminum casting surface.
[0050] A first judgment threshold is preset, and pixels whose normalized values of gradient amplitude are greater than or equal to the preset first judgment threshold are recorded as target pixels, and a connected domain formed by consecutive adjacent target pixels is recorded as a pinhole. The function gets the normalized value.
[0051] It should be noted that: in this embodiment, the first judgment threshold is preset to be 0.6, and this is used as an example for description. Among them, the canny edge operator is a well-known technology, and the specific method is not introduced here.
[0052] Step S002: Divide the grayscale image of the aluminum casting surface into several area blocks, and obtain the initial features of each pinhole according to the gradient amplitude of each pixel point in each pinhole, the number of pinholes in each local block, and the number of pixels; obtain the relative depth confidence of each pinhole according to the initial features of each pinhole, the number of pixels at the edge of each pinhole, and the number of pixels in each pinhole.
[0053] Pinhole defects in the grayscale image of the aluminum casting surface will not only destroy the integrity of the oxide film, making it easier for corrosive media (such as water, oxygen, chemicals, etc.) to penetrate into the aluminum metal matrix through the pinholes, but also accelerate the corrosion process of the aluminum casting. Pinholes of different depths have different effects on the quality of aluminum castings. Since the pinholes on the surface of the oxide film are very small, it is difficult to obtain their absolute depth. Therefore, it is necessary to determine whether they will affect the quality of aluminum castings based on the relative depth of each pinhole. In the grayscale image of the aluminum casting surface, the grayscale value of each pixel not only represents the brightness, but also contains depth information. However, the edges and details of the pinholes will become blurred due to factors such as image resolution and noise. As a result, the change of the grayscale value at the edge is not obvious enough, making it difficult to accurately judge the depth of the pinhole. Therefore, it is necessary to combine the texture, gradient and other information at the edge of the pinhole to obtain the relative depth of each pinhole.
[0054] The reasons for the formation of pinholes in the oxide film on the surface of aluminum castings include physical and chemical reasons. On the one hand, the composition and microstructure of aluminum castings (such as grain size, phase distribution, etc.) will affect the formation and depth of pinholes. Phase distribution refers to the spatial distribution of different phases (such as solid solution, intermetallic compounds, etc.) in aluminum alloys. These phases may show different oxidation rates and stabilities during the formation of oxide films on the surface of aluminum castings, thereby affecting the uniformity and density of the oxide film. If the phase distribution is uneven or there are a large number of second phase particles (such as intermetallic compounds), they may act as obstacles or nucleation points for the growth of the oxide film, leading to the formation of pinholes. During the oxidation process, the precipitation of gases (such as hydrogen) in the aluminum liquid will also affect the formation and depth of pinholes. The precipitation of these gases is closely related to the composition of the aluminum alloy and the oxidation conditions (such as temperature, time, solution concentration, etc.).
[0055] On the other hand, the increase in the number of pinholes may change the overall structure and properties of the oxide film, thereby affecting the microscopic environment around each pinhole. For example, an area with a large number of pinholes may result in a decrease in the continuity of the oxide film in that local area, making the oxide film more susceptible to the external environment. Therefore, the grayscale image of the aluminum casting surface is divided into several regional blocks for analysis according to the distribution characteristics of the pinholes.
[0056] The grayscale image of the aluminum casting surface is divided into several equal areas.
[0057] It should be noted that the size of each area block is 7*7, and this is taken as an example for description.
[0058] The ratio of the number of pinholes in each area block to the number of pixels in each area block is recorded as the distribution density of the pinholes in each area block.
[0059] It should be noted that: when only a part of a pinhole is in a region block, the pinhole is also regarded as a pinhole in the region block, that is, there is a situation where a pinhole is in multiple regions. The greater the distribution density, the greater the impact on the microscopic environment around the pinhole, and the greater the relative depth of the pinhole; the smaller the distribution density, the smaller the impact on the microscopic environment around the pinhole, and the smaller the relative depth;
[0060] Therefore, the initial features of each pinhole are calculated according to the distribution density of each area block.
[0061] First For example, the first pinhole The calculation formula for the initial characteristics of a pinhole is:
[0062]
[0063] in, Indicates The initial characteristics of the pinholes, Indicates The distribution density of pinholes in the area where the pinholes are located, Indicates The number of pixels in a pinhole, Indicates The pinhole The gradient amplitude of each pixel, Represents pi.
[0064] What needs to be explained is: Indicates The gradient amplitude of all pixels within a pinhole. Indicates The equivalent diameter of a pinhole. The larger the equivalent diameter, the greater the depth of the pinhole.
[0065] According to the above method, the initial characteristics of each pinhole can be obtained.
[0066] The edge of the pinhole is where the grayscale value in the grayscale image of the aluminum casting surface changes sharply. Therefore, the pixels at the edge often have a large gradient value, and the gradient direction is perpendicular to the edge, showing a certain regularity. The pinhole defect usually appears as a small concave hole on the oxide film on the surface of the aluminum metal. This concave shape causes the grayscale value at the edge to gradually change in the direction toward the center of the pinhole, that is, the gradient direction points to the center of the concave. The number of pixels on each pinhole edge whose gradient direction points to the center of the pinhole can be used to obtain the concave significance of the pinhole, which is usually directly proportional to the depth of the pinhole.
[0067] Use the least square method to fit a circle to each pinhole, and get the fitting circle corresponding to each pinhole;
[0068] Construct a vector from each edge pixel point of each fitting circle to the center of the fitting circle based on the direction and distance from each edge pixel point of each fitting circle to the center of the fitting circle;
[0069] The angle between the vector from each edge pixel point of each fitted circle to the center of the fitted circle and the gradient of each edge pixel point is calculated, an angle threshold is preset, and edge pixels whose angle value is less than or equal to the preset angle threshold are recorded as dominant pixels.
[0070] It should be noted that the dominant pixel corresponding to each pinhole is the concave significance of the pinhole. The more dominant pixel points there are, the more obvious the pinhole is on the grayscale image of the aluminum casting surface, and the deeper the relative depth is. The preset angle threshold is 8°, which is used as an example for description.
[0071] In the case of a regular pinhole edge, more pixels will have a gradient direction pointing to the center of the pinhole. This is because a regular edge means that the gradient directions of the pixels on the edge are relatively consistent and all point to the center. In the case of an irregular pinhole edge, the number of pixels with a gradient direction pointing to the center may decrease. This is because the irregularity of the edge causes the gradient direction to change and no longer strictly points to the center. Therefore, the edge regularity of each pinhole is obtained based on the relationship between the number of dominant pixels on the edge of each pinhole and the edge regularity of the pinhole.
[0072] First For example, the first pinhole The calculation formula for the edge regularity of a pinhole is:
[0073]
[0074] in, Indicates The edge regularity of each pinhole, Indicates The number of pixels at the edge of the pinhole, Indicates The number of pixels in a pinhole, Indicates The number of dominant pixels corresponding to each pinhole, represents pi, is an exponential function with a natural constant as the base. To present the inverse proportional relationship and normalization processing, the implementer can set the inverse proportional function and normalization function according to the actual situation.
[0075] What needs to be explained is: Indicates The regularity of the edges of the pinholes, Indicates The equivalent diameter of a pinhole, For the The ratio of the circumference of the pinhole to the equivalent diameter. The larger the ratio, the The greater the irregularity of the edge of the pinhole.
[0076] In the above manner, the edge regularity of each pinhole can be obtained.
[0077] From the above steps, it can be seen that the contour shape of the pinholes on the surface oxide film of the aluminum casting is not single, and can be roughly divided into two types, one is a pinhole with relatively regular edges, and the other is a pinhole with irregular edges. For the pinholes with irregular edges, the reason for their formation is due to the uneven local conditions during the oxidation process, that is, the pinholes with irregular edges are affected by the micro-environment in multiple directions during the formation process, resulting in a complex and changeable expansion path in the oxide film on the surface of the aluminum casting, so the depth is relatively shallow. For the pinholes with regular edges, they are less subject to external interference during the formation process, and the expansion path is relatively simple, so they are often deeper.
[0078] When the pinhole distribution density in a local area is large, the pinholes in the local area may be close to each other or staggered. The interaction between the pinholes in the local area and the uneven growth conditions will lead to uneven grayscale distribution in the pinholes. In this case, the edge regularity of each pinhole is small. Because when the oxide film forms pinholes at multiple points in the local area, the oxide film on the surface of the aluminum casting may open at multiple points at the same time during formation. The formation process of the oxide film around each pinhole will be more complicated, resulting in a relatively shallow depth of the pinhole. In contrast, when the pinhole distribution density in the local area is low, the pinhole growth conditions in the local area are relatively uniform, that is, the grayscale distribution in the pinhole is more uniform, the edge regularity of each pinhole is greater, and the corresponding depth will be relatively deep.
[0079] Therefore, the relative depth confidence of each pinhole is obtained according to the relationship between the regularity of the edge of each pinhole and the distribution density of the pinholes in the area block where each pinhole is located.
[0080] First For example, the first pinhole The calculation formula for the relative depth confidence of a pinhole is:
[0081]
[0082] in, Indicates The relative depth confidence of the pinholes, Indicates The edge regularity of each pinhole, Indicates The initial characteristics of the pinholes, Indicates The distribution density of pinholes in the area where the pinholes are located.
[0083] What needs to be explained is: Indicates The degree to which the pinholes conform to the distribution law, that is, when the The distribution density of pinholes in the area where the pinholes are located The larger the The regularity of the edge of the pinhole should be smaller; when the The distribution density of pinholes in the area where the pinholes are located The more hours, the The regularity of the edge of the pinhole should be larger; therefore, when The closer the value is to 1, the The less the pinholes conform to the distribution law, the lower the relative depth accuracy is, and the lower the relative depth confidence of the corresponding pinholes is. The farther the value is from 1, the The more the pinholes conform to the distribution law, the higher the relative depth accuracy is, and the higher the relative depth confidence of the corresponding pinholes is.
[0084] Step S003: Obtaining the defect detection result of the oxide film on the surface of the aluminum casting according to the relative depth confidence of each pinhole and the thickness of the oxide film on the surface of the aluminum casting.
[0085] From the above content, it can be seen that the grayscale value of each pixel in the grayscale image of the aluminum casting surface contains depth information. For pinholes with higher relative depth confidence, the more they conform to the distribution law, the grayscale value shown in the grayscale image of the aluminum casting surface can better reflect its relative depth, and the higher the relative depth accuracy is; for pinholes with lower relative depth confidence, the less they conform to the distribution law, the grayscale value shown in the grayscale image of the aluminum casting surface can less reflect its relative depth, and the lower the relative depth accuracy is.
[0086] First For example, the first pinhole The relative depth of each pinhole is calculated as:
[0087]
[0088] in, Indicates The relative depth of the pinholes, Indicates The relative depth confidence of the pinholes, represents the grayscale mean of all pixels in the i-th pinhole, represents the linear normalization function.
[0089] The thickness of the oxide film on the surface of aluminum castings was normalized using The function obtains the normalized value.
[0090] The normalized value of the thickness of the oxide film on the surface of the aluminum casting is times as the reference threshold. When the relative depth of a pinhole is less than or equal to the reference threshold, the pinhole is marked as a slight defect area. When the relative depth of a pinhole is greater than a reference threshold, the pinhole is marked as a serious defect area.
[0091] It should be noted that for areas with minor defects, workers are notified to use local repair methods. Use repair materials that match the material of the aluminum casting to fill the pinholes and perform a curing treatment. After repair, grinding and polishing are required to ensure surface flatness and aesthetics. For areas with serious defects, corrosive media can more easily penetrate into the interior of the casting, causing corrosion to spread from the surface to the inside. Not only will it further weaken the strength of the casting, it may also cause more serious corrosion problems. The aluminum casting can no longer meet the use requirements and needs to be scrapped. Among them, the preset quantity threshold in this embodiment The value is 0.6, and this example is used for description.
[0092] So far, the present invention is completed.
[0093] In summary, in an embodiment of the present invention, a grayscale image of the surface of an aluminum casting and the thickness of an oxide film on the surface of the aluminum casting are obtained; in the grayscale image of the surface of the aluminum casting, the pixel points whose normalized value of the gradient amplitude is greater than or equal to the preset first judgment threshold are recorded as target pixels, and the connected domain formed by continuous adjacent target pixels is recorded as pinholes; the grayscale image of the surface of the aluminum casting is equally divided into a number of regional blocks, and the initial features of each pinhole are obtained according to the gradient amplitude of each pixel point in each pinhole, the number of pinholes in each local block, and the number of pixels; the relative depth confidence of each pinhole is obtained according to the initial features of each pinhole, the number of pixels at the edge of each pinhole, and the number of pixels in each pinhole; the relative depth confidence of each pinhole and the thickness of the oxide film on the surface of the aluminum casting are obtained. The defect detection result of the oxide film on the surface of the aluminum casting is obtained. The present invention calculates the relative depth of the pinhole according to the distribution density of the pinholes in the local area, the gradient information of the edge pixels, and the degree to which the pinholes conform to the distribution law. The credibility of relative depth calculation is guaranteed, and the accuracy of oxide film defect detection on the surface of aluminum castings is improved.
[0094] The present invention also provides a system for detecting oxide film defects on the surface of aluminum metal materials, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program stored in the memory to implement the steps of the aforementioned method for detecting oxide film defects on the surface of aluminum metal materials.
[0095] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for detecting oxide film defects on the surface of aluminum metal material, characterized in that: The method comprises the following steps: Obtaining a grayscale image of the surface of an aluminum casting and the thickness of an oxide film on the surface of the aluminum casting; in the grayscale image of the surface of the aluminum casting, recording pixels whose normalized values of gradient amplitudes are greater than or equal to a preset first judgment threshold as target pixels, and recording a connected domain formed by consecutive adjacent target pixels as a pinhole; The grayscale image of the aluminum casting surface is equally divided into several regional blocks. The initial features of each pinhole are obtained according to the gradient amplitude of each pixel point in each pinhole, the number of pinholes in each local block, and the number of pixels. The relative depth confidence of each pinhole is obtained according to the initial features of each pinhole, the number of pixels at the edge of each pinhole, and the number of pixels in each pinhole. According to the relative depth confidence of each pinhole and the thickness of the oxide film on the surface of the aluminum casting, the defect detection result of the oxide film on the surface of the aluminum casting is obtained; The relative depth confidence of each pinhole is obtained according to the initial features of each pinhole, the number of pixels at the edge of each pinhole, and the number of pixels in each pinhole, and the specific steps include the following: Use the least square method to fit a circle to each pinhole, and get the fitting circle corresponding to each pinhole; Construct a vector from each edge pixel point of each fitting circle to the center of the fitting circle based on the direction and distance from each edge pixel point of each fitting circle to the center of the fitting circle; Calculate the angle between the vector from each edge pixel point of each fitting circle to the center of the fitting circle and the gradient of each edge pixel point, preset an angle threshold, and record the edge pixel point whose angle value is less than or equal to the preset angle threshold as the dominant pixel point corresponding to the pinhole; According to the number of dominant pixels corresponding to each pinhole, the number of pixels at the edge of each pinhole, and the number of pixels within the pinhole, the degree of edge regularity of each pinhole is obtained; According to the regularity of the edge of each pinhole and the initial features of each pinhole, the relative depth confidence of each pinhole is obtained.
2. A method for detecting oxide film defects on the surface of aluminum metal material according to claim 1, characterized in that: The initial feature of each pinhole is obtained according to the gradient amplitude of each pixel point in each pinhole, the number of pinholes in each local block and the number of pixels, and the specific steps include the following: The ratio of the number of pinholes in each area block to the number of pixels in each area block is recorded as the distribution density of the pinholes in each area block; The initial features of each pinhole are obtained according to the distribution density of the pinholes in each area block, the gradient amplitude of each pixel point in each pinhole and the number of pixels in the pinhole.
3. A method for detecting oxide film defects on the surface of aluminum metal material according to claim 2, characterized in that: The specific calculation formula for obtaining the initial features of each pinhole according to the distribution density of the pinholes in each area block, the gradient amplitude of each pixel point in each pinhole, and the number of pixels in the pinhole is: in, Indicates The initial characteristics of the pinholes, Indicates The distribution density of pinholes in the area where the pinholes are located, Indicates The number of pixels in a pinhole, Indicates The pinhole The gradient amplitude of each pixel, Represents pi.
4. A method for detecting oxide film defects on the surface of aluminum metal material according to claim 1, characterized in that: The specific calculation formula for obtaining the edge regularity of each pinhole according to the number of dominant pixels corresponding to each pinhole, the number of pixels at the edge of each pinhole, and the number of pixels within the pinhole is: in, Indicates The edge regularity of each pinhole, Indicates The number of pixels at the edge of the pinhole, Indicates The number of pixels in a pinhole, Indicates The number of dominant pixels corresponding to each pinhole, represents pi, is an exponential function with a natural constant as its base.
5. A method for detecting oxide film defects on the surface of aluminum metal material according to claim 1, characterized in that: The specific calculation formula for obtaining the relative depth confidence of each pinhole according to the edge regularity of each pinhole and the initial features of each pinhole is: in, Indicates The relative depth confidence of the pinholes, Indicates The regularity of the edge of each pinhole, Indicates The initial characteristics of the pinholes, Indicates The distribution density of pinholes in the area where the pinholes are located.
6. A method for detecting oxide film defects on the surface of aluminum metal material according to claim 1, characterized in that: The method of obtaining the defect detection result of the oxide film on the surface of the aluminum casting according to the relative depth confidence of each pinhole and the thickness of the oxide film on the surface of the aluminum casting includes the following specific steps: According to the relative depth confidence of each pinhole and the gray value of each pixel, the relative depth of each pinhole is obtained; According to the thickness of the oxide film on the surface of the aluminum casting and the relative depth of each pinhole, the defect detection result of the oxide film on the surface of the aluminum casting is obtained.
7. A method for detecting oxide film defects on the surface of aluminum metal material according to claim 6, characterized in that: The relative depth of each pinhole is obtained according to the relative depth confidence of each pinhole and the gray value of each pixel, and the specific steps include the following: The first The grayscale mean of all pixels in the pinhole is The normalized value of the product of the relative depth confidence of the pinholes is recorded as The relative depth of the pinholes.
8. A method for detecting oxide film defects on the surface of aluminum metal material according to claim 6, characterized in that: The method of obtaining the defect detection result of the oxide film on the surface of the aluminum casting according to the thickness of the oxide film on the surface of the aluminum casting and the relative depth of each pinhole includes the following specific steps: The normalized value of the thickness of the oxide film on the surface of the aluminum casting is times as the reference threshold. When the relative depth of a pinhole is less than or equal to the reference threshold, the pinhole is marked as a slight defect area. When the relative depth of a pinhole is greater than a reference threshold, the pinhole is marked as a serious defect area; is the preset quantity threshold.
9. A system for detecting oxide film defects on the surface of aluminum metal materials, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the computer program is executed by a processor, the steps of a method for detecting oxide film defects on the surface of aluminum metal materials as described in any one of claims 1 to 8 are implemented.
