Automobile circular trailer hole air mark defect detection method based on machine vision

By dividing images into search regions and adjusting non-local mean filtering parameters based on target distance and entropy, the method enhances defect detection accuracy in automobile round trailer hole covers by filtering noise while preserving defects.

CN116012357BActive Publication Date: 2025-07-15HENAN POLYTECHNIC
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310090566.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-09
Publication Date
2025-07-15
Estimated Expiration
2043-02-09

AI Technical Summary

Technical Problem

In the prior art, the air-texture defect detection accuracy of the automobile circular trailer hole cover is low, mainly because the non-local mean filtering algorithm uses unified filter parameters to cause the air-texture defect to be broken.

Method used

Using a machine vision-based method, candidate grayscale images are divided into multiple search areas, and the necessary degree of retention is obtained by identifying the target distance and information entropy of abnormal pixel points, and non-local mean filtering parameters are adjusted to realize adaptive filtering processing.

Benefits of technology

It improves the accuracy of air-texture defect detection, and can filter out noise points while retaining air-texture defect areas, improving detection effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116012357B_ABST
    Figure CN116012357B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and in particular to a method for detecting air streak defects in automobile circular trailer holes based on machine vision. The method comprises: obtaining a candidate grayscale image of an automobile circular trailer hole, identifying abnormal pixel points of the candidate grayscale image, and obtaining the necessary degree of retention of the search area according to the target distance between each abnormal pixel point and other abnormal pixel points in the same column and the information entropy of the search area; obtaining the adjustment factor of the initial non-local mean filter parameter of the search area according to the necessary degree of retention, so as to adjust the initial non-local mean filter parameter to obtain the target non-local mean filter parameter, and filtering the search area to obtain a target grayscale image; and performing air streak defect detection on the automobile circular trailer hole according to the target grayscale image to obtain a detection result. The present invention improves the accuracy of air streak defect detection of automobile circular trailer holes.
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 particularly to a method for detecting air pattern defects of a circular trailer hole of an automobile based on machine vision. Background Art

[0002] During the casting of the circular trailer hole cover of an automobile, air pattern defects are likely to occur. In order to ensure the quality of the circular trailer hole cover of the automobile, it is necessary to detect air pattern defects. Since the paint used for spraying the circular trailer hole cover of the automobile is usually composed of a variety of raw materials, after the circular trailer hole cover of the automobile is painted, there are usually bright spots similar to salt-and-pepper noise on the surface. Therefore, it is necessary to perform denoising processing on the image before detecting the air pattern defects of the circular trailer hole cover of the automobile.

[0003] In the prior art, the non-local means filtering algorithm is used to perform denoising processing on the image. Since the entire image uses a unified filtering parameter for filtering during filtering, it is easy to cause the air pattern defects to be damaged, affecting the accuracy of air pattern defect detection and resulting in a low accuracy between air pattern defects of the circular trailer hole of the automobile. Summary of the Invention

[0004] In order to solve the problem of low accuracy in detecting air pattern defects of the circular trailer hole of an automobile, the present invention provides a method for detecting air pattern defects of a circular trailer hole of an automobile based on machine vision. The specific technical solutions adopted are as follows:

[0005] The present invention proposes a method for detecting air pattern defects of a circular trailer hole of an automobile based on machine vision. The method includes:

[0006] Obtaining a candidate grayscale image of the circular trailer hole of the automobile;

[0007] Dividing the candidate grayscale image into multiple search regions, identifying abnormal pixel points in the search regions, obtaining the target distance between each abnormal pixel point and other abnormal pixel points in the same column thereof, and the information entropy of the search region. According to the target distance and the information entropy, obtaining the retention necessity degree of the search region;

[0008] According to the retention necessity degree, obtaining an adjustment factor for the initial non-local means filtering parameter of the search region;

[0009] Adjusting the initial non-local means filtering parameter according to the adjustment factor to obtain a target non-local means filtering parameter. According to the target non-local means filtering parameter, performing filtering processing on the search region. After performing the filtering processing on the multiple search regions, obtaining a target grayscale image;

[0010] According to the target grayscale image, performing air pattern defect detection on the circular trailer hole of the automobile to obtain a detection result.

[0011] In some embodiments, obtaining a candidate grayscale image of the circular trailer hole of the vehicle includes:

[0012] Collecting an original grayscale image of the circular trailer hole of the vehicle;

[0013] Identifying the edge region of the trailer hole in the original grayscale image, and performing gray value replacement processing on the pixel points within the edge region of the trailer hole to obtain the candidate grayscale image.

[0014] In some embodiments, performing gray value replacement processing on the pixel points within the edge region of the trailer hole to obtain a candidate grayscale image includes:

[0015] Obtaining the gray value of each pixel point in the original grayscale image, determining the number of pixel points corresponding to each gray value, and taking the gray value with the largest number of pixel points as the target gray value;

[0016] Replacing the gray value of the pixel points within the edge region of the trailer hole with the target gray value to obtain the candidate grayscale image.

[0017] In some embodiments, identifying abnormal pixel points in the search area includes:

[0018] Performing gray level classification processing on the gray level interval of the candidate grayscale image to obtain multiple gray levels;

[0019] Using a gray level run-length matrix to traverse the pixel points in the search area column by column, and when traversing to the pixel points of different gray levels, taking the pixel points of different gray levels as the abnormal pixel points.

[0020] In some embodiments, obtaining the target distance between each abnormal pixel point and other abnormal pixel points in the same column thereof and the information entropy of the search area, and obtaining the necessary retention degree of the search area according to the target distance and the information entropy includes:

[0021] Comparing the target distances to determine that the two other abnormal pixel points closest to the abnormal pixel point are the first abnormal pixel point and the second abnormal pixel point respectively;

[0022] Determining the distance between the abnormal pixel point and the first abnormal pixel point as the first distance, and determining the distance between the abnormal pixel point and the second abnormal pixel point as the second distance;

[0023] Calculating the absolute value of the difference between the first distance and the second distance as the target distance difference of the abnormal pixel point;

[0024] Accumulating and summing up the target distance differences of all the abnormal pixel points in the search area to obtain an accumulated sum result;

[0025] Calculate the product of the cumulative summation result and the information entropy, and normalize the product to obtain the retention necessity degree.

[0026] In some embodiments, obtaining an adjustment factor for the initial non-local mean filtering parameter of the search region according to the retention necessity degree includes:

[0027] Obtain the variance of the retention necessity degrees of multiple neighborhood search regions of the search region, and normalize the variance to obtain a normalized value;

[0028] Calculate the sum value of the normalized value and the retention necessity degree;

[0029] Normalize the sum value to obtain the adjustment factor.

[0030] In some embodiments, adjusting the initial non-local mean filtering parameter according to the adjustment factor to obtain a target non-local mean filtering parameter includes:

[0031] Calculate the difference between a set value and the adjustment factor as the adjustment coefficient of the initial non-local mean filtering parameter;

[0032] Calculate the product of the adjustment coefficient and the initial non-local filtering coefficient as the target non-local mean filtering parameter.

[0033] In some embodiments, performing air pattern defect detection on the automotive circular trailer hole according to the target grayscale image to obtain a detection result includes:

[0034] Perform edge detection processing on the target grayscale image to generate a target detection image;

[0035] If there is an edge contour in the target detection image, it is determined that the automotive circular trailer hole has the air pattern defect;

[0036] If there is no edge contour in the target detection image, it is determined that the automotive circular trailer hole does not have the air pattern defect.

[0037] The present invention has the following beneficial effects: The candidate grayscale image is divided into multiple search regions, which facilitates subsequent adaptive filtering processing for each region of the candidate grayscale image. Since the noise points are evenly distributed and the distance between noise points is relatively close, while the distance between the edge pixels of the air pattern defect region is usually farther than the distance between noise points, there is a certain mapping relationship between the target distance between each abnormal pixel and other abnormal pixels in the same column and the probability that the abnormal pixel is an air pattern defect pixel. The information entropy of the search region reflects the degree of chaos in the grayscale distribution of the search region, that is, it can reflect the probability that the search region is in the air pattern curve region. By obtaining the retention necessity degree of the search region through the target distance and information entropy, it can provide a reliable basis for adjusting the adaptive filtering parameters of the search region. According to the retention necessity degree of the search region, an adjustment factor for the initial non-local mean filtering parameter of the search region is obtained, and the initial non-local mean filtering parameter is adjusted according to the adjustment factor, which can realize the adaptive filtering denoising process of the search region. Due to the adaptive filtering denoising process for each search region of the image, while filtering out the noise points in the image, the air pattern defects in the image can be retained. By detecting the air pattern defects of the automotive circular trailer hole through the target grayscale image obtained after adaptive filtering, the accuracy of air pattern defect detection of the automotive circular trailer hole can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following described drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0039] Figure 1 It is a schematic flowchart of a method for detecting air pattern defects of an automotive circular trailer hole based on machine vision provided by an embodiment of the present invention;

[0040] Figure 2 It is a schematic diagram of an edge region of a trailer hole provided by an embodiment of the present invention;

[0041] Figure 3 It is a schematic diagram of an air pattern defect provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0042] To further elaborate on the technical means and effects adopted by the present invention to achieve the intended invention purpose, the following specifically describes, in conjunction with the accompanying drawings and preferred embodiments, a method for detecting air pattern defects in a circular trailer hole of an automobile based on machine vision, including its specific implementation manner, structure, features, and effects. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. In addition, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.

[0043] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which this invention belongs.

[0044] The following specifically describes the specific solution of a method for detecting air pattern defects in a circular trailer hole of an automobile based on machine vision provided by the present invention in conjunction with the accompanying drawings.

[0045] Please refer to Figure 1 , which shows a schematic flowchart of a method for detecting air pattern defects in a circular trailer hole of an automobile based on machine vision provided by an embodiment of the present invention. The method includes the following steps:

[0046] S101, obtain a candidate grayscale image of the circular trailer hole of the automobile.

[0047] In some embodiments, an original grayscale image of the circular trailer hole of the automobile is collected, the edge area of the trailer hole in the original grayscale image is identified, and the gray value of the pixel points in the edge area of the trailer hole is replaced to obtain a candidate grayscale image.

[0048] When the lid of the circular trailer hole of the automobile is in the closed state, the area of the circular trailer hole of the automobile can be photographed by a camera to obtain an image of the circular trailer hole of the automobile, and the image of the circular trailer hole of the automobile is subjected to grayscale processing to obtain an original grayscale image.

[0049] In the embodiment of the present invention, when casting the circular trailer hole cover of the automobile, if raw materials are injected into the mold for casting the circular trailer hole cover of the automobile and there is a lack of necessary exhaust holes or insufficient exhaust holes in the mold, air pattern defects are likely to occur in the cast circular trailer hole cover. Among them, air pattern defects usually appear in the edge area of the circular trailer hole cover of the automobile.

[0050] In some embodiments, Figure 2A schematic diagram of the edge area of a trailer hole provided by an embodiment of the present invention. Since the gradient amplitude of the pixel points in the air stripe defect area in the original grayscale image is smaller than that of the pixel points in the trailer hole edge area, that is to say, the texture of the trailer hole edge area is more obvious than that of the air stripe defect area. In the embodiment of the present invention, the Canny operator can be used to implement edge detection of the original grayscale image. It can be understood that since the Canny operator includes two thresholds, a high threshold and a low threshold, the pixel points with a gradient value greater than the high threshold are strong edge pixel points, the pixel points with a gradient value less than the high threshold and greater than the low threshold are weak edge pixel points, and the pixel points with a gradient value less than the low threshold are non-edge pixel points. The low threshold of the Canny operator can be set to a relatively large value in advance, and then the original grayscale image is subjected to edge detection by the pre-set Canny operator. At this time, only the edge area of the trailer hole can be detected, and the air stripe defect area can be ignored. Among them, the edge area of the trailer hole reflects the gap area between the circular trailer hole cover of the vehicle and the body in the actual scene.

[0051] It should be noted that when detecting the edge area of the trailer hole in the original grayscale image by the pre-set Canny operator, the low threshold of the Canny operator can be set according to the actual scene requirements, and no limitation is made here. Optionally, the low threshold of the Canny operator can be set to 0.6 or 0.7.

[0052] As a possible situation, if there are breakpoints in the edge area of the trailer hole obtained after edge detection processing of the original grayscale image by the pre-set Canny operator, that is, the detected edge area of the trailer hole is discontinuous, then morphological closing operation can be performed on the edge area of the trailer hole to bridge the breakpoints and obtain a complete edge.

[0053] In order to exclude the influence of the trailer hole edge area on the recognition of air stripe defects, it is necessary to remove the trailer hole edge area in the original grayscale image. Therefore, after identifying the trailer hole edge area in the original grayscale image, the pixel points in the trailer hole edge area can be subjected to grayscale value replacement processing to remove the trailer hole edge area in the original grayscale image.

[0054] In the embodiment of the present invention, identifying the edge area of the trailer hole in the original grayscale image and performing grayscale value replacement processing on the pixel points in the edge area of the trailer hole to obtain a candidate grayscale image can remove the edge area of the trailer hole in the original grayscale image, thereby excluding the texture interference of the trailer hole edge and facilitating subsequent filtering and denoising processing.

[0055] In an embodiment of the present invention, gray value replacement processing is performed on pixel points within the edge region of the trailer hole to obtain a candidate gray image, including: obtaining the gray value of each pixel point in the original gray image, determining the number of pixel points corresponding to each gray value, taking the gray value with the largest number of pixel points as the target gray value, and replacing the gray value of the pixel points within the edge region of the trailer hole with the target gray value to obtain a candidate gray image.

[0056] Specifically, a gray histogram of the original gray image can be established. Among them, the abscissa of the gray histogram is the gray value, the ordinate is the number of pixel points, compare the number of pixel points corresponding to each gray value, determine the gray value with the largest number of pixel points as the target gray value, and replace the gray value of the pixel points within the edge region of the trailer hole with the target gray value to obtain a candidate gray image.

[0057] Since the number of normal pixel points in the original gray image is the largest, and the target gray value with the largest number of pixel points is the gray value of the normal pixel points, therefore, replacing the gray value of the pixel points within the edge region of the trailer hole with the target gray value can remove the trailer hole region to facilitate subsequent identification of air pattern defects. Among them, normal pixel points are pixel points outside the air pattern defect region, noise region, and trailer hole edge region.

[0058] S102, divide the candidate gray image into multiple search regions, identify abnormal pixel points in the search regions, obtain the target distance between each abnormal pixel point and other abnormal pixel points in the same column as it, and the information entropy of the search region, and obtain the retention necessity degree of the search region according to the target distance and the information entropy.

[0059] Among them, the search region is the region when the non-local mean filtering algorithm performs filtering processing on the image. It should be noted that the non-local mean filtering algorithm is a well-known technology and will not be elaborated here.

[0060] It should be noted that the size of the search region can be set according to actual needs and no limitation is made here. Optionally, the size of the search region can be 21×21.

[0061] In an embodiment of the present invention, identifying abnormal pixel points in the search region includes: performing gray level classification processing on the gray level interval of the candidate gray image to obtain multiple gray levels, using a gray run matrix to traverse the pixel points in the search region column by column, and when traversing to pixel points of different gray levels, taking the pixel points of different gray levels as abnormal pixel points.

[0062] Optionally, the gray level interval [0, 255] of the candidate gray image can be divided into multiple gray levels. For example, the gray level interval [0, 255] can be divided into 64 gray levels, and the length of the gray level interval for each gray level is 4.

[0063] The gray-level run-length matrix can reflect the variation of pixel points in an image in a certain direction, thereby reflecting the texture information of the image. That is to say, the gray-level run-length matrix can count the number of consecutive occurrences of the same gray level in the same direction in the image. Therefore, in the embodiments of the present invention, the gray-level run-length matrix can be used to traverse each column of pixel points in each search area of the image. When traversing pixel points of different gray levels, the pixel points of different gray levels are used as abnormal pixel points.

[0064] Due to the gray-level difference between noise points and air pattern defect pixel points and normal pixel points, noise points and air pattern defect pixel points will be determined as abnormal pixel points, where the air pattern defect pixel points are pixel points within the air pattern defect area.

[0065] In the embodiments of the present invention, the target distance between each abnormal pixel point and other abnormal pixel points in the same column thereof and the information entropy of the search area are obtained. According to the target distance and the information entropy, the retention necessity degree of the search area is obtained, including: comparing the target distances, determining that the two other abnormal pixel points closest to the abnormal pixel point are the first abnormal pixel point and the second abnormal pixel point respectively, determining the distance between the abnormal pixel point and the first abnormal pixel point as the first distance, and determining the distance between the abnormal pixel point and the second abnormal pixel point as the second distance, calculating the absolute value of the difference between the first distance and the second distance as the target distance difference of the abnormal pixel point, accumulating and summing the target distance differences of all abnormal pixel points in the search area to obtain an accumulated sum result, calculating the product of the accumulated sum result and the information entropy, and normalizing the product to obtain the retention necessity degree.

[0066] Among them, the retention necessity degree represents the probability that the search area is in the air pattern defect area. The greater the retention necessity degree, the greater the probability that the search area is in the air pattern defect area. Correspondingly, the degree of filtering required is lower; the smaller the retention necessity degree, the smaller the probability that the search area is in the air pattern defect area. Correspondingly, the degree of filtering required is higher.

[0067] For each abnormal pixel point in each search area, the target distance between the abnormal pixel point and each other abnormal pixel point in the same column thereof can be compared to determine the two other abnormal pixel points closest to the abnormal pixel point, that is, the first abnormal pixel point and the second abnormal pixel point, and obtain the first distance between the abnormal pixel point and the first abnormal pixel point, and the second distance between the abnormal pixel point and the second abnormal pixel point, and obtain the retention necessity degree of the search area according to the first distance, the second distance and the information entropy of the search area.

[0068] Specifically, the retention necessity degree of each search area can be calculated by the following formula:

[0069]

[0070] Among them, γ i is the retention necessity degree of the i-th search area, H i is the information entropy of the i-th search area, d ij is the first distance between the j-th abnormal pixel point and the first abnormal pixel point in the i-th search area, d i ′ j is the second distance between the j-th abnormal pixel point and the second abnormal pixel point in the i-th search area, i is the index of the search area, j is the index of the abnormal pixel point, J is the number of abnormal pixel points in the i-th search area, || represents taking the absolute value, and Norm{} is the normalization function.

[0071] Among them, the information entropy of the search area can be calculated by the following formula:

[0072]

[0073] Among them, H i is the information entropy of the i-th search area, p j is the frequency of the gray value j appearing in the i-th search area, log() is the logarithmic function, and j is the gray value.

[0074] In the embodiment of the present invention, the larger the information entropy H i of the search area, the more chaotic the gray-scale distribution of the search area, the greater the probability that the search area is in the texture defect area, and correspondingly, the greater the retention necessity degree of the search area. Therefore, the retention necessity degree is positively correlated with the information entropy. In the actual scenario, the distribution of noise points in the candidate gray-scale image is usually relatively uniform, so the distance between noise points is usually relatively close. |d ij -d i ′ j | represents the target distance difference between an abnormal pixel point and other adjacent pixel points. The smaller the target distance difference, the greater the possibility that the abnormal pixel point is a noise pixel point, that is, the smaller the possibility that the abnormal pixel point is a gas pattern defect pixel point. Therefore, the smaller it is, the smaller the probability that the search area is in the texture defect area, and correspondingly, the smaller the retention necessity degree of the search area. On the contrary, the larger the target distance difference |d ij -d i ′ j |, the smaller the possibility that the abnormal pixel point is a noise pixel point, that is, the greater the possibility that the abnormal pixel point is a gas pattern defect pixel point. Therefore, The larger it is, the greater the probability that the search area is in the texture defect area. Correspondingly, the greater the necessary degree of retention of this search area. Therefore, It has a positive correlation with the necessary degree of retention. Thus, by considering the distance between abnormal pixel points in the same column and the information entropy of the search area to calculate the necessary degree of retention of the search area, the accuracy of the necessary degree of retention is improved, providing a reliable basis for whether to perform filtering processing on the corresponding search area subsequently.

[0075] S103. According to the necessary degree of retention, obtain the adjustment factor of the initial non-local mean filtering parameter of the search area.

[0076] Among them, the initial non-local mean filtering parameter is the initial filtering parameter of the non-local mean filtering algorithm (Non Local Maeans, NLM). It should be noted that the initial non-local mean filtering parameter can be set according to actual scenario requirements, and no limitation is made here. Optionally, the initial non-local mean filtering parameter can be set to 20.

[0077] In the embodiment of the present invention, obtaining the adjustment factor of the initial non-local mean filtering parameter of the search area according to the necessary degree of retention includes: obtaining the variance of the necessary degrees of retention of multiple neighborhood search areas of the search area, performing normalization processing on the variance to obtain a normalized value, calculating the sum value of the normalized value and the necessary degree of retention, and performing normalization processing on the sum value to obtain the adjustment factor.

[0078] Among them, the search area is a rectangular area, and multiple neighborhood search areas can be search areas within the eight-neighborhood range of the search area.

[0079] Specifically, the adjustment factor of the initial non-local mean filtering parameter of each search area can be calculated by the following formula:

[0080]

[0081] Among them, μ i is the adjustment factor of the initial non-local mean filtering parameter of the i-th search area, γ i is the necessary degree of retention of the i-th search area, is the set of multiple neighborhood search areas of the i-th search area, k is the number of multiple neighborhood search areas, Var{} represents taking the variance, is the variance of the necessary degrees of retention of multiple neighborhood search areas of the i-th search area, and Norm{} is the normalization function.

[0082] In the embodiments of the present invention, the magnitude of the adjustment factor can reflect the probability that the search region is in the air pattern defect region. The larger the adjustment factor, the greater the probability that the search region is in the air pattern defect region, and the higher the necessity of retaining the search region; the smaller the adjustment factor, the smaller the probability that the search region is in the air pattern defect region, and the lower the necessity of retaining the search region.

[0083] In the above formula for calculating the adjustment factor, it can reflect the stability of the necessity of retaining multiple neighboring search regions of the search region. The larger it is, the weaker the stability of the necessity of retaining multiple neighboring search regions of the search region, and the greater the difference in the necessity of retaining between these multiple neighboring search regions. Correspondingly, the greater the probability that the search region is at the edge of the air pattern defect region, the higher the necessity of retaining the search region, and the larger the adjustment factor of the initial non-local mean filtering parameter of the search region. The smaller it is, the stronger the stability of the necessity of retaining multiple neighboring search regions of the search region, and the smaller the difference in the necessity of retaining between these multiple neighboring search regions. Correspondingly, the smaller the probability that the search region is at the edge of the air pattern defect region, the lower the necessity of retaining the search region, and the smaller the adjustment factor of the initial non-local mean filtering parameter of the search region. By introducing the variance of the necessity of retaining multiple neighboring search regions of the search region, the difference in the necessity of retaining between neighboring search regions can be combined to determine the probability that the search region is at the edge of the air pattern defect region, and based on this probability, the necessity of retaining γ i is adjusted to obtain the adjustment factor of the initial non-local mean filtering parameter, which can improve the accuracy of the adjustment factor, thereby providing a reliable basis for the subsequent adjustment of the initial non-local mean filtering parameter.

[0084] S104. Adjust the initial non-local mean filtering parameter according to the adjustment factor to obtain the target non-local mean filtering parameter. According to the target non-local mean filtering parameter, perform filtering processing on the search region. After performing filtering processing on multiple search regions, obtain the target grayscale image.

[0085] In the embodiments of the present invention, adjusting the initial non-local mean filtering parameter according to the adjustment factor to obtain the target non-local mean filtering parameter includes: calculating the difference between the set value and the adjustment factor as the adjustment coefficient of the initial non-local mean filtering parameter, and calculating the product of the adjustment coefficient and the initial non-local filtering coefficient as the target non-local mean filtering parameter.

[0086] Optionally, the set value is 1.

[0087] Specifically, the target non-local mean filtering parameter of each search region can be calculated according to the following formula:

[0088] h i = h0 * (1 - μ i )

[0089] Wherein, h i is the target non-local mean filtering parameter of the i-th search area, h0 is the initial non-local mean filtering parameter of the i-th search area, and μ i is the adjustment factor of the initial non-local mean filtering parameter of the i-th search area.

[0090] In the embodiments of the present invention, the larger the target non-local mean filtering parameter, the better the filtering and denoising effect, that is, edge details will be lost. The smaller the target non-local mean filtering parameter, the worse the filtering and denoising effect, that is, edge details will be retained. Among them, the larger the adjustment factor of the search area, the greater the probability that the search area is in the texture defect area, and the higher the necessity to retain this search area. Correspondingly, the smaller the target non-local mean filtering parameter; the smaller the adjustment factor of the search area, the smaller the probability that the search area is in the texture defect area, and the lower the necessity to retain this search area. Correspondingly, the larger the target non-local mean filtering parameter. Thus, each search area in the candidate grayscale image can be adaptively filtered and denoised to obtain the target grayscale image, so that while filtering out the noise points in the candidate grayscale image, the air pattern defect area in the candidate grayscale image can be better retained, facilitating subsequent air pattern defect recognition.

[0091] S105. Detect air pattern defects in the circular trailer hole of the vehicle according to the target grayscale image to obtain a detection result.

[0092] Optionally, perform edge detection processing on the target grayscale image to generate a target detection image. If there is an edge contour in the target detection image, it is determined that there are air pattern defects in the circular trailer hole of the vehicle. If there is no edge contour in the target detection image, it is determined that there are no air pattern defects in the circular trailer hole of the vehicle.

[0093] Figure 3 is a schematic diagram of an air pattern defect provided by an embodiment of the present invention. Since the gradient amplitude of the pixel points in the air pattern defect area of the target grayscale image is usually small, that is, the texture obviousness of the air pattern defect area is low, the low threshold of the Canny operator can be set to a relatively small value in advance, and then the target grayscale image is subjected to edge detection through the pre-set Canny operator. At this time, air pattern defects as shown in Figure 3 can be detected from the target grayscale image.

[0094] It should be noted that the low threshold of the Canny operator can be set according to actual scenario requirements and is not limited here. Optionally, the low threshold of the Canny operator can be set to 0.3 or 0.4.

[0095] In the embodiment of the present invention, after each search area in the target grayscale image is adaptively filtered and denoised by the non-local mean filtering algorithm, the noise points in the image are removed, the noise interference is reduced, and the texture defects in the image are retained. By performing edge detection on the target grayscale image, the detection of air pattern defects is realized, and the accuracy of air pattern defect detection is improved.

[0096] To sum up, in the embodiment of the present invention, the candidate grayscale image is divided into multiple search areas, which is convenient for subsequent adaptive filtering processing of each area of the candidate grayscale image. Since the noise points are evenly distributed and the distance between the noise points is relatively close, while the distance between the edge pixel points of the air pattern defect area is usually farther than the distance between the noise points, there is a certain mapping relationship between the target distance between each abnormal pixel point and other abnormal pixel points in the same column and the probability that the abnormal pixel point is an air pattern defect pixel point. The information entropy of the search area reflects the degree of chaos of the grayscale distribution of the search area, that is, it can reflect the probability that the search area is in the air pattern curve area. By obtaining the retention necessity degree of the search area through the target distance and the information entropy, a reliable basis can be provided for adjusting the adaptive filtering parameters of the search area. According to the retention necessity degree of the search area, the adjustment factor of the initial non-local mean filtering parameter of the search area is obtained, and the initial non-local mean filtering parameter is adjusted according to the adjustment factor, so as to realize the adaptive filtering and denoising processing of the search area. Since the adaptive filtering and denoising processing of each search area of the image can filter out the noise points in the image while retaining the air pattern defects in the image, by performing air pattern defect detection on the target grayscale image obtained after adaptive filtering on the circular trailer hole of the car, the accuracy of air pattern defect detection of the circular trailer hole of the car can be improved.

[0097] It should be noted that the above sequence of the 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 result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0098] Each embodiment in this specification is described in a progressive manner. The same or similar parts among the embodiments can be referred to each other, and the key point of each embodiment is to illustrate the differences from other embodiments.

Claims

1. A method for detecting air pattern defects in the circular trailer hole of an automobile based on machine vision, characterized in that, The method includes: Obtaining a candidate grayscale image of a circular trailer hole of a vehicle; Dividing the candidate grayscale image into multiple search regions, identifying abnormal pixel points in the search regions, obtaining the target distance between each abnormal pixel point and other abnormal pixel points in the same column thereof, and the information entropy of the search region, and obtaining the retention necessity degree of the search region according to the target distance and the information entropy; Obtaining an adjustment factor for the initial non-local mean filtering parameter of the search region according to the retention necessity degree; Adjusting the initial non-local mean filtering parameter according to the adjustment factor to obtain a target non-local mean filtering parameter, and performing filtering processing on the search region according to the target non-local mean filtering parameter. After performing the filtering processing on the multiple search regions, a target grayscale image is obtained; Performing air pattern defect detection on the circular trailer hole of the vehicle according to the target grayscale image to obtain a detection result.

2. The method according to claim 1, characterized in that, The obtaining of the candidate grayscale image of the circular trailer hole of the vehicle includes: Collecting an original grayscale image of the circular trailer hole of the vehicle; Identifying the edge region of the trailer hole in the original grayscale image, and performing gray value replacement processing on the pixel points in the edge region of the trailer hole to obtain the candidate grayscale image.

3. The method according to claim 2, wherein The performing of the gray value replacement processing on the pixel points in the edge region of the trailer hole to obtain a candidate grayscale image includes: Obtaining the gray value of each pixel point in the original grayscale image, determining the number of pixel points corresponding to each gray value, and taking the gray value with the largest number of pixel points as the target gray value; Replacing the gray value of the pixel points in the edge region of the trailer hole with the target gray value to obtain the candidate grayscale image.

4. The method according to claim 1, wherein The identifying of the abnormal pixel points in the search region includes: Performing gray level classification processing on the gray level interval of the candidate grayscale image to obtain multiple gray levels; Traversing the pixel points in the search region column by column using a gray level run length matrix, and when traversing to pixel points of different gray levels, taking the pixel points of different gray levels as the abnormal pixel points.

5. The method according to claim 1, wherein The obtaining of the target distance between each abnormal pixel point and other abnormal pixel points in the same column thereof, and the information entropy of the search region, and the obtaining of the retention necessity degree of the search region according to the target distance and the information entropy includes: Comparing the target distances to determine that the two other abnormal pixel points closest to the abnormal pixel point are the first abnormal pixel point and the second abnormal pixel point respectively; Determining the distance between the abnormal pixel point and the first abnormal pixel point as the first distance, and determining the distance between the abnormal pixel point and the second abnormal pixel point as the second distance; Calculating the absolute value of the difference between the first distance and the second distance as the target distance difference of the abnormal pixel point; Performing cumulative summation on the target distance differences of all the abnormal pixel points in the search region to obtain a cumulative summation result; Calculating the product of the cumulative summation result and the information entropy, and performing normalization processing on the product to obtain the retention necessity degree.

6. The method according to claim 1, wherein Obtaining an adjustment factor for the initial non-local mean filtering parameter of the search area according to the necessary degree of retention includes: Obtaining the variance of the necessary degree of retention of multiple neighborhood search areas of the search area, and performing normalization processing on the variance to obtain a normalized value; Calculating the sum value of the normalized value and the necessary degree of retention; Performing normalization processing on the sum value to obtain the adjustment factor.

7. The method according to claim 1, wherein Adjusting the initial non-local mean filtering parameter according to the adjustment factor to obtain the target non-local mean filtering parameter includes: Calculating the difference between a set value and the adjustment factor as the adjustment coefficient of the initial non-local mean filtering parameter; Calculating the product of the adjustment coefficient and the initial non-local filtering coefficient as the target non-local mean filtering parameter.

8. The method according to claim 1, wherein Performing air pattern defect detection on the automotive circular trailer hole according to the target grayscale image to obtain a detection result includes: Performing edge detection processing on the target grayscale image to generate a target detection image; If there is an edge contour in the target detection image, it is determined that the automotive circular trailer hole has the air pattern defect; If there is no edge contour in the target detection image, it is determined that the automotive circular trailer hole does not have the air pattern defect.

Citation Information

Patent Citations

  • Environment dust concentration detection method and system based on computer image recognition

    CN114387273A

  • Systems, Methods, and Graphical User Interfaces for Interacting with Augmented and Virtual Reality Environments

    US20190065027A1