A defect evaluation method for pitting areas of metal fasteners
By using gradient information and region growth technology to identify the pitting-influenced area in the surface image of metal fasteners, and combining threshold segmentation and pixel replacement technology to remove the reflective effect, the problem of inaccurate defect evaluation caused by reflective effect in the prior art is solved. Accurate detection and evaluation of pitting defects on metal fasteners surfaces is achieved.
Patent Information
- Application Number
- CN202210553164.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-20
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2042-05-20
AI Technical Summary
In the prior art, when detecting pitting defects of metal fasteners, the reflective area affects the accuracy of evaluation, resulting in inaccurate defect evaluation.
By acquiring the gradient image of the metal fastener surface image, pixel points with gradient amplitude greater than the preset threshold are identified as regional growth points, and region growth is performed to obtain abnormal region boundaries. Then, using threshold segmentation and pixel replacement techniques, the reflection effects are removed and the pitting area of normal and highlighted areas is separated.
Accurate evaluation of pitting defects on the surface of metal fasteners is achieved, and the accuracy and quality reference of defect detection are improved.
Smart Images

Figure CN114998226B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of defect detection of defective metal materials, and in particular to a defect evaluation method for a pitting area of a metal fastener. Background Art
[0002] Metal fasteners are a type of metal mechanical parts used to connect different mechanical devices or fix mechanical devices. Metal fasteners in liquid environments or humid and corrosive environments will have pitting defects, forming hole-like corrosion on the surface. Pitting defects not only affect the appearance of metal fasteners, but also affect the safety and life of their structures because of the holes on the surface. Therefore, it is necessary to evaluate the pitting defects of metal fasteners and replace new metal fasteners in time according to the defect evaluation to avoid accidents.
[0003] Surface defect detection can use computer vision technology to obtain the features of metal fastener surface images and then obtain defect evaluation. However, during the image acquisition process, a bright reflective area will be formed on the surface of the metal product, which will affect the defect evaluation at that location. Therefore, it is necessary to perform de-reflection processing on the surface image of the metal fastener. In the prior art, de-reflection processing often directly performs global equalization analysis on the image. Although the reflection effect is removed, it will affect the pixel value at the normal area position, which in turn affects the subsequent defect evaluation, resulting in inaccurate defect evaluation and failure to achieve the expected effect. Summary of the invention
[0004] In order to solve the above technical problems, the purpose of the present invention is to provide a defect evaluation method for the pitting area of a metal fastener, and the technical solution adopted is as follows:
[0005] The present invention provides a defect evaluation method for a pitting area of a metal fastener, the method comprising:
[0006] The surface image of the metal fastener is collected by an image acquisition device with a visible light source; a gradient image of the surface image of the metal fastener is obtained; pixel points in the gradient image whose gradient amplitude is greater than a preset amplitude threshold are used as region growth points; region growth is performed according to the region growth points to obtain a plurality of abnormal region boundaries; the abnormal region boundaries are screened according to their lengths and closures to obtain a plurality of initial pitting corrosion affected region boundaries; and the minimum circumscribed rectangle of the initial pitting corrosion region is used as the pitting corrosion affected region;
[0007] The surface image of the metal fastener is divided into a normal area and a highlight area by using threshold segmentation; a normal pitting area and a normal surface background area in each of the pitting affected areas in the normal area are obtained; and a highlight pitting area and a highlight surface background area in each of the pitting affected areas in the highlight area are obtained;
[0008] Taking the average pixel value of the normal surface background area as the reference pixel value, replacing the original pixel values of the normal surface background area and the highlighted surface background area with the reference pixel value, taking the ratio of the original pixel value of each pixel point in the highlighted surface background area to the reference pixel value as the first reflection coefficient; obtaining the second reflection coefficient of each pixel point in the highlighted point etched area according to the distance between each pixel point in the highlighted point etched area and the adjacent pixel point in the highlighted surface background area and the first reflection coefficient; and correcting the original pixel value of each pixel point in the highlighted point etched area using the inverse of the second reflection coefficient as the weight to obtain a de-reflected image;
[0009] All pitting areas in the de-reflective image are obtained; a first pitting severity of each pitting area is obtained according to the frequency of occurrence of pixel values in the pitting area within multiple preset pixel value intervals; a second pitting severity of the surface of the metal fastener is obtained according to the first pitting severity and the area ratio of the pitting area in the de-reflective image.
[0010] Furthermore, collecting the surface image of the metal fastener includes:
[0011] An image preprocessing operation is performed on the surface image of the metal fastener; the image preprocessing operation includes Gaussian filtering and grayscale conversion.
[0012] Furthermore, performing region growing according to the region growing points to obtain multiple abnormal region boundaries includes:
[0013] Select any one of the regional growth points as the starting point. If there are other regional growth points within the preset neighborhood range of the starting point, the regional growth point within the neighborhood range is used as the abnormal region boundary point, and growth continues according to the abnormal region boundary point until the regional growth point no longer exists within the neighborhood range, thereby obtaining multiple abnormal region boundaries.
[0014] Furthermore, the screening according to the length and closure of the abnormal area boundary to obtain multiple initial pitting area boundaries includes:
[0015] The number of the abnormal region boundary points of the abnormal region boundary is used as the length; the distance between the starting point of the abnormal region boundary and the last abnormal region boundary point in the region growth process is obtained; if the distance is greater than a preset distance threshold, it is determined that the abnormal region boundary is not closed; otherwise, it is determined that the abnormal region boundary is closed;
[0016] The abnormal region boundary that is closed and has a length greater than a preset length threshold is used as the initial pitting region boundary.
[0017] Further, obtaining the normal pitting area and the normal surface background area in each of the pitting affected areas in the normal area includes:
[0018] After performing histogram equalization processing on each of the pitting corrosion affected areas in the normal area, the normal pitting corrosion area and the normal surface background area are obtained using the Otsu threshold segmentation algorithm.
[0019] Further, obtaining the highlighted pitting area and the highlighted surface background area in each of the pitting affected areas in the highlighted area comprises:
[0020] The size of each pitting affected area in the highlighted area is amplified according to a preset adjustment coefficient to obtain an amplified pitting affected area; the amplified pitting affected area is subjected to histogram equalization processing and then the highlighted pitting affected area and the highlighted surface background area are obtained using the Otsu threshold segmentation algorithm.
[0021] Further, obtaining a second reflection coefficient of each pixel point in the highlighted point etched area according to the distance between each pixel point in the highlighted point etched area and the adjacent pixel point in the highlighted surface background area and the first reflection coefficient comprises:
[0022] The second reflection coefficient is obtained according to a second reflection coefficient formula, where the second reflection coefficient formula includes:
[0023]
[0024] Among them, p α is the αth pixel point in the highlighted spot etched area, p i is the i-th pixel point in the adjacent background area of the highlighted surface, ρ(p α ) is the second reflection coefficient of the αth pixel in the highlighted spot corrosion area, Z is the number of pixels in the adjacent highlighted surface background area, L is the maximum value of the length and width of the amplified pitting area, ‖p α -p i ‖ is the Euclidean distance between the αth pixel in the highlighted etched area and the ith pixel in the adjacent highlighted surface background area, ρ(p i ) is the first reflection coefficient of the i-th pixel point in the adjacent highlighted surface background area.
[0025] Further, obtaining the first pitting severity according to the occurrence frequency of the pixel values in the pitting area within the preset pixel value interval includes:
[0026] Arrange the plurality of pixel value intervals from large to small; obtain the first pitting severity according to a first pitting severity formula, wherein the first pitting severity formula includes:
[0027]
[0028] Wherein, σ is the first pitting severity, N is the number of the pixel value intervals, and p(i) is the occurrence frequency of the pitting area in the i-th pixel value interval.
[0029] Further, obtaining a second pitting severity according to the first pitting severity and the area ratio of the pitting region in the de-reflected image includes:
[0030] The second pitting severity is obtained according to a second pitting severity formula, wherein the second pitting severity formula includes:
[0031]
[0032] Wherein, θ is the second pitting severity, k is the number of the pitting areas, δ i is the area ratio of the i-th pitting area, σ i is the first pitting severity of the i-th pitting area, w 1 is the first fitting weight, w 2 is the second fitting weight.
[0033] The present invention has the following beneficial effects:
[0034] 1. The embodiment of the present invention uses gradient information to obtain the pitting affected area, and performs segmentation according to the pixel difference characteristics inside each pitting affected area to obtain the normal pitting area and the normal surface background area of the normal area, and the highlighted pitting area and the highlighted surface background area of the highlighted area. The surface background area is further replaced with pixels based on the average pixel value of the normal surface background area as the reference pixel value, and the highlighted pitting area is replaced with pixels based on the relative position of the pixel points in the highlighted pitting area and the adjacent highlighted surface background area and the reflection coefficient in the highlighted surface background area. The highlighted pitting area is de-reflected according to the local pixel distribution characteristics and reflection degree characteristics of the highlighted pitting area, so that the subsequent pitting defect evaluation has a stronger reference and the evaluation index is more accurate.
[0035] 2. The embodiment of the present invention uses the de-reflected image after de-reflection to evaluate defects, and obtains the first pitting severity of each pitting area according to the frequency of occurrence of pixel values in the pitting area in the de-reflected image within a preset pixel value interval. Considering that the pixel values in the pitting area may be unevenly distributed, the frequency of occurrence of pixel values in the pitting area within the pixel value interval is used as the basis for the first pitting severity, thereby improving the reference of the first pitting severity. Then, combined with the area ratio of the pitting area on the surface of the metal fastener, an accurate second pitting severity is obtained. According to the second pitting severity, the defects of the metal fastener can be accurately evaluated. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are 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.
[0037] Figure 1 A flow chart of a defect evaluation method for a pitting area of a metal fastener provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0038] 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 defect evaluation method for the pitting area of a metal fastener proposed by the present invention, its specific implementation method, structure, features and effects, in conjunction 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.
[0039] 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.
[0040] The specific scheme of the defect evaluation method for the pitting area of a metal fastener provided by the present invention is described in detail below with reference to the accompanying drawings.
[0041] See also Figure 1 , which shows a flow chart of a defect evaluation method for a pitting area of a metal fastener provided by an embodiment of the present invention, the method comprising:
[0042] Step S1: collecting a metal fastener surface image using an image acquisition device with a visible light source; obtaining a gradient image of the metal fastener surface image; taking pixel points in the gradient image whose gradient amplitude is greater than a preset amplitude threshold as region growth points; performing region growth based on the region growth points to obtain a plurality of abnormal region boundaries; screening the abnormal region boundaries based on their lengths and closure to obtain a plurality of initial pitting corrosion affected region boundaries; taking the minimum circumscribed rectangle of the initial pitting corrosion region as the pitting corrosion affected region.
[0043] In the embodiment of the present invention, a high-resolution industrial camera with a visible light source is used to collect images of metal fasteners. During the collection process, it is necessary to ensure that the surface information of the metal fasteners in the image is complete and clear. The surface information includes pitting defect information and surface background information without defects.
[0044] During the image acquisition process, noise may appear in the image due to environmental problems or image acquisition device parameter problems. Therefore, after the metal fastener surface image is acquired, preprocessing operations are required. The preprocessing operations include Gaussian filtering and grayscale conversion. Gaussian filtering uses a Gaussian filter to process the image and remove noise from the image. The grayscale operation converts the metal fastener surface image into a grayscale image to facilitate subsequent pixel analysis.
[0045] Because the metal surface is smooth, when the light source shines on the surface of the metal fastener, reflection will occur in local areas. The reflective area appears as a high-brightness highlight area on the image. For pitting defects, they appear as darker areas in the image, but in the highlight area, the reflection will cause the brightness of the pitting defects in the highlight area to increase, so it is impossible to directly distinguish the defects from the background area by threshold segmentation on the metal fastener surface image. Considering that the pitting defects in the highlight area are brighter, but still have a certain contrast with the adjacent surface background, the gradient image of the metal fastener surface image is obtained. The pixel value of each pixel in the gradient image represents the gradient amplitude of the corresponding position in the original image. Because the pitting defect areas in the normal area and the highlight area both have a certain grayscale difference with the adjacent surface background, the size of the gradient amplitude can represent the grayscale difference between the pixel at the current position and other pixels in the neighborhood. The pixel points with a gradient amplitude greater than the preset amplitude threshold are used as regional growth points. Regional growth is performed according to the regional growth points to obtain multiple abnormal region boundaries. The specific method of regional growth includes:
[0046] Select any regional growth point as the starting point. If there are other regional growth points within the preset neighborhood range of the starting point, the regional growth point within the neighborhood range is used as the abnormal region boundary point, and continues to grow according to the abnormal region boundary point until there are no regional growth points within the neighborhood range, and obtains multiple abnormal region boundaries.
[0047] In the embodiment of the present invention, the surface image of the metal fastener is processed by the Sobel operator to obtain a gradient image. The gradient image is processed by the Otsu threshold algorithm to obtain an optimal amplitude threshold. The neighborhood range is set to eight neighborhoods during the region growing process.
[0048] Because pitting defects are usually hole-shaped in images, that is, the boundary of the pitting defect area should be closed and have a certain length, so the abnormal area boundary can be screened according to the length and closure of the abnormal area boundary, and the misidentified noise points can be removed to obtain multiple initial pitting affected area boundaries, including:
[0049] The number of abnormal region boundary points of the abnormal region boundary is taken as the length. The distance between the starting point of the abnormal region boundary and the last abnormal region boundary point in the region growth process is obtained. If the distance is greater than the preset distance threshold, the abnormal region boundary is judged to be not closed. Otherwise, the abnormal region boundary is judged to be closed. The abnormal region boundary that is closed and has a length greater than the preset length threshold is taken as the initial pitting region boundary.
[0050] In the embodiment of the present invention, the distance threshold is set to 3, and the length threshold is set to 10. It should be noted that for the initial pitting affected area boundary whose distance is less than the preset distance threshold but not 0, the boundary needs to be completed using the closing operation of morphological processing.
[0051] The initial pitting area boundary encloses an initial pitting area boundary. In order to facilitate the subsequent de-reflection operation, the minimum circumscribed rectangle of the initial pitting area is used as the pitting influence area.
[0052] It should be noted that the pitting corrosion affected area is obtained based on the gradient image. Since the gradient image is obtained from the surface image of the metal fastener, there is also a pitting corrosion affected area at the corresponding position of the surface image of the metal fastener. The pitting corrosion affected area includes surface background information and pitting corrosion defect information.
[0053] Step S2: using threshold segmentation to divide the metal fastener surface image into a normal area and a highlight area; obtaining a normal pitting area and a normal surface background area in each pitting affected area in the normal area; obtaining a highlight pitting area and a highlight surface background area in each pitting affected area in the highlight area.
[0054] In the embodiment of the present invention, the surface image of the metal fastener is segmented using the Otsu threshold algorithm, and the surface image of the metal fastener is divided into a normal area and a highlight area.
[0055] Because there is a large brightness difference between the normal area and the highlighted area, the normal area and the highlighted area need to be analyzed separately to obtain the normal pitting area and the normal surface background area in the pitting affected area in the normal area, and to obtain the highlighted pitting area and the highlighted surface background area in each pitting affected area in the highlighted area, specifically including:
[0056] After histogram equalization processing is performed on each pitting affected area in the normal area, the normal pitting area and the normal surface background area are obtained using the Otsu threshold segmentation algorithm.
[0057] Because the pitting affected area is the minimum circumscribed rectangle of the initial pitting area, there may be some pitting defect pixels on the boundary of the minimum circumscribed rectangle, resulting in less surface background information of the nearest neighbor. Considering that in order to facilitate the subsequent de-reflection operation, it is necessary to amplify the information of the highlighted surface background area adjacent to the highlighted pitting area. Therefore, the size of each pitting affected area in the highlighted area is amplified according to the preset adjustment coefficient to obtain the amplified pitting affected area. After the amplified pitting affected area is subjected to histogram equalization, the highlighted pitting area and the highlighted surface background area are obtained using the Otsu threshold segmentation algorithm.
[0058] In the embodiment of the present invention, the adjustment coefficient is set to That is, the length and width of each pitting affected area in the highlighted area are increased by one quarter respectively.
[0059] It should be noted that the purpose of using histogram equalization to process the pitting affected area in the normal area and the highlight area is to segment the area, and the pixel value of the metal fastener surface image is not changed.
[0060] The initial pitting area and the pitting affected area in step S1 are a rough area, and in step S2, a more refined segmentation is used to obtain the normal pitting area of the normal area and the normal surface background area and the highlighted pitting area and the highlighted surface background area of the highlighted area.
[0061] Step S3: Taking the average pixel value of the normal surface background area as the reference pixel value, replacing the original pixel values of the normal surface background area and the highlighted surface background area with the reference pixel value, and taking the ratio of the original pixel value of each pixel point in the highlighted surface background area to the reference pixel value as the first reflection coefficient; obtaining the second reflection coefficient of each pixel point in the highlighted point erosion area according to the distance between each pixel point in the highlighted point erosion area and the adjacent pixel point in the highlighted surface background area and the first reflection coefficient; and correcting the original pixel value of each pixel point in the highlighted point erosion area using the inverse of the second reflection coefficient as the weight to obtain a de-reflected image.
[0062] The information in the normal surface background area can be used as a reference for all surface background areas, so the average pixel value of the normal surface background area is used as the reference pixel value. The original pixel values of the normal surface background area and the highlight surface background area are replaced with the reference pixel value. The ratio of the original pixel value of each pixel point in the highlight surface background area to the reference pixel value is used as the first reflection coefficient. The larger the first reflection coefficient, the greater the reflection degree of the corresponding position.
[0063] The highlighted point pitting area is also affected by reflection, but the pixel value of the highlighted point pitting area itself indicates the degree of pitting, so it cannot be replaced with the pixel value of the normal pitting area as a reference. Considering that the degree of reflection influence of adjacent positions should be similar, the first reflection coefficient in the highlighted surface background area adjacent to the highlighted point pitting area is used as a reference, and the second reflection coefficient of each pixel in the highlighted point pitting area is obtained according to the distance between each pixel in the highlighted point pitting area and the pixel in the adjacent highlighted surface background area and the first reflection coefficient, which specifically includes:
[0064] The second reflection coefficient is obtained according to the second reflection coefficient formula, and the second reflection coefficient formula includes:
[0065]
[0066] Among them, p α is the αth pixel in the highlighted etched area, p i is the i-th pixel in the adjacent highlighted surface background area, ρ(p α ) is the second reflection coefficient of the αth pixel in the highlighted spot corrosion area, Z is the number of pixels in the adjacent highlighted surface background area, L is the maximum value of the length and width of the enlarged pitting area, ‖p α -p i ‖ is the Euclidean distance between the αth pixel in the highlighted etched area and the ith pixel in the adjacent highlighted surface background area, ρ(p i ) is the first reflection coefficient of the i-th pixel in the adjacent highlight surface background area.
[0067] In the second reflection coefficient formula, the Euclidean distance between the pixel point in the highlight point erosion area and the pixel point in the adjacent highlight surface background area is used as the weight of the corresponding first reflection coefficient. The closer the distance, the closer the second reflection coefficient of the pixel point in the highlight point erosion area is to the corresponding first reflection coefficient.
[0068] The reciprocal of the second reflection coefficient is used as the weight to correct the original pixel value of each pixel in the highlight erosion area, that is, the reciprocal of the second reflection coefficient is multiplied by the original pixel value. The larger the second reflection coefficient, the stronger the reflection effect on the corresponding position is, so the brightness of the corresponding position is dimmed and the original pixel value is reduced.
[0069] After correcting the original pixel values of the surface background pixels and the original pixel values of the pixels in the highlight etched area, a de-reflected image can be obtained. The de-reflected image takes into account the local reflective characteristics of the highlight etched area, and corrects the corresponding pixel values according to the respective local reflective characteristics, making the defect evaluation in the subsequent steps more accurate.
[0070] Step S4: Obtain all pitting areas in the de-reflective image; obtain a first pitting severity of each pitting area according to the frequency of occurrence of pixel values in the pitting area within multiple preset pixel value intervals; obtain a second pitting severity on the surface of the metal fastener according to the first pitting severity and the area ratio of the pitting area in the de-reflective image.
[0071] After de-reflection processing, the normal pitting area and the highlight pitting area constitute the pitting area in the de-reflection image.
[0072] The greater the pitting depth on the surface of the metal fastener, the smaller the corresponding pixel value in the image and the darker the brightness. Therefore, the pitting defect can be evaluated according to the pixel value size of the pitting area. Considering that the pixel value distribution in the pitting area may be uneven, that is, different positions in a pitting area may correspond to different corrosion degrees. Therefore, multiple pixel value intervals are preset, and the first pitting severity is obtained according to the frequency of occurrence of pixel values in the pitting area in multiple pixel value intervals, which specifically includes:
[0073] Arrange multiple pixel value intervals from large to small. Obtain the first pitting severity according to the first pitting severity formula, which includes:
[0074]
[0075] Wherein, σ is the first pitting severity, N is the number of pixel value intervals, and p(i) is the frequency of occurrence of the pitting region in the i-th pixel value interval. In the embodiment of the present invention, the pixel values of all pitting regions are counted to obtain the overall pixel value interval of the pitting region, and the overall pixel value interval is evenly divided into 8 intervals, that is, N=8, to obtain multiple pixel value intervals.
[0076] In the formula for the first pitting severity, the serial number of the pixel value interval is used as the weight of the occurrence frequency. The larger the serial number of the pixel value interval, the smaller the pixel value corresponding to the pixel value interval and the lower the brightness. The greater the occurrence frequency, the more pixel values are distributed in the corresponding pixel value interval in the current pitting area. Therefore, the greater the occurrence frequency and the larger the serial number of the pixel value interval, the greater the severity of the first pitting.
[0077] The second pitting severity is further obtained by combining the area ratio of the pitting area in the de-reflected image, that is, the larger the area ratio, the larger the pitting range, and the more serious the pitting. The specific method for obtaining the second pitting severity includes:
[0078] The second pitting severity is obtained according to the second pitting severity formula, which includes:
[0079]
[0080] Where θ is the second pitting severity, k is the number of pitting areas, δ i is the area proportion of the i-th pitting area, σ i is the first pitting severity of the i-th pitting area.
[0081] In the second pitting severity formula, Indicates the average pitting depth. It represents the total pitting area. The second pitting severity is obtained by adjusting the respective weights. The greater the average pitting depth and the larger the total pitting area, the greater the second pitting severity.
[0082] In the embodiment of the present invention, w 1 Set to 0.7, w 2 Set to 1.5. And the second pitting severity is normalized so that its value range is [0,1]. It should be noted that the second pitting severity of the entire surface of the metal fastener can be obtained by taking images of the metal fastener surface at different positions.
[0083] The pitting degree of the current metal fastener can be evaluated according to the second pitting severity. A threshold can be set according to a specific implementation scenario, and whether the metal fastener needs to be replaced can be determined according to the threshold.
[0084] In summary, the embodiment of the present invention uses an image acquisition device with a visible light source to acquire images of the surface of metal fasteners. The image is de-reflected according to the optical characteristics of the surface of the metal fastener, and then the de-reflected image is used to evaluate the pitting defects on the surface of the metal fastener. The embodiment of the present invention achieves accurate defect detection and evaluation of metal fasteners through optical means, and improves the accuracy of pitting defect detection and the reference quality.
[0085] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0086] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
[0087] 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 spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A defect evaluation method for pitting areas of metal fasteners, characterized in that: The method comprises: The surface image of the metal fastener is collected by an image acquisition device with a visible light source; a gradient image of the surface image of the metal fastener is obtained; pixel points in the gradient image whose gradient amplitude is greater than a preset amplitude threshold are used as region growth points; region growth is performed according to the region growth points to obtain a plurality of abnormal region boundaries; the abnormal region boundaries are screened according to their lengths and closures to obtain a plurality of initial pitting region boundaries; and the minimum circumscribed rectangle of the initial pitting region is used as the pitting influence region; The surface image of the metal fastener is divided into a normal area and a highlight area by using threshold segmentation; a normal pitting area and a normal surface background area in each of the pitting affected areas in the normal area are obtained; and a highlight pitting area and a highlight surface background area in each of the pitting affected areas in the highlight area are obtained; Taking the average pixel value of the normal surface background area as the reference pixel value, replacing the original pixel values of the normal surface background area and the highlighted surface background area with the reference pixel value, taking the ratio of the original pixel value of each pixel point in the highlighted surface background area to the reference pixel value as the first reflection coefficient; obtaining the second reflection coefficient of each pixel point in the highlighted point etched area according to the distance between each pixel point in the highlighted point etched area and the adjacent pixel point in the highlighted surface background area and the first reflection coefficient; and correcting the original pixel value of each pixel point in the highlighted point etched area using the inverse of the second reflection coefficient as the weight to obtain a de-reflected image; Obtain all pitting areas in the de-reflective image; obtain a first pitting severity of each pitting area according to the frequency of occurrence of pixel values in the pitting area within multiple preset pixel value intervals; obtain a second pitting severity of the surface of the metal fastener according to the first pitting severity and the area ratio of the pitting area in the de-reflective image; The step of obtaining the highlighted pitting area and the highlighted surface background area in each of the pitting affected areas in the highlighted area comprises: The size of each pitting affected area in the highlighted area is amplified according to a preset adjustment coefficient to obtain an amplified pitting affected area; the amplified pitting affected area is subjected to histogram equalization processing and then the highlighted pitting affected area is obtained by using the Otsu threshold segmentation algorithm; The step of obtaining the second reflection coefficient of each pixel point in the highlighted point etched area according to the distance between each pixel point in the highlighted point etched area and the adjacent pixel point in the highlighted surface background area and the first reflection coefficient comprises: The second reflection coefficient is obtained according to a second reflection coefficient formula, where the second reflection coefficient formula includes: Among them, p α is the αth pixel point in the highlighted spot etched area, p i is the i-th pixel point in the adjacent background area of the highlighted surface, ρ(p α ) is the second reflection coefficient of the αth pixel in the highlighted spot corrosion area, Z is the number of pixels in the adjacent highlighted surface background area, L is the maximum value of the length and width of the amplified pitting area, ‖p α -p i ‖ is the Euclidean distance between the αth pixel in the highlighted etched area and the ith pixel in the adjacent highlighted surface background area, ρ(p i ) is the first reflection coefficient of the i-th pixel point in the adjacent highlighted surface background area.
2. A defect evaluation method for pitting areas of metal fasteners according to claim 1, characterized in that: The collecting of the metal fastener surface image comprises: An image preprocessing operation is performed on the surface image of the metal fastener; the image preprocessing operation includes Gaussian filtering and grayscale conversion.
3. A defect evaluation method for pitting areas of metal fasteners according to claim 1, characterized in that: The performing region growing according to the region growing points to obtain multiple abnormal region boundaries comprises: Select any one of the regional growth points as the starting point. If there are other regional growth points within the preset neighborhood range of the starting point, the regional growth point within the neighborhood range is used as the abnormal region boundary point, and growth continues according to the abnormal region boundary point until the regional growth point no longer exists within the neighborhood range, thereby obtaining multiple abnormal region boundaries.
4. A defect evaluation method for pitting areas of metal fasteners according to claim 3, characterized in that: The screening according to the length and closure of the abnormal area boundary to obtain multiple initial pitting area boundaries includes: The number of the abnormal region boundary points of the abnormal region boundary is used as the length; the distance between the starting point of the abnormal region boundary and the last abnormal region boundary point in the region growth process is obtained; if the distance is greater than a preset distance threshold, it is determined that the abnormal region boundary is not closed; otherwise, it is determined that the abnormal region boundary is closed; The abnormal region boundary that is closed and has a length greater than a preset length threshold is used as the initial pitting region boundary.
5. A defect evaluation method for pitting areas of metal fasteners according to claim 1, characterized in that: The obtaining of the normal pitting area and the normal surface background area in each of the pitting affected areas in the normal area comprises: After performing histogram equalization processing on each of the pitting corrosion affected areas in the normal area, the normal pitting corrosion area and the normal surface background area are obtained using the Otsu threshold segmentation algorithm.
6. A defect evaluation method for pitting areas of metal fasteners according to claim 1, characterized in that: The step of obtaining the first pitting severity of each pitting region according to the occurrence frequency of pixel values in the pitting region within a plurality of preset pixel value intervals comprises: Arrange the plurality of pixel value intervals from large to small; obtain the first pitting severity according to a first pitting severity formula, wherein the first pitting severity formula includes: Wherein, σ is the first pitting severity, N is the number of the pixel value intervals, and p(i) is the occurrence frequency of the pitting area in the i-th pixel value interval.
7. A defect evaluation method for pitting areas of metal fasteners according to claim 1, characterized in that: Obtaining a second pitting severity on the surface of the metal fastener according to the first pitting severity and the area ratio of the pitting region in the de-reflected image includes: The second pitting severity is obtained according to a second pitting severity formula, wherein the second pitting severity formula includes: in, is the second pitting severity, k is the number of pitting areas, δ i is the area ratio of the i-th pitting area, σ i is the first pitting severity of the ith pitting area, w1 is the first fitting weight, and w2 is the second fitting weight.
Citation Information
Patent Citations
Image processing method and system thereof
CN103778599A
Automobile engine oil way copper bush defect detection method based on computer vision
CN114359270A