Image feature-based automobile part paint defect detection method and system

By employing an image feature-based detection method, which utilizes feature analysis of local images in low light and stripes, the problem of distinguishing between false defects and real defects is solved, achieving efficient defect detection, reducing false detection rate, and improving the detection capability of minute defects.

CN122415595APending Publication Date: 2026-07-17CHANGSHU ZHONGTE AUTOMOTIVE TRIM CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHANGSHU ZHONGTE AUTOMOTIVE TRIM CO LTD
Filing Date
2026-06-12
Publication Date
2026-07-17

Smart Images

  • Figure CN122415595A_ABST
    Figure CN122415595A_ABST
Patent Text Reader

Abstract

This invention relates to the field of image recognition technology, specifically to a method and system for detecting paint defects on automotive parts based on image features. The method includes: acquiring low-light local images and stripe local images of the same part under test; extracting suspected regions from the low-light and stripe local images respectively, and performing position matching and filtering on the two sets of suspected regions to obtain candidate regions; calculating the interpretable anomaly degree of pixels, and determining the deviation degree of the candidate regions based on the interpretable anomaly degree; calculating the relative anomaly degree of pixels, and determining the homogeneity of each pixel in the candidate regions based on the relative anomaly degree; using homogeneity to obtain the continuous regularity of the candidate regions; calculating the defect confidence level of the candidate regions based on the deviation degree and continuous regularity; and determining whether the candidate regions are defect regions, regions to be reviewed, or pseudo-anomaly regions based on the defect confidence level. This invention can effectively distinguish between pseudo-defects and real defects, significantly reducing the false detection rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image recognition technology, and more specifically to a method and system for detecting paint defects on automotive parts based on image features. Background Technology

[0002] After automotive parts are painted, their paint quality is typically inspected to identify surface defects such as scratches, particles, and pinholes. For exterior parts such as rearview mirror housings and door handles, paint quality directly affects the overall vehicle appearance consistency and product grade; therefore, specialized surface defect inspection is usually required during the manufacturing process.

[0003] In existing technologies, a combination of high-angle light, low-angle light, and stripe light sources is often used to illuminate high-gloss surfaces to enhance the visibility of defects in images. Although this approach addresses the detection of high-gloss surfaces, it is essentially still an illumination enhancement method and has not yet established a complete link for analyzing reflection component features and geometric anomaly features based on controlled optical acquisition. This makes it difficult to effectively distinguish between false defects caused by highlights, environmental reflections, or changes in surface normals and genuine minor defects. Especially on painted exterior parts of automotive components with significant curvature changes, normal reflection changes or stripe distortions are easily misjudged as defects, leading to a high false detection rate. Furthermore, its ability to consistently detect minor, genuine defects is insufficient. Summary of the Invention

[0004] This invention provides a method and system for detecting paint defects on automotive parts based on image features, in order to solve existing problems.

[0005] The image feature-based method and system for detecting paint defects in automotive parts of the present invention adopts the following technical solution: One embodiment of the present invention provides a method for detecting paint defects on automotive parts based on image features. The method includes the following steps: Acquire low-light local images and stripe local images of the same part under test; Suspected regions are extracted from low-light local images and stripe local images respectively, and the two sets of suspected regions are matched and filtered to obtain one or more candidate regions; The interpretable anomaly level of each pixel is calculated based on the corresponding region of each candidate region in the low-light local image, and the deviation level of each candidate region is determined based on the interpretable anomaly level of each pixel. The relative anomaly level of each pixel is calculated based on the corresponding region of each candidate region in the stripe local image, and the homogeneity of each pixel in each candidate region is determined based on the relative anomaly level of each pixel. The continuous regularity of each candidate region is obtained by utilizing the homogeneity of each pixel in each candidate region. The defect confidence level of each candidate region is calculated based on the degree of deviation and the continuity of each candidate region. Based on the comparison between the defect confidence level and the preset confidence threshold, each candidate region is determined to be a defect region, a region to be reviewed, or a pseudo-anomaly region.

[0006] Furthermore, the specific steps involved in extracting suspected regions from the low-light local image and the stripe local image, and performing position matching and filtering on the two sets of suspected regions to obtain one or more candidate regions are as follows: Defects in low-light local images are extracted using the local background subtraction method, and adaptive threshold segmentation and connected component extraction are performed on the defects to obtain the first suspected region in the low-light local image. A local smoothing reference image is generated along the stripe extension direction using the local stripe continuity deviation method. The difference between the local smoothing reference image and the stripe local image is obtained. Adaptive threshold segmentation and connected component extraction are performed on the difference results to obtain the second suspected region in the stripe local image. The first suspected region and the second suspected region are matched in terms of location, and it is determined whether the overlapping area ratio of the matched first suspected region and the second suspected region reaches a preset ratio. If it does, the union of the two suspected regions is determined as the candidate region. For suspected regions that only appear in low-light local images or only in striped local images, determine whether the region meets the screening criteria. If it does, the suspected region is identified as a candidate region. The screening criteria include the area range, boundary concentration, and positional stability of the suspected region.

[0007] Furthermore, the specific steps for calculating the interpretable anomaly degree of each pixel based on the corresponding region of each candidate region in the low-light local image are as follows: The corresponding region of each candidate region in the low-light local image is taken as the low-light candidate region. A local background region of a preset width is extracted from the periphery of the weak light candidate region using a dilation function; Reconstruct the expected response map of the weak light candidate region under defect-free conditions based on the gray-level distribution of the local background region; For each pixel in the weak light candidate region, the difference is obtained by subtracting the gray value of the pixel in the expected response map from the gray value of the pixel in the weak light candidate region, and the absolute value of the difference is recorded as the first absolute value. The interpretable anomaly level of each pixel is calculated by using the sum of the standard deviation of grayscale fluctuation in the local background region and a preset minimum positive number as the denominator and the first absolute value as the numerator.

[0008] Furthermore, the specific steps for determining the deviation degree of each candidate region based on the interpretable anomaly degree of each pixel are as follows: The mean of the interpretable anomalies of all pixels in the low-light candidate region is used to determine the deviation of each candidate region.

[0009] Furthermore, the specific steps for calculating the relative anomaly degree of each pixel based on the corresponding region of each candidate region in the stripe local image are as follows: The corresponding region of each candidate region in the stripe local image is taken as the stripe candidate region; The dilation function is used to extract the surrounding normal stripe region outside the stripe candidate region; Based on the fringe extension trend of the surrounding normal fringe area, the main direction of the local fringe is determined; a smooth extension model is constructed along the main direction of the local fringe to generate a reference fringe response map of the fringe candidate area; For each pixel in the stripe candidate region, the difference is obtained by subtracting the gray value of the pixel in the reference stripe response map from the gray value of the pixel in the stripe candidate region, and the absolute value of the difference is recorded as the second absolute value. The relative degree of abnormality of each pixel is calculated by using the sum of the standard deviation of grayscale fluctuation in the surrounding normal stripe area and the preset minimum positive number as the denominator and the second absolute value as the numerator.

[0010] Furthermore, the specific steps for determining the homogeneity of each pixel in each candidate region based on the relative anomaly degree of each pixel are as follows: For each pixel in the stripe candidate region, a preset number of adjacent pixels are selected along the main direction of the local stripe, centered on the pixel, as the neighborhood of the pixel. The set of neighborhood points is denoted as the linear oriented neighborhood of the pixel. Calculate the absolute value and sum of the differences in relative anomaly degree between the pixel and each neighboring pixel in the linearly oriented neighborhood; The sum of the sum and the preset minimum positive number are used as the denominator, and the absolute value of the difference is used as the numerator to calculate the degree of difference between the pixel and each neighboring pixel. The summation of the differences between the pixel and all its neighboring points in the linearly oriented neighborhood yields the total neighborhood difference score for that pixel. The ratio of the total difference degree of the neighborhood of the pixel to the number of neighboring points in the linearly oriented neighborhood is denoted as the first ratio. Subtracting the first ratio from 1 yields the homogeneity of each pixel in each candidate region.

[0011] Furthermore, the specific steps for obtaining the continuous regularity of each candidate region by utilizing the homogeneity of each pixel in each candidate region are as follows: Calculate the mean and standard deviation of the homogeneity of all pixels in the stripe candidate region, and use the sum of the mean plus three times the standard deviation as the screening threshold. Pixels with homogeneity greater than the screening threshold in the stripe candidate region are considered high homogeneous points, and the set of all high homogeneous points is considered the high homogeneous point set. Perform connected component analysis on the set of highly homogeneous points, and take the connected component with the largest area as the main highly homogeneous region; Principal component analysis was used to analyze the spatial distribution direction of the main homogeneous region, and the first and second eigenvalues ​​were obtained. The second ratio is calculated by using the sum of the first eigenvalue, the second eigenvalue, and the preset minimum positive number as the denominator, and the difference between the first eigenvalue and the second eigenvalue as the numerator. The third ratio is calculated by dividing the number of highly homogeneous points in the set of highly homogeneous points by the average homogeneity of the set of highly homogeneous points, and using the number of highly homogeneous points contained in the main highly homogeneous region as the numerator. The product of the second ratio and the third ratio is used to determine the continuous regularity of each candidate region.

[0012] Furthermore, the specific steps for calculating the defect confidence level of each candidate region based on the deviation degree and continuous regularity of each candidate region are as follows: Add 1 to the deviation of each candidate region to get the sum value, and divide the deviation of each candidate region by the sum value to get the fourth ratio value; The ratio is obtained by dividing the number of high homogeneous points in the high homogeneous point set by the total number of pixels in the stripe candidate region. The product of this ratio and the continuous regularity of each candidate region is taken as the first product. Subtract the first product from 1 to get the difference. Multiply the difference by the fourth ratio to get the defect confidence of each candidate region.

[0013] Furthermore, the specific steps for determining each candidate region as a defect region, a region to be reviewed, or a pseudo-anomaly region based on the comparison result between the defect confidence level and the preset confidence threshold are as follows: Determine the confidence level of defects in the candidate regions: If the defect confidence level of a candidate region is less than or equal to the first confidence threshold, then the candidate region is determined to be a pseudo-anomaly region. If the confidence level of a candidate region's defect is greater than the first confidence threshold but less than the second confidence threshold, then the candidate region is determined to be a region to be reviewed. If the confidence level of a candidate region is greater than or equal to the second confidence threshold, then the candidate region is determined to be a defective region.

[0014] This invention proposes an image feature-based automotive parts paint defect detection system, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps of the image feature-based automotive parts paint defect detection method.

[0015] The beneficial effects of the technical solution of this invention are as follows: This invention proposes a method and system for detecting paint defects on automotive parts based on image features. Through controlled acquisition of dual images under the same working conditions, interpretable abnormal features of the reflective background are extracted from the low-light local image, and stripe structure continuity and abnormal features are extracted from the stripe local image. Suspected areas in the two types of images are matched, fused, and jointly judged, constructing a detection mechanism of "independent anomaly identification—structural continuity verification—defect confidence output." This mechanism can effectively distinguish between false defects caused by highlights, environmental reflections, and changes in surface normals, and real minor defects such as scratches, pits, and particles, significantly reducing the false detection rate. Simultaneously, the high sensitivity of stripe patterns to surface deformation and the quantitative assessment of independent residual anomalies in low-light images enhance the stable detection capability of minor real defects. Furthermore, through dual feature fusion and confidence level output, the detection results have clear quantitative basis, facilitating reliable decisions for subsequent alarms, sorting, or manual review, and are particularly suitable for online detection of high-gloss paint surfaces on automotive parts with significant curvature changes. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a flowchart illustrating the steps of the image feature-based method for detecting paint defects in automotive parts according to the present invention. Figure 2 This is a block diagram of the image feature-based automotive parts paint defect detection system of the present invention. Detailed Implementation

[0018] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of the image feature-based method and system for detecting paint defects on automotive parts proposed according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.

[0019] Unless otherwise defined, 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 pertains.

[0020] The following description, in conjunction with the accompanying drawings, details the specific scheme of the image feature-based method and system for detecting paint defects on automotive parts provided by this invention.

[0021] Please see Figure 1 The diagram illustrates a flowchart of a method for detecting paint defects on automotive parts based on image features, according to an embodiment of the present invention. The method includes the following steps: Step S001: Acquire a low-light local image and a stripe local image of the same part under test.

[0022] It should be noted that in this embodiment, the automotive parts to be tested are placed sequentially on the production line and enter the testing unit in order. After each part enters the testing station, it is first fixed in a predetermined position by a positioning fixture to ensure the consistency of position in subsequent image acquisition.

[0023] During the first image acquisition, the system dimmed the lighting conditions and photographed the painted surface of the part under test in an environment with reduced surface reflection, obtaining the first type of image, namely the low-light image. During the second image acquisition, the system projected regular light and dark stripes onto the painted surface of the part, and the same camera was used to capture images from the same position, angle, and workpiece condition, obtaining the second type of image, namely the striped image. Throughout both acquisition processes, the part remained stationary to ensure that the two images were strictly aligned in space.

[0024] After data acquisition, median filtering is first used to denoise the image to preserve the edge information of the parts. Subsequently, a threshold segmentation method is used to extract the local detection areas of the parts from the background, ultimately obtaining low-light local images and stripe local images of the same part for subsequent defect analysis.

[0025] Step S002: Extract suspected regions from the low-light local image and the stripe local image respectively, and perform position matching and filtering on the two sets of suspected regions to obtain one or more candidate regions.

[0026] It should be noted that on the painted exterior parts of automotive components with significant curvature changes, the difference between real defects and pseudo defects lies in the difference relative to the local reflection field; furthermore, in suspected areas, real defects and pseudo defects are manifested in the difference between the homogeneity and continuity of the internal stripes.

[0027] Step S002 further includes steps S0021-S0024: Step S0021: Defects in the local image of low light are extracted using the local background subtraction method, and adaptive threshold segmentation and connected component extraction are performed on the defects to obtain the first suspected region in the local image of low light.

[0028] It should be noted that the local background difference method highlights defect areas that differ significantly from the surrounding background grayscale by calculating the difference between each pixel and the average grayscale value of its local neighborhood.

[0029] For each pixel in the low-light local image, a neighborhood window of a predetermined size is selected centered on that pixel. The average or median gray value of all pixels within this window is calculated as the local background estimate for that pixel. Then, the gray value of the original pixel is subtracted from this local background estimate to obtain the difference result. If the difference result exceeds a preset sensitivity threshold, the pixel is considered to potentially belong to a defect region. Finally, adaptive thresholding is performed on the difference image, marking points significantly deviating from the background as foreground. Connected component analysis is then used to merge adjacent foreground points into a continuous suspected defect region, i.e., the first suspected region.

[0030] Step S0022: A local smooth reference image is generated along the stripe extension direction using the local stripe continuity deviation method. The difference between the local smooth reference image and the stripe local image is obtained. Adaptive threshold segmentation and connected component extraction are performed on the difference result to obtain the second suspected region in the stripe local image.

[0031] It should be noted that the local stripe continuity deviation method performs local smoothing filtering on each pixel along the stripe extension direction to generate a reference image that reflects the ideal stripe shape. Then, the original image is subtracted from the reference image point by point to highlight abnormal areas of stripe distortion or breakage.

[0032] For each pixel in the stripe local image, a linear neighborhood is selected centered on that pixel along the stripe extension direction. The weighted average or median of the pixel grayscale values ​​within this neighborhood is calculated as the ideal stripe grayscale estimate for that point, thus generating a locally smoothed reference image. Then, the grayscale values ​​of the original stripe image are subtracted pixel-by-pixel from the corresponding grayscale values ​​in the reference image to obtain a difference image. Regions with larger grayscale values ​​in the difference image correspond to locations where the stripes are significantly distorted or broken. Finally, adaptive thresholding is performed on the difference image, marking pixels that significantly deviate from zero as outliers. Connected component analysis is then used to merge adjacent outliers into continuous suspected defect regions, i.e., the second suspected region.

[0033] Step S0023: Perform position matching on the first suspected region and the second suspected region, and determine whether the overlapping area ratio of the matched first suspected region and the second suspected region reaches a preset ratio. If it does, the union of the two suspected regions is determined as the candidate region.

[0034] It should be noted that: the first suspected area and the second suspected area are superimposed on a unified spatial coordinate system (since the part and the camera did not move during the two acquisitions, the pixel coordinates of the two images are naturally aligned), and the ratio of the overlapping area to the union area of ​​the two is calculated, which is the intersection-union ratio (IoU). This ratio is the proportion of the overlapping area. If this proportion reaches a preset ratio (e.g., 0.5, which can be adjusted to between 0.3 and 0.7 according to the actual detection requirements), it is determined that the two suspected areas correspond to the same physical defect, and the union of the two areas (i.e., the set of all pixels of the first suspected area and the second suspected area) is determined as the candidate area to ensure complete coverage of the abnormal range detected under both lighting conditions.

[0035] Step S0024: For suspected regions that only appear in the low-light local image or only appear in the striped local image, determine whether the region meets the screening criteria. If it does, the suspected region is determined as a candidate region. The screening criteria include the area range, boundary concentration, and positional stability of the suspected region.

[0036] It should be noted that for suspected regions appearing only in a single image, due to the lack of matching verification from another image, further evaluation of their credibility as candidate regions is needed through screening criteria. The screening criteria include the following three aspects: Area Range: The number of pixels in the suspected area should fall between the preset minimum area threshold and the maximum area threshold. Areas that are too small are usually noise or minor interference, while areas that are too large may correspond to large structural features of the part itself (such as chamfered edges), neither of which should be judged as a real defect. Typically, the minimum area threshold can be set to 5-10 pixels, and the maximum area threshold can be set in the range of 100-500 pixels depending on the part size and defect type.

[0037] Boundary concentration: Calculate the compactness or convexity of the suspected region boundary, such as the ratio of the region area to the area of ​​its circumscribed rectangle, or the roundness of the boundary outline. The more concentrated and compact the boundary of a region, the more it conforms to the morphological characteristics of isolated defects (such as particles or scratches); while regions with loose boundaries, elongated shapes, or highly irregular shapes are more likely to be noise or false defects caused by surface reflection.

[0038] Positional stability: For the same component, the consistency of the frequency and position of the suspected area in repeated inspections (e.g., 3-5 times). Compare the current inspection results with the historical inspection records of the component. If the same position appears multiple times and the shape is stable, it is more likely to be a real or structurally fixed anomaly; if the position is random and highly sporadic, it tends to be noise or temporary pseudo-defects.

[0039] Only when a suspected region meets all three of the above conditions will it be identified as a candidate region and included in the subsequent confidence calculation; otherwise, it will be marked as a weak false anomaly and removed or recorded for manual review.

[0040] At this point, one or more candidate regions have been obtained.

[0041] Step S003: Calculate the interpretable anomaly degree of each pixel based on the corresponding region of each candidate region in the low-light local image, and determine the deviation degree of each candidate region based on the interpretable anomaly degree of each pixel.

[0042] It's important to note that during parts inspection, defects such as scratches, dents, and particles on the paint surface, when not affected by highlights, do not appear as a natural continuation of the surrounding normal reflective background. Instead, they are superimposed on the local reflective field in a relatively independent manner, thus disrupting the original reflective continuity between the candidate area and its surrounding background. In other words, the actual response of the region containing a real defect usually cannot be naturally explained solely by the brightness distribution and reflective variation trends of the surrounding normal background. In contrast, pseudo-defects are not isolated anomalies but rather part of the local reflective field itself, with their grayscale changes maintaining a continuous coupling relationship with the surrounding area.

[0043] Therefore, the essential difference between real and pseudo-defects lies in whether the anomaly in the candidate region can be naturally explained by the surrounding local reflective background. If the anomaly in a candidate region is merely a normal continuation of a highlight, reflection, or curvature change in the local reflective field, then the anomaly should have a strong continuity with the surrounding background. Conversely, if a real, minute defect exists in the candidate region, this defect will disrupt this continuity, causing the actual response to deviate from the normal reflective response inferred from the surrounding background, thus forming an independent residual anomaly relative to the local reflective field.

[0044] The process of calculating the interpretable anomaly level of each pixel based on the corresponding region of each candidate region in the low-light local image further includes steps S0031-S0035: Step S0031: Take the corresponding region of each candidate region in the low-light local image as the low-light candidate region.

[0045] Step S0032: Use the dilation function to extract a local background region of a preset width outside the weak light candidate region.

[0046] It should be noted that dilation is a fundamental operation in morphological image processing. It expands the boundary of the foreground region by sliding a structuring element across the image and assigning the maximum pixel value within the structuring element's coverage area to the anchor pixel. When extracting the local background region, the binary mask of the weak-light candidate region is first dilated: using a preset width (e.g., 10 pixels) as the radius (or side length) of the structuring element, the mask is dilated to obtain the dilated region (containing the original candidate region and its surrounding extension). Then, the dilated region is subtracted from the original weak-light candidate region (i.e., the dilated region minus the original region), and the resulting annular region is the local background region of the preset width. The preset width refers to the pixel distance extending outward from the boundary of the original candidate region, typically ranging from 5 to 15 pixels. This value can be adjusted according to image resolution and defect size: a smaller value (e.g., 5 pixels) is used when the resolution is high or the expected defect is small, and a larger value (e.g., 15 pixels) is used when the defect is large or sufficient statistical data is needed for the background.

[0047] Step S0033: Reconstruct the expected response map of the weak light candidate region under defect-free conditions based on the gray-scale distribution of the local background region.

[0048] It's important to note that the core idea of ​​this step is to smoothly extrapolate the grayscale variation trend of the surrounding normal background into the candidate region. The specific method is as follows: First, extract the coordinates and grayscale values ​​of all pixels within the local background region, treating these data as a set of spatial points. Then, use the least squares method to fit a two-dimensional plane (i.e., a surface where grayscale changes linearly with the image's horizontal and vertical coordinates) so that this plane best approximates the actual grayscale distribution within the background region. After obtaining the plane equation, substitute the coordinates of each pixel within the weak-light candidate region into the equation; the calculated grayscale value is the expected grayscale value of that point under defect-free conditions. This method assumes that the grayscale variation in the background region is smooth and linear, effectively eliminating slow reflection changes caused by gradual illumination changes or curved surfaces of parts. For scenarios with complex curvature variations, quadratic surface fitting or bilinear interpolation methods can also be used, but plane fitting is sufficient for most industrial inspection needs. Finally, all expected grayscale values ​​form an expected response map with the same size as the weak-light candidate region.

[0049] Step S0034: For each pixel in the weak light candidate region, subtract the gray value of the pixel in the expected response map from the gray value of the pixel in the weak light candidate region to obtain the difference, and record the absolute value of the difference as the first absolute value.

[0050] Specifically, Let it be the first absolute value, where These are the pixels in the candidate region for low-light conditions. Represents pixels The gray value in the weak light candidate region i, Represents pixels The grayscale value in the expected response map j.

[0051] Step S0035: Using the sum of the grayscale fluctuation standard deviation of the local background region and the preset minimum positive number as the denominator and the first absolute value as the numerator, calculate the interpretable anomaly degree of each pixel.

[0052] It should be noted that the standard deviation of grayscale fluctuation in a local background region refers to the statistical standard deviation of the grayscale values ​​of all pixels within the aforementioned extracted annular local background region. The calculation process is as follows: first, calculate the mean grayscale value of all pixels within the region; then, for each pixel, square the difference between its grayscale value and the mean; finally, divide the sum of all squares by the total number of pixels and take the square root to obtain the standard deviation. This standard deviation quantitatively describes the degree of grayscale dispersion or texture roughness of the background region itself.

[0053] The preset minimum positive number is a normal number much smaller than the range of image grayscale values, used to avoid calculation overflow caused by a zero denominator. Typically, this minimum positive number can be set to... or It is much smaller than the image grayscale value range (0~255), so its actual impact on the calculation results is negligible and it only plays a role in numerical stabilization.

[0054] Specifically, the degree to which the background can explain anomalies is calculated for each pixel:

[0055] in, Represents the pixel in the weak light candidate region i The degree of explainable anomaly Represents the local background region of candidate region i in low light. The standard deviation of grayscale fluctuation, It represents the smallest positive number that is preset.

[0056] Represents pixels The degree of difference between the paint quality at the original location and the expected paint quality at the same location after reconstruction. Represents pixels The actual paint response at a certain point deviates from the expected paint response after local background reconstruction by a certain degree. , The larger the value, the stronger the independent residual anomaly of the candidate region's pixels relative to the local background. The smaller the value, the more the pixels in the candidate region conform to the natural continuation of the surrounding local reflection field.

[0057] The deviation of each candidate region is determined based on the interpretable anomaly level of each pixel, specifically including: The mean of the interpretable anomalies of all pixels in the low-light candidate region is used to determine the deviation of each candidate region.

[0058] Specifically, the deviation of a candidate region can be obtained by summing the interpretable anomalies of all pixels in the weak-light candidate region and then dividing by the number of pixels in that region. .

[0059] Step S004: Calculate the relative anomaly degree of each pixel based on the corresponding region of each candidate region in the stripe local image, and determine the homogeneity of each pixel in each candidate region based on the relative anomaly degree of each pixel.

[0060] It should be noted that candidate regions with significant deviations in low-light local images cannot be directly identified as actual defects. This is because the structural features of a component's surface, such as curved edges and sharp corners, can also appear as independent anomalies in low-light local images that cannot be naturally explained by the surrounding background, thus exhibiting greater [defective potential]. Values.

[0061] To distinguish between design structural anomalies and actual defects, stripe local images are introduced for structural verification. The regular light and dark stripes formed in the stripe local images can reflect the continuity of the local morphology of the component surface. For designed curved edges, the surface structure is continuous and smoothly varied, with small differences in stripe structural features between adjacent positions, and the highly consistent response is usually continuously distributed along the edge direction, exhibiting strong regularity and structure. However, for defects such as scratches, pits, and particles on actual paint surfaces, due to their sporadic and random formation, the stripe structural features within adjacent areas differ significantly, and the distribution of abnormal responses usually lacks continuity and regularity.

[0062] Based on the above analysis, the corresponding regions of the candidate regions in the stripe local image are further extracted for internal homogeneity features and continuous regularity features of high homogeneity responses to distinguish between pseudo-anomalies caused by continuous design structures and real anomalies caused by sporadic defects. Specifically, the stripe structure features of adjacent positions in the designed bent edges are relatively similar, the degree of stripe anomaly at adjacent internal points is similar, and the internal homogeneity of the region is good; while real defects are more varied and lack regularity and continuity.

[0063] The process of calculating the relative anomaly level of each pixel based on the corresponding region of each candidate region in the stripe local image further includes steps S0041-S0045: Step S0041: Take the corresponding region of each candidate region in the stripe local image as the stripe candidate region.

[0064] Step S0042: Use the dilation function to extract the surrounding normal stripe region outside the stripe candidate region.

[0065] It should be noted that when extracting the surrounding normal stripe region, the binary mask of the stripe candidate region is first dilated: using a preset width (e.g., 10 pixels) as the radius (or side length) of the structuring element, the mask is dilated to obtain the dilated region (including the original candidate region and its surrounding extension); then, the dilated region is subtracted from the original stripe candidate region (i.e., the dilated region minus the original region), and the resulting annular region is the surrounding normal stripe region of the preset width. This annular region is adjacent to the outer edge of the candidate region, and its internal pixels are considered as normal stripe background excluding the candidate region itself, used for subsequent analysis. The preset width is usually 5-15 pixels. Too small a width may lead to insufficient statistical samples, while too large a width may introduce other defects or structural edge interference. In actual engineering, it can be adjusted according to the image resolution and stripe period.

[0066] Step S0043: Determine the main direction of local stripes based on the stripe extension trend of the surrounding normal stripe region; construct a smooth extension model along the main direction of local stripes to generate a reference stripe response map of the stripe candidate region.

[0067] It should be noted that: First, using the previously extracted surrounding normal fringe regions, the direction of the internal fringes is analyzed. This can be done using the gradient structure tensor method or local Fourier transform: For each pixel within the surrounding normal fringe region, its gray-level gradient direction is calculated, and the gradient direction histogram of all pixels within the region is statistically analyzed. The direction with the highest frequency is determined as the local fringe principal direction (i.e., the tangent direction of the fringe). If the fringe direction within the candidate region changes slowly, the surrounding normal fringe region can be divided into multiple sub-blocks, and the principal direction of each sub-block can be calculated. Then, interpolation is used to obtain the point-by-point principal direction corresponding to each pixel within the candidate region.

[0068] After determining the principal direction, a smooth extrapolation model is constructed along that direction. The smooth extrapolation model is a calculation method that predicts the grayscale distribution of stripes in a defect-free state by smoothly extrapolating the grayscale waveform of the surrounding normal stripes into the candidate region along the principal direction.

[0069] The specific method is as follows: Within the surrounding normal fringe area, multiple scan lines are extracted along the main direction. Each scan line reflects the grayscale waveform (period and amplitude of peaks and troughs) of the fringe at that location. These scan lines are aligned and averaged to obtain an ideal normalized fringe waveform template. Then, for each pixel within the fringe candidate area, its projection position along the main direction is used as the independent variable, and the corresponding ideal grayscale value is retrieved from the waveform template. Simultaneously, considering that the fringe grayscale may exhibit slow modulation along the vertical direction (e.g., due to uneven illumination), the amplitude and offset of the template waveform can be locally linearly corrected by combining the grayscale distribution of the surrounding normal fringe area. Finally, the generated reference fringe response map maintains a natural continuity with the surrounding normal fringes in terms of direction, period, phase, and grayscale trend, accurately reflecting the ideal fringe morphology of the candidate area under defect-free conditions.

[0070] Step S0044: For each pixel in the stripe candidate region, subtract the gray value of the pixel in the reference stripe response map from the gray value of the pixel in the stripe candidate region to obtain the difference, and record the absolute value of the difference as the second absolute value.

[0071] Specifically, denoted as the second absolute value, where These are the pixels in the stripe candidate region. Represents pixels The grayscale value in the stripe candidate region w, Represents pixels Gray values ​​in the reference fringe response map v.

[0072] Step S0045: Using the sum of the grayscale fluctuation standard deviation of the surrounding normal stripe area and the preset minimum positive number as the denominator, and the second absolute value as the numerator, calculate the relative abnormality of each pixel.

[0073] It should be noted that the standard deviation of grayscale fluctuation in the surrounding normal stripe area refers to the statistical standard deviation of the grayscale values ​​of all pixels within the aforementioned extracted annular surrounding normal stripe area. The calculation process is as follows: first, calculate the mean grayscale value of all pixels within this area; then, for each pixel, square the difference between its grayscale value and the mean; finally, divide the sum of all squares by the total number of pixels and take the square root to obtain the standard deviation. This standard deviation quantitatively describes the severity of grayscale fluctuation within the normal stripe area itself, i.e., the strength of the stripe contrast or the roughness of the background texture.

[0074] The preset minimum positive number is a normal number that is much smaller than the range of image grayscale values ​​(e.g., or This value is used to avoid numerical calculation anomalies caused by a zero denominator. When calculating the relative anomaly level, the denominator includes the standard deviation of the grayscale fluctuation in the surrounding normal fringe region, which theoretically could be zero (e.g., the normal fringe region is completely flat and unchanged). Introducing this tiny positive number ensures that the denominator remains positive, guaranteeing that the relative anomaly level is defined and computationally stable. The actual impact of this value on the calculation results is negligible; it only serves to stabilize the numerical values.

[0075] Specifically, the relative degree of anomaly for each pixel is calculated:

[0076] in, Represents the number of pixels in the candidate region w of the stripes. The relative degree of abnormality indicates the degree of abnormality of the pixel relative to the normal stripe fluctuation level.

[0077] This represents the normal fringe region surrounding the candidate fringe region w. The standard deviation of grayscale fluctuation, It represents the smallest positive number that is preset.

[0078] The process of determining the homogeneity of pixels in each candidate region based on the relative anomaly level of each pixel further includes steps S041-S046: Step S041: For each pixel in the stripe candidate region, take the pixel as the center and select a preset number of adjacent pixels in front and behind along the main direction of the local stripe as the neighboring points of the pixel. The set of neighboring points is denoted as the linear oriented neighborhood of the pixel.

[0079] It should be noted that for each pixel in the stripe candidate region... Using this point as the center, select points before and after it along the principal direction of the local stripes (i.e., the tangent direction of the stripes at that point). The set of neighboring pixels is called the linear oriented neighborhood of that pixel. The preset quantity typically takes the value of [value]. or That is, selecting 1 or 2 pixels before and after, the total number of neighboring pixels is One (excluding the center point itself). When When, the neighborhood point contains the two immediately adjacent pixels along the main direction; when In this case, the neighborhood includes two points before and two points after the stripe, for a total of four neighboring points. Since the main direction of the stripe is usually not perfectly aligned with the pixel grid, the coordinates of the neighboring points may be sub-pixel positions. In this case, bilinear interpolation can be used to obtain the grayscale or anomaly degree value of the point from the surrounding integer pixels. The significance of linearly oriented neighborhood is that it examines the change in anomaly degree only along the stripe extension direction, avoiding interference from the periodic brightness changes of the stripes themselves in the vertical direction, thus accurately reflecting the degree of damage to the continuity of the stripes caused by the defect.

[0080] Step S042: Calculate the absolute value and sum of the differences in the relative anomaly degree between the pixel and each neighboring point in the linearly oriented neighborhood.

[0081] Specifically, Represents the pixels in the stripe candidate region The absolute value of the difference between the relative anomaly degree of a neighboring point q in the linear oriented neighborhood and the anomaly degree of a neighboring point q in the linear oriented neighborhood.

[0082] Represents the pixels in the stripe candidate region The sum of the relative anomalies of neighboring points q in the linearly oriented neighborhood.

[0083] Step S043: Using the sum of the sum and the preset minimum positive number as the denominator and the absolute value of the difference as the numerator, calculate the degree of difference between the pixel and each neighboring point.

[0084] Specifically, Pixels in the stripe candidate region The degree of difference between the neighboring point q in the linear oriented neighborhood and the neighboring point q. It represents the smallest positive number that is preset.

[0085] Step S044: Sum the differences between the pixel and all its neighboring points in the linearly oriented neighborhood to obtain the total neighborhood difference of the pixel.

[0086] Specifically, the total dissimilarity degree of a pixel's neighborhood is constructed:

[0087] in, Represents pixels The linear oriented neighborhood. Represents the number of pixels in the candidate region w of the stripes. The total dissimilarity score of the neighborhood. Represents pixels The relative degree of abnormality, Representing neighborhood points The relative degree of abnormality.

[0088] This describes whether there are any abrupt changes in the intensity of the fringe anomaly over a very short spatial distance.

[0089] The aim is to convert absolute differences into relative dissimilarity to eliminate the problem that neighborhood differences cannot be directly compared under different anomaly intensity levels. For neighboring points with large overall anomaly responses but close proximity, their relative differences should remain small to reflect the continuity within the region; while for neighboring points with significant jumps in anomaly responses over short distances, their relative differences will increase accordingly, thus highlighting local discontinuities.

[0090] The formula as a whole represents pixels. The sum of the relative differences between the pixel and all its neighboring points reflects the pixel on the paint surface. The overall inconsistency in the degree of anomaly among points in the surrounding neighborhood.

[0091] Step S045: The ratio of the total difference degree of the neighborhood of the pixel to the number of neighborhood points in the linear oriented neighborhood is denoted as the first ratio.

[0092] Specifically, This is denoted as the first ratio, where L represents the number of neighborhood points in the linearly oriented neighborhood.

[0093] Step S046: Subtract the first ratio from 1 to obtain the homogeneity of each pixel in each candidate region.

[0094] Specifically, the homogeneity of each pixel in each candidate region is calculated:

[0095] in, Represents the number of pixels in the candidate region w of the stripes. The homogeneity.

[0096] homogeneity Its value range is [0,1].

[0097] Represents pixels The average of the relative differences between the paint surface and all its neighboring points is used to measure the paint surface at each pixel. Is the anomalous change in the vicinity smooth and continuous or chaotic and abrupt? The larger this value, the more pronounced the change in the pixel. The greater the difference in the degree of anomaly between adjacent locations, the more likely it is to be a random defect such as paint buildup; the smaller the value, the more likely it is a pixel... The unusual changes in the surrounding area are more similar to normal paint surfaces or continuous structures such as designed curved edges. Overall, when pixels... When the degree of anomaly is very close to that of other points in the neighborhood, the average difference is small. Approaching 1; when the pixel When the differences from other points in the neighborhood are significant, the average degree of variability is large. Close to 0.

[0098] Step S005: Utilize the homogeneity of each pixel in each candidate region to obtain the continuous regularity of each candidate region.

[0099] It should be noted that, based on pixel-level local homogeneity, if the stripe anomaly in a candidate region originates from the bending edges, structural lines, or continuous turns of the part itself, then not only will the degree of anomaly between adjacent points in that region be similar, but this similarity will also be maintained along the structural direction, resulting in a continuous, banded, and extendable distribution of highly homogeneous points along a fixed direction. Conversely, if the stripe anomaly in the candidate region originates from real defects (such as scratches, dents, or particles), although locally similar responses may appear in individual small areas, due to the sporadic and irregular nature of defect formation, highly homogeneous points are usually difficult to continuously expand in a uniform direction, and their spatial distribution tends to be more discrete and fragmented, lacking a stable continuous structure.

[0100] Step S005 further includes steps S0051-S0057: Step S0051: Calculate the mean and standard deviation of the homogeneity of all pixels in the stripe candidate region, and use the sum of the mean and three times the standard deviation as the screening threshold.

[0101] Step S0052: Select pixels in the stripe candidate region whose homogeneity is greater than the screening threshold as high homogeneous points, and select the set of all high homogeneous points as the high homogeneous point set.

[0102] Step S0053: Perform connected component analysis on the set of highly homogeneous points and take the connected component with the largest area as the main highly homogeneous region.

[0103] Step S0054: Principal component analysis is used to analyze the spatial distribution direction of the main homogeneous region to obtain the first and second eigenvalues.

[0104] It should be noted that the spatial distribution direction of the principal homogeneous region is analyzed to quantify whether it possesses a stable principal direction. Specifically, the first eigenvalue can be obtained through principal component analysis (PCA). Second eigenvalue , Principal component analysis (PCA) is used to analyze the spatial coordinates of all pixels within the homogeneous region, calculate their covariance matrix, and obtain two eigenvalues. The larger eigenvalue is the first eigenvalue, and the smaller one is the second eigenvalue. The first eigenvalue reflects the dispersion of the point set along the main extension direction, and the second eigenvalue reflects the dispersion in the vertical direction. Both are used to quantify the directionality of the point set. Significantly greater than This indicates that the region is more likely to be a band-like structure extending continuously along a fixed direction; if both are similar, it indicates that the region is more likely to be a cluster or scattered distribution without a clear orientation. Based on this, directional tensile force can be constructed. A larger value indicates a stronger dominant directionality. However, this ratio has no upper bound and may yield high values ​​for elongated noise or linear real defects. To maintain its physical meaning while obtaining a bounded and stable metric, this ratio can be improved to... .

[0105] Step S0055: Use the sum of the first eigenvalue, the second eigenvalue, and the preset minimum positive number as the denominator, and the difference between the first eigenvalue and the second eigenvalue as the numerator to calculate the second ratio.

[0106] Specifically, This is denoted as the second ratio. It represents the smallest positive number that is preset.

[0107] Step S0056: Use the ratio obtained by dividing the number of high homogeneous points in the high homogeneous point set by the average homogeneity of the high homogeneous point set as the denominator, and the number of high homogeneous points contained in the main high homogeneous region as the numerator, to calculate the third ratio.

[0108] Specifically, It is denoted as the third ratio. This represents the number of highly homogeneous points in the set Q. This represents the average homogeneity of a set of highly homogeneous points, which is the average of the homogeneity of all pixels within the set of highly homogeneous points. This indicates the number of highly homogeneous points contained in the main highly homogeneous region.

[0109] Step S0057: The product of the second ratio and the third ratio is used to determine the continuous regularity of each candidate region.

[0110] Specifically, constructing continuous regularity characteristics of highly homogeneous regions:

[0111] in, This indicates the continuous regularity of the candidate region w of the stripes.

[0112] This represents the total number of effective highly homogeneous points after homogeneity correction. In paint surface inspection, this is used... After correction, it is possible to distinguish between a large number of high homogeneous points of average quality and a large number of high homogeneous points of very smooth and consistent overall: the former is more like paint build-up, spots or fragments caused by localized sporadic similarities, while the latter is more like real continuous structures such as the curved edges and transitions of the parts.

[0113] This represents the proportion of the largest primary connected region among all valid highly homogeneous points. The larger this ratio, the more concentrated the smooth and uniform parts in the candidate region are not only in quantity but also in quality, and closer to a structurally continuous region.

[0114] In paint surface inspection scenarios, Used to determine whether highly homogeneous points have been clustered into a main connected structure, Then, it is further determined whether the main structure extends continuously along a fixed direction, thereby distinguishing structural areas such as the curved edges of the shape from random clumps such as paint build-up and spots.

[0115] Based on the above analysis Used to indicate the degree of stretching of the main connected region along a single main direction.

[0116] Ultimately, the greater the continuity and regularity, the more likely highly homogeneous points are to form a structured distribution that unfolds continuously along a fixed direction; the smaller the continuity and regularity, the more likely highly homogeneous points are to form a discrete, clumped, or random distribution without a clear main direction.

[0117] Step S006: Calculate the defect confidence level of each candidate region based on the degree of deviation and the continuity of each candidate region.

[0118] It should be noted that: the degree of deviation of each candidate region is used to characterize the degree of independent anomaly of the candidate region relative to the local reflective background; the continuity regularity of each candidate region is used to characterize whether the highly homogeneous points continuously unfold along the fixed structural direction.

[0119] Step S006 further includes steps S0061-S0063: Step S0061: Add 1 to the deviation degree of each candidate region to obtain a sum value, and divide the deviation degree of each candidate region by the sum value to obtain the fourth ratio value.

[0120] Specifically, It is denoted as the fourth ratio.

[0121] Step S0062: Divide the number of high homogeneous points in the high homogeneous point set by the total number of pixels in the stripe candidate region to obtain the ratio, and use the product of this ratio and the continuous regularity of each candidate region as the first product.

[0122] Specifically, It is denoted as the first product. This represents the total number of pixels within the stripe candidate area.

[0123] Step S0063: Subtract the first product from 1 to obtain the difference, and multiply the difference by the fourth ratio to obtain the defect confidence of each candidate region.

[0124] Specifically, for candidate regions obtained through matching of two types of images, a defect confidence score is constructed:

[0125] in, This represents the defect confidence level for each candidate region.

[0126] The larger the value, the higher the probability that the corresponding candidate region is a real defect; The smaller the value, the more likely the area is to be a structural pseudo-anomaly caused by the edges, curvature changes, or sharp corners of the part. The value range is [0,1].

[0127] Part One This is the normalized anomaly intensity term. If a real defect exists, the actual response of the candidate region will deviate significantly from the background inference result. If the value is large, this item will have a larger value; if it is only a natural continuation of the background or a normal change in the local reflection field, The value is relatively small. This characterizes the degree of deviation of abnormal paint surfaces from normal paint surfaces. However, similar reflection anomalies can also occur at the edges and corners of part structures, thus requiring the introduction of a second term. .

[0128] In the second item, High homogeneous point coverage indicates whether locally smooth and uniform portions dominate in the stripe local image. This coverage is typically high for structural pseudo-anomalies and low for genuine defects. This characterizes the degree to which both high homogeneous coverage and continuous regularity are simultaneously achieved.

[0129] The overall approach employs a two-term multiplication method, forming a joint gated-suppression judgment relationship: only when a local paint surface exhibits characteristics of an independent defect but does not resemble a normal structure is it assigned a higher defect confidence level. If the value of either term decreases, it will have a suppressive effect, reducing the confidence level.

[0130] Step S007: Based on the comparison between the defect confidence level and the preset confidence threshold, determine each candidate region as a defect region, a region to be reviewed, or a pseudo-anomaly region.

[0131] Step S007 further includes steps S0071-S0073: Determine the confidence level of defects in the candidate regions: Step S0071: If the defect confidence of the candidate region is less than or equal to the first confidence threshold, then the candidate region is determined to be a pseudo-anomaly region.

[0132] It should be noted that the first confidence threshold is the smaller of two preset thresholds used for defect classification, usually denoted as: .

[0133] The value can be statistically calibrated based on actual production line samples, with a typical range of 0.3 to 0.5, designed to ensure the reliability of automatic judgment and avoid misidentifying obviously non-defective areas as defects. If the system is extremely sensitive to missed detections, the value can be appropriately reduced. This allows more areas to be included in the pending review process; if stricter requirements are imposed on false alarms, the review rate can be increased. In practice, It can be determined by performing ROC analysis on the confidence distribution of labeled samples.

[0134] Step S0072: If the defect confidence level of the candidate region is greater than the first confidence threshold and less than the second confidence threshold, then the candidate region is determined to be a region to be reviewed.

[0135] It should be noted that the second confidence threshold is the larger of the two preset thresholds used for defect classification, usually denoted as [threshold value]. .

[0136] The value is usually higher than The typical range is 0.7–0.9, designed to ensure high reliability of automatic alarms and automatic sorting for real defects and avoid frequent false alarms. If the system has low tolerance for missed detections and high tolerance for false alarms, the value can be appropriately reduced. Conversely, it increases. In actual engineering, The confidence distribution can be calculated by collecting a large number of labeled samples (including real defects, pseudo-anomalies, structural edges, etc.) and statistically calibrated by combining ROC curves or preset precision / recall requirements.

[0137] To ensure a high degree of reliability in detecting real defects during automatic alarms and automatic sorting, the settings are relatively high. This setting is used to remove areas that clearly lack evidence of defects, while retaining some weak or complex anomalies that are at the boundary of their defects and placing them in the review area. This configuration better meets the comprehensive requirements of alarm reliability, sorting stability, and manual review efficiency in actual engineering.

[0138] Step S0073: If the defect confidence of the candidate region is greater than or equal to the second confidence threshold, then the candidate region is determined to be a defect region.

[0139] Specifically, candidate regions obtained through matching two types of images are graded and visualized based on defect confidence levels: when When the area is determined to be the final defect area; when When the area is deemed to be pending review, it is considered a region to be reviewed. When this occurs, the region is determined to be a structural pseudo-anomaly or a weak anomaly region.

[0140] Furthermore, suspected areas are overlaid on the corresponding original image using a false-color method: areas with lower defect confidence are displayed in greener colors, and areas with higher confidence are displayed in redder colors, to visually represent the degree of change from a non-defect tendency to a true defect tendency. For targets determined to be final defect areas, the system outputs their position coordinates, contour range, defect confidence, and workpiece identification information in the original image, and sends the results to the display terminal, alarm module, sorting execution unit, or quality traceability system for online alarm, automatic sorting, manual review, and historical traceability. For areas awaiting review, their images and corresponding parameter information are retained and output to the review interface or storage module for subsequent manual confirmation.

[0141] In summary, in this embodiment of the invention, through controlled acquisition of dual images under the same working condition, interpretable anomaly features of the reflective background are extracted from the low-light local image, and stripe structure continuity and anomaly features are extracted from the stripe local image. Suspected regions in the two types of images are then matched, fused, and jointly judged, constructing a detection mechanism of "independent anomaly identification—structural continuity verification—defect confidence output." This mechanism can effectively distinguish between false defects caused by highlights, environmental reflections, and changes in surface normals, and real minor defects such as scratches, dents, and particles, significantly reducing the false detection rate.

[0142] This invention also proposes an image feature-based system for detecting paint defects on automotive parts. Please refer to [link / reference]. Figure 2 The diagram illustrates a block diagram of an image feature-based automotive parts paint defect detection system according to an embodiment of the present invention. The system includes: The acquisition module 100 is used to acquire low-light local images and stripe local images of the same part under test; The analysis module 200 is used to extract suspected regions from the low-light local image and the stripe local image respectively, and to perform position matching and filtering on the two sets of suspected regions to obtain one or more candidate regions. The interpretable anomaly level of each pixel is calculated based on the corresponding region of each candidate region in the low-light local image, and the deviation level of each candidate region is determined based on the interpretable anomaly level of each pixel. The relative anomaly level of each pixel is calculated based on the corresponding region of each candidate region in the stripe local image, and the homogeneity of each pixel in each candidate region is determined based on the relative anomaly level of each pixel. The continuous regularity of each candidate region is obtained by utilizing the homogeneity of each pixel in each candidate region. The defect confidence level of each candidate region is calculated based on the degree of deviation and the continuity of each candidate region. The judgment module 300 is used to determine each candidate region as a defect region, a region to be reviewed, or a pseudo-anomaly region based on the comparison result between the defect confidence level and the preset confidence threshold.

[0143] It should be noted that the system provided in the above embodiments is only an example of the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device can be divided into different functional modules to complete all or part of the functions described above. In addition, the image feature-based automotive parts paint surface defect detection system and the image feature-based automotive parts paint surface defect detection method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process is detailed in the method embodiments, which will not be repeated here.

[0144] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0145] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.

[0146] 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 within the protection scope of the present invention.

Claims

1. A method for detecting paint defects on automotive parts based on image features, characterized in that, The method includes the following steps: Acquire low-light local images and stripe local images of the same part under test; Suspected regions are extracted from low-light local images and stripe local images respectively, and the two sets of suspected regions are matched and filtered to obtain one or more candidate regions; The interpretable anomaly level of each pixel is calculated based on the corresponding region of each candidate region in the low-light local image, and the deviation level of each candidate region is determined based on the interpretable anomaly level of each pixel. The relative anomaly level of each pixel is calculated based on the corresponding region of each candidate region in the stripe local image, and the homogeneity of each pixel in each candidate region is determined based on the relative anomaly level of each pixel. The continuous regularity of each candidate region is obtained by utilizing the homogeneity of each pixel in each candidate region. The defect confidence level of each candidate region is calculated based on the degree of deviation and the continuity of each candidate region. Based on the comparison between the defect confidence level and the preset confidence threshold, each candidate region is determined to be a defect region, a region to be reviewed, or a pseudo-anomaly region.

2. The method for detecting paint defects on automotive parts based on image features according to claim 1, characterized in that, The specific steps involved in extracting suspected regions from low-light local images and stripe local images, and performing position matching and filtering on the two sets of suspected regions to obtain one or more candidate regions are as follows: Defects in low-light local images are extracted using the local background subtraction method, and adaptive threshold segmentation and connected component extraction are performed on the defects to obtain the first suspected region in the low-light local image. A local smoothing reference image is generated along the stripe extension direction using the local stripe continuity deviation method. The difference between the local smoothing reference image and the stripe local image is obtained. Adaptive threshold segmentation and connected component extraction are performed on the difference results to obtain the second suspected region in the stripe local image. The first suspected region and the second suspected region are matched in terms of location, and it is determined whether the overlapping area ratio of the matched first suspected region and the second suspected region reaches a preset ratio. If it does, the union of the two suspected regions is determined as the candidate region. For suspected regions that only appear in low-light local images or only in striped local images, determine whether the region meets the screening criteria. If it does, the suspected region is identified as a candidate region. The screening criteria include the area range, boundary concentration, and positional stability of the suspected region.

3. The method for detecting paint defects on automotive parts based on image features according to claim 2, characterized in that, The specific steps involved in calculating the interpretable anomaly level of each pixel based on the corresponding region of each candidate region in the low-light local image are as follows: The corresponding region of each candidate region in the low-light local image is taken as the low-light candidate region. A local background region of a preset width is extracted from the periphery of the weak light candidate region using a dilation function; Reconstruct the expected response map of the weak light candidate region under defect-free conditions based on the gray-level distribution of the local background region; For each pixel in the weak light candidate region, the difference is obtained by subtracting the gray value of the pixel in the expected response map from the gray value of the pixel in the weak light candidate region, and the absolute value of the difference is recorded as the first absolute value. The interpretable anomaly level of each pixel is calculated by using the sum of the standard deviation of grayscale fluctuation in the local background region and a preset minimum positive number as the denominator and the first absolute value as the numerator.

4. The method for detecting paint defects on automotive parts based on image features according to claim 3, characterized in that, The specific steps for determining the deviation of each candidate region based on the interpretable anomaly level of each pixel are as follows: The mean of the interpretable anomalies of all pixels in the low-light candidate region is used to determine the deviation of each candidate region.

5. The method for detecting paint defects on automotive parts based on image features according to claim 4, characterized in that, The specific steps for calculating the relative anomaly degree of each pixel based on the corresponding region of each candidate region in the striped local image are as follows: The corresponding region of each candidate region in the stripe local image is taken as the stripe candidate region; The dilation function is used to extract the surrounding normal stripe region outside the stripe candidate region; Based on the fringe extension trend of the surrounding normal fringe area, the main direction of the local fringe is determined; a smooth extension model is constructed along the main direction of the local fringe to generate a reference fringe response map of the fringe candidate area; For each pixel in the stripe candidate region, the difference is obtained by subtracting the gray value of the pixel in the reference stripe response map from the gray value of the pixel in the stripe candidate region, and the absolute value of the difference is recorded as the second absolute value. The relative degree of abnormality of each pixel is calculated by using the sum of the standard deviation of grayscale fluctuation in the surrounding normal stripe area and the preset minimum positive number as the denominator and the second absolute value as the numerator.

6. The method for detecting paint defects on automotive parts based on image features according to claim 5, characterized in that, The specific steps for determining the homogeneity of each pixel in each candidate region based on the relative anomaly degree of each pixel are as follows: For each pixel in the stripe candidate region, a preset number of adjacent pixels are selected along the main direction of the local stripe, centered on the pixel, as the neighborhood of the pixel. The set of neighborhood points is denoted as the linear oriented neighborhood of the pixel. Calculate the absolute value and sum of the differences in relative anomaly degree between the pixel and each neighboring pixel in the linearly oriented neighborhood; The sum of the sum and the preset minimum positive number are used as the denominator, and the absolute value of the difference is used as the numerator to calculate the degree of difference between the pixel and each neighboring pixel. The summation of the differences between the pixel and all its neighboring points in the linearly oriented neighborhood yields the total neighborhood difference score for that pixel. The ratio of the total difference degree of the neighborhood of the pixel to the number of neighboring points in the linearly oriented neighborhood is denoted as the first ratio. Subtracting the first ratio from 1 yields the homogeneity of each pixel in each candidate region.

7. The method for detecting paint defects on automotive parts based on image features according to claim 6, characterized in that, The specific steps for obtaining the continuous regularity of each candidate region by utilizing the homogeneity of each pixel in each candidate region are as follows: Calculate the mean and standard deviation of the homogeneity of all pixels in the stripe candidate region, and use the sum of the mean plus three times the standard deviation as the screening threshold. Pixels with homogeneity greater than the screening threshold in the stripe candidate region are considered high homogeneous points, and the set of all high homogeneous points is considered the high homogeneous point set. Perform connected component analysis on the set of highly homogeneous points, and take the connected component with the largest area as the main highly homogeneous region; Principal component analysis was used to analyze the spatial distribution direction of the main homogeneous region, and the first and second eigenvalues ​​were obtained. The second ratio is calculated by using the sum of the first eigenvalue, the second eigenvalue, and the preset minimum positive number as the denominator, and the difference between the first eigenvalue and the second eigenvalue as the numerator. The third ratio is calculated by dividing the number of highly homogeneous points in the set of highly homogeneous points by the average homogeneity of the set of highly homogeneous points, and using the number of highly homogeneous points contained in the main highly homogeneous region as the numerator. The product of the second ratio and the third ratio is used to determine the continuous regularity of each candidate region.

8. The method for detecting paint defects on automotive parts based on image features according to claim 7, characterized in that, The specific steps for calculating the defect confidence level of each candidate region based on the deviation degree and continuous regularity of each candidate region are as follows: Add 1 to the deviation of each candidate region to get the sum value, and divide the deviation of each candidate region by the sum value to get the fourth ratio value; The ratio is obtained by dividing the number of high homogeneous points in the high homogeneous point set by the total number of pixels in the stripe candidate region. The product of this ratio and the continuous regularity of each candidate region is taken as the first product. Subtract the first product from 1 to get the difference. Multiply the difference by the fourth ratio to get the defect confidence of each candidate region.

9. The method for detecting paint defects on automotive parts based on image features according to claim 8, characterized in that, The specific steps for determining whether each candidate region is a defect region, a region to be reviewed, or a pseudo-anomaly region based on the comparison result between the defect confidence level and the preset confidence threshold are as follows: Determine the confidence level of defects in the candidate regions: If the defect confidence level of a candidate region is less than or equal to the first confidence threshold, then the candidate region is determined to be a pseudo-anomaly region. If the confidence level of a candidate region's defect is greater than the first confidence threshold but less than the second confidence threshold, then the candidate region is determined to be a region to be reviewed. If the confidence level of a candidate region is greater than or equal to the second confidence threshold, then the candidate region is determined to be a defective region.

10. An image feature-based automotive parts paint defect detection system, 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 the processor, it implements the steps of the image feature-based method for detecting paint defects on automotive parts as described in any one of claims 1-9.