A method and system for detecting defects in automobile interior and exterior plastic parts

By pre-processing, edge extraction, distortion adjustment, discrete wavelet transformation and brightness correction of the images of plastic parts in and out of the car, the image quality problem is solved and the accuracy of defect detection is improved.

CN120047451BActive Publication Date: 2025-08-12NANCHANG HUAXIANG AUTOMOBILE INTERIOR & EXTERIOR PARTS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510534936.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2025-08-12
Estimated Expiration
2045-04-27

AI Technical Summary

Technical Problem

In the prior art, the images of plastic parts in the interior and exterior decoration of automobiles have reflection, low contrast, and uneven colors due to material and shooting environment factors, which affects the accuracy of defect detection.

Method used

By acquiring the target image for preprocessing, edge extraction and distortion adjustment, discrete wavelet transformation, threshold filtering and filtering processing, combined with brightness correction and detection model training, the image geometric correction accuracy and contrast are improved, and detailed information is retained.

Benefits of technology

Effectively reduce image geometric errors, eliminate reflections and artifacts, improve image contrast and detection accuracy, retain original color and edge features, and improve the accuracy of defect detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120047451B_ABST
    Figure CN120047451B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for detecting defects in automobile interior and exterior plastic parts. The method comprises preprocessing a target automobile interior and exterior plastic part image; performing edge extraction on the processed automobile interior and exterior plastic part image, and performing distortion adjustment on the processed automobile interior and exterior plastic part image; performing discrete wavelet transform on the adjusted automobile interior and exterior plastic part image, performing threshold screening on high-frequency image components, and filtering on low-frequency image components to determine an enhanced automobile interior and exterior plastic part image; performing a first brightness correction and a second brightness correction on the enhanced automobile interior and exterior plastic part image, respectively, and fusing the first corrected image with the second corrected image; and inputting the corrected automobile interior and exterior plastic part image into a trained preset detection model for detection to output a defect detection result. The present invention can improve the accuracy of defect detection of automobile interior and exterior plastic parts.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of plastic part defect detection, and in particular relates to a method and system for detecting defects in automobile interior and exterior plastic parts. Background Art

[0002] For the overall assembly of a car, after the power part, chassis assembly and the overall body frame are assembled, it is usually necessary to assemble the interior and exterior trim of the car, such as the instrument assembly, bumper shell, air intake grille, lampshade, seat part, etc., and the above parts are usually plastic parts.

[0003] Before assembling automotive interior and exterior plastic parts, it is usually necessary to ensure that there are no defects on the parts, such as scratches, surface damage, burns, abnormal depressions and protrusions, etc., in order to ensure the appearance of the vehicle and uniform stress distribution. Therefore, defect detection is required. Automotive interior and exterior plastic parts are usually inspected using machine vision. However, the images of automotive interior and exterior plastic parts captured by the camera often have problems such as reflection, low contrast, and uneven color due to factors such as their material, shooting, and environment, which in turn affects the accuracy of subsequent defect detection. Summary of the Invention

[0004] In order to solve the above technical problems, the present invention provides a method and system for detecting defects in automobile interior and exterior plastic parts, which are used to solve the technical problems in the prior art.

[0005] In one aspect, the present invention provides the following technical solution: a method for detecting defects in automobile interior and exterior plastic parts, comprising:

[0006] Acquire a target automobile interior and exterior plastic part image, and pre-process the target automobile interior and exterior plastic part image to obtain a processed automobile interior and exterior plastic part image;

[0007] performing edge extraction on the processed image of the automobile interior and exterior plastic part to obtain an edge image, and performing distortion adjustment on the processed image of the automobile interior and exterior plastic part based on pixels in the edge image to obtain an adjusted image of the automobile interior and exterior plastic part;

[0008] performing a discrete wavelet transform on the adjusted image of the automobile interior and exterior plastic part to obtain a high-frequency image component and a low-frequency image component, performing threshold screening on the high-frequency image component and filtering on the low-frequency image component to obtain a screened image component and a filtered image component, respectively, and determining an enhanced image of the automobile interior and exterior plastic part based on the screened image component and the filtered image component;

[0009] performing a first brightness correction and a second brightness correction on the enhanced image of the automobile interior and exterior plastic part to obtain a first corrected image and a second corrected image, respectively, and fusing the first corrected image with the second corrected image to obtain a corrected image of the automobile interior and exterior plastic part;

[0010] Acquire training images of automobile interior and exterior plastic parts, input the training images of automobile interior and exterior plastic parts into a preset detection model for training, and input the corrected images of automobile interior and exterior plastic parts into the trained preset detection model for detection to output defect detection results.

[0011] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention first acquires a target automobile interior and exterior plastic parts image, pre-processes the target automobile interior and exterior plastic parts image to obtain a processed automobile interior and exterior plastic parts image; then performs edge extraction on the processed automobile interior and exterior plastic parts image to obtain an edge image, and performs distortion adjustment on the processed automobile interior and exterior plastic parts image based on the pixels in the edge image to obtain an adjusted automobile interior and exterior plastic parts image; then performs discrete wavelet transform on the adjusted automobile interior and exterior plastic parts image to obtain a high-frequency image component and a low-frequency image component, performs threshold screening on the high-frequency image component and performs filtering on the low-frequency image component to obtain a screened image component and a filtered image component respectively, and determines an enhanced automobile interior and exterior plastic parts image based on the screened image component and the filtered image component; then performs a first brightness correction and a second brightness correction on the enhanced automobile interior and exterior plastic parts image respectively. Degree correction is performed to obtain a first corrected image and a second corrected image respectively, and the first corrected image and the second corrected image are fused to obtain a corrected image of an automobile interior and exterior plastic part; then a training image of an automobile interior and exterior plastic part is obtained, and the training image of an automobile interior and exterior plastic part is input into a preset detection model for training, and the corrected image of an automobile interior and exterior plastic part is input into the trained preset detection model for detection to output a defect detection result. The present invention adjusts the image, which can effectively improve the geometric correction accuracy of the image and reduce the geometric error of the image. After that, the image is enhanced, which can effectively retain the detail information in the image, eliminate the reflection, artifact, halo, etc. in the image, and at the same time improve the contrast of the image. After that, the image is brightness corrected, which can fully retain the color features and edge features of the original image while avoiding distortion, thereby improving the precision and accuracy of subsequent model defect detection.

[0012] Preferably, the step of performing distortion adjustment on the processed image of the automobile interior and exterior plastic part based on the pixel points in the edge image to obtain the adjusted image of the automobile interior and exterior plastic part comprises:

[0013] Traversing pixel points in the edge image to obtain an edge pixel point set, and determining an adjusted contour line set based on the edge pixel point set;

[0014] Calculating the intersection of two adjacent target contour lines in the adjusted contour line set to obtain target vertex coordinates, segmenting the processed automobile interior and exterior plastic part image into a plurality of pixel planes based on the target vertex coordinates and the corresponding target contour lines, establishing a spatial coordinate system with one of the target vertex coordinates as an origin, and mapping the plurality of pixel planes into the spatial coordinate system to obtain a mapped automobile interior and exterior plastic part image;

[0015] Extracting all pixel points of the mapped image of the automobile interior and exterior plastic parts in the XZ plane to obtain a mapped pixel point set, and determining the coordinate values of the pixel points in the mapped pixel point set on the X axis and the Z axis respectively to obtain an X coordinate set and a Z coordinate set;

[0016] Extract the pixel point corresponding to the minimum value of the Z coordinate set as the distortion reference point, and calculate the distance between the pixel point in the mapping pixel point set and the distortion reference point , based on the distance Calculate the X-direction offset :

[0017] ;

[0018] Where, Indicates the distance from the plane passing through the distortion reference point and parallel to the camera plane to the camera plane, is the camera focal length, is the angle between the camera plane and the XZ plane;

[0019] Extract the pixel point corresponding to the minimum value of the X coordinate set and repeat the Z direction offset Calculation, based on X-direction offset Offset in the Z direction The mapping pixel point set is distorted and the distortion adjustment process is repeated on the remaining planes to obtain an adjusted image of the automobile interior and exterior plastic parts.

[0020] Preferably, the step of traversing the pixel points in the edge image to obtain an edge pixel point set and determining the adjusted contour line set based on the edge pixel point set includes:

[0021] Traversing the pixel points in the edge image to obtain an edge pixel point set, selecting any pixel coordinate direction as a reference direction, calculating the distance between the pixel point in the reference direction and the pixel point with the largest ordinate in the edge pixel point set, and storing the pixel points with a distance less than a first distance threshold in a first undetermined pixel point set;

[0022] Arrange the pixels in the first undetermined pixel point set in ascending order according to their abscissas, select three reference pixels from the sorted first undetermined pixel point set, and perform function fitting to obtain a first reference line; calculate the distances from the pixels in the first undetermined pixel point set to the first reference line, and store the pixels whose distances are less than a second distance threshold into a second undetermined pixel point set;

[0023] Performing function fitting on the pixels in the second undetermined pixel point set to obtain a second reference line, calculating the distance between the pixels in the second undetermined pixel point set and the second reference line and storing the pixels whose distance is less than a third distance threshold into a third undetermined pixel point set, and performing function fitting on the pixels in the third undetermined pixel point set to obtain a target contour line;

[0024] Performing the process of determining the undetermined pixel point set and function fitting on the pixel points in the remaining pixel coordinate directions to obtain a contour line set, determining the slope and intercept of each target contour line in the contour line set, and arranging the contour line set in ascending order according to the slope of each target contour line to obtain an arranged contour line set;

[0025] If the absolute value of the difference between the slope of the Ath target contour line and the slope of the A+1th target contour line in the arranged contour line set is not greater than the slope threshold, then the size between the intercept of the Ath target contour line and the intercept of the A+1th target contour line in the arranged contour line set is determined; if the intercept of the Ath target contour line is greater than the intercept of the A+1th target contour line, then the position of the Ath target contour line and the A+1th target contour line are swapped to obtain an adjusted contour line set.

[0026] Preferably, the steps of performing threshold screening on the high-frequency image component and filtering on the low-frequency image component to obtain a screened image component and a filtered image component respectively include:

[0027] Determine the storage method of the wavelet coefficients after the discrete wavelet transform of the image of the automobile interior and exterior plastic parts is , determine the fixed threshold based on the storage method :

[0028] ;

[0029] Where, Indicates the median value, represents the coefficient space set, is the coefficient length, Indicates adjusting the size of the image of the interior and exterior plastic parts of the car;

[0030] Based on the fixed threshold Determine the first wavelet adjustment threshold :

[0031] ;

[0032] Where, is the wavelet coefficient after the first decomposition, denote the first and second adjustment factors respectively;

[0033] Adjust the threshold based on the first wavelet Determine the second wavelet adjustment threshold :

[0034] ;

[0035] will be less than the second wavelet adjustment threshold The wavelet coefficients corresponding to the high-frequency image components are eliminated to obtain the filtered image components;

[0036] In the low-frequency image component A filtering window is determined for the radius, and filtering is performed on the low-frequency image component based on the filtering window to obtain a filtered image component:

[0037] ;

[0038] Where, Represents the filtered image component The gray value at Represent the low-frequency image components Gray value at the center of the filter window The gray value at Indicates the standard deviation of grayscale similarity.

[0039] Preferably, the step of determining an enhanced image of an automobile interior and exterior plastic part based on the screened image component and the filtered image component comprises:

[0040] Perform inverse discrete wavelet transform on the screened image component and the filtered image component to obtain the to-be-determined enhanced image. ;

[0041] Determine the R channel enhanced image based on the to-be-determined enhanced image , G channel enhanced image , B channel enhanced image :

[0042] ; ;

[0043] ;

[0044] Where, 、 Respectively represent the adjustment of the image of the interior and exterior plastic parts of the car Images in R, G, and B channels;

[0045] Enhance the R channel image , G channel enhanced image , B channel enhanced image Combined to obtain enhanced images of automotive interior and exterior plastic parts.

[0046] Preferably, the step of performing a first brightness correction and a second brightness correction on the enhanced image of the automobile interior and exterior plastic part to obtain a first corrected image and a second corrected image respectively includes:

[0047] Decompose the enhanced automobile interior and exterior plastic parts image into several image sub-blocks, and determine the minimum filtered image based on the image sub-blocks:

[0048] ;

[0049] Where, Indicated by pixels The image sub-block centered on Represents an image that enhances the R, G, and B channels of an image of an interior and exterior plastic part of a car;

[0050] Identify the brightness of the pixels of the minimum filtered image, and arrange the pixels of the minimum filtered image in descending order according to the brightness to obtain a brightness pixel set, select the first several pixels in the brightness pixel set as the undetermined brightness pixel points, determine the pixels corresponding to the undetermined brightness pixel points in the enhanced image of the automobile interior and exterior plastic parts as the basic pixel points, and use the maximum pixel value among the basic pixel points as the environmental reference value ;

[0051] Based on the environmental reference values Determine the first transmittance :

[0052]

[0053] Where, represents the brightness parameter, Indicates the environmental reference values corresponding to the R, G, and B channels;

[0054] Calculate the second transmittance :

[0055] ;

[0056] Where, represents the atmospheric dissipation coefficient, represents the correction factor, Respectively represent the brightness and maximum brightness of the image of the interior and exterior plastic parts of the car;

[0057] Based on the first transmittance With the second transmittance Calculate the third transmittance :

[0058] ;

[0059] ; ;

[0060] Where, represent the first adjustment parameter and the second adjustment parameter respectively;

[0061] Based on the third transmittance Determine the first correction image :

[0062] ;

[0063] Where, is the calibration constant, It indicates the enhancement of images of automobile interior and exterior plastic parts;

[0064] The enhanced automobile interior and exterior plastic parts image is converted into Lab space and the L component image is extracted. The L component image is histogram equalized to obtain a balanced image. The balanced image is converted into RGB space and combined with the remaining component images in Lab space to obtain a second corrected image.

[0065] Preferably, the step of fusing the first corrected image with the second corrected image to obtain a corrected image of an automobile interior and exterior plastic part includes:

[0066] performing a wavelet transform on the first corrected image to obtain a first low-frequency sub-image and a first high-frequency sub-image, performing a wavelet transform on the second corrected image to obtain a second low-frequency sub-image and a second high-frequency sub-image, and performing weighted fusion on the first low-frequency sub-image and the second low-frequency sub-image to obtain a first fused image;

[0067] Calculate the first fusion value of the first high-frequency sub-image The second fusion value with the second high frequency sub-image :

[0068] ;

[0069] ;

[0070] Where, Indicates the size of the local area, represents the cost weight, express The first high-frequency sub-image and the second high-frequency sub-image in the direction The intensity value at Indicates one of the three directions: horizontal, vertical, and diagonal;

[0071] Based on the first fusion value With the second fusion value Calculate fusion trust :

[0072] ;

[0073] Based on the fusion trust Calculate fusion weights :

[0074] ;

[0075] Where, represents the fusion threshold;

[0076] Determine the fusion trust Is it less than the fusion threshold? , if the trust Less than the fusion threshold , then the second fused image for:

[0077] ;

[0078] If the trust Not less than the fusion threshold , then the second fused image for:

[0079] ;

[0080] The first fused image and the second fused image in each direction Perform inverse wavelet transform to obtain the corrected image of automobile interior and exterior plastic parts.

[0081] In a second aspect, the present invention provides the following technical solution: a defect detection system for automobile interior and exterior plastic parts, the system comprising:

[0082] a processing module, configured to obtain a target automobile interior and exterior plastic part image, and pre-process the target automobile interior and exterior plastic part image to obtain a processed automobile interior and exterior plastic part image;

[0083] an adjustment module, configured to extract edges of the processed image of the automobile interior and exterior plastic parts to obtain an edge image, and perform distortion adjustment on the processed image of the automobile interior and exterior plastic parts based on pixels in the edge image to obtain an adjusted image of the automobile interior and exterior plastic parts;

[0084] an enhancement module, configured to perform a discrete wavelet transform on the adjusted image of the automobile interior and exterior plastic part to obtain a high-frequency image component and a low-frequency image component, perform threshold screening on the high-frequency image component and perform filtering on the low-frequency image component to obtain a screened image component and a filtered image component, respectively, and determine an enhanced image of the automobile interior and exterior plastic part based on the screened image component and the filtered image component;

[0085] a correction module, configured to perform a first brightness correction and a second brightness correction on the enhanced image of the automobile interior and exterior plastic part, respectively, to obtain a first corrected image and a second corrected image, respectively, and fuse the first corrected image with the second corrected image to obtain a corrected image of the automobile interior and exterior plastic part;

[0086] The detection module is used to obtain training images of automobile interior and exterior plastic parts, input the training images of automobile interior and exterior plastic parts into a preset detection model for training, and input the corrected images of automobile interior and exterior plastic parts into the trained preset detection model for detection to output defect detection results.

[0087] In a third aspect, the present invention provides the following technical solution: a computer comprising a memory, a processor, and a computer program stored in the memory and executable on the processor; when the processor executes the computer program, the method for detecting defects in automobile interior and exterior plastic parts as described above is implemented.

[0088] In a fourth aspect, the present invention provides the following technical solution: a storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the above-mentioned method for detecting defects in automobile interior and exterior plastic parts. BRIEF DESCRIPTION OF THE DRAWINGS

[0089] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0090] Figure 1 This is a flow chart of a method for detecting defects in automobile interior and exterior plastic parts provided in Example 1 of the present invention;

[0091] Figure 2 This is a structural block diagram of a defect detection system for automobile interior and exterior plastic parts provided by the second embodiment of the present invention;

[0092] Figure 3 A schematic diagram of the hardware structure of a computer provided in another embodiment of the present invention.

[0093] The embodiments of the present invention will be further described below with reference to the accompanying drawings. DETAILED DESCRIPTION

[0094] The following describes embodiments of the present invention in detail, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the embodiments of the present invention, and should not be construed as limiting the present invention.

[0095] Example 1

[0096] In the first embodiment of the present invention, Figure 1 As shown, a method for detecting defects in automobile interior and exterior plastic parts includes:

[0097] S1. Acquire a target automobile interior and exterior plastic part image, and pre-process the target automobile interior and exterior plastic part image to obtain a processed automobile interior and exterior plastic part image;

[0098] Specifically, the target automobile interior and exterior plastic parts images here are images containing the target automobile interior and exterior plastic parts taken from different angles. The preprocessing process here specifically includes image cropping, geometric transformation, and smoothing. The above preprocessing process is a commonly used image processing method in the prior art, so it will not be repeated here.

[0099] S2. performing edge extraction on the processed image of the automobile interior and exterior plastic part to obtain an edge image, and performing distortion adjustment on the processed image of the automobile interior and exterior plastic part based on pixels in the edge image to obtain an adjusted image of the automobile interior and exterior plastic part;

[0100] Wherein, the step S2 includes:

[0101] S21, traversing the pixel points in the edge image to obtain an edge pixel point set, and determining an adjusted contour line set based on the edge pixel point set;

[0102] Wherein, the step S21 includes:

[0103] S211, traversing the pixels in the edge image to obtain an edge pixel point set, selecting any pixel coordinate direction as a reference direction, calculating the distance between the pixel point in the reference direction and the pixel point with the largest ordinate in the edge pixel point set, and storing the pixel points with a distance less than a first distance threshold in a first undetermined pixel point set;

[0104] Specifically, the edge image here can be obtained by using a canny operator, and the pixel coordinate directions here are specifically ±u and ±v directions.

[0105] S212: Arrange the pixels in the first undetermined pixel set in ascending order according to their abscissas, select three reference pixels from the sorted first undetermined pixel set, and perform function fitting to obtain a first reference line. Calculate the distances between the pixels in the first undetermined pixel set and the first reference line, and store the pixels whose distances are less than a second distance threshold into the second undetermined pixel set.

[0106] Specifically, the three reference pixel points selected here can be selected at 1 / 4, 1 / 2, and 3 / 4 of the first undetermined pixel point set, respectively. The purpose of function fitting is to fit the three points into continuous and smooth lines.

[0107] S213, performing function fitting on the pixels in the second undetermined pixel set to obtain a second baseline, calculating the distance between the pixels in the second undetermined pixel set and the second baseline, storing the pixels whose distance is less than a third distance threshold into a third undetermined pixel set, and performing function fitting on the pixels in the third undetermined pixel set to obtain a target contour line;

[0108] Specifically, the first to third distance thresholds may be determined according to the size of the target automobile interior / exterior plastic part image and the size of the target automobile interior / exterior plastic part in the target automobile interior / exterior plastic part image.

[0109] S214, performing the process of determining the undetermined pixel point set and function fitting on the pixel points in the remaining pixel coordinate directions to obtain a contour line set, determining the slope and intercept of each target contour line in the contour line set, and arranging the contour line set in ascending order according to the slope of each target contour line to obtain an arranged contour line set;

[0110] Specifically, in the above steps S211 to S213, the target contour line in a single pixel coordinate direction is specifically determined. The target contour lines in other directions can be determined by the same method to obtain a contour line set.

[0111] S211. If the absolute value of the difference between the slope of the Ath target contour line and the slope of the A+1th target contour line in the arranged contour line set is not greater than the slope threshold, then determine the size between the intercept of the Ath target contour line and the intercept of the A+1th target contour line in the arranged contour line set; if the intercept of the Ath target contour line is greater than the intercept of the A+1th target contour line, then swap the positions of the Ath target contour line and the A+1th target contour line to obtain an adjusted contour line set.

[0112] S22, calculating the intersection of two adjacent target contour lines in the adjusted contour line set to obtain target vertex coordinates, segmenting the processed automotive interior and exterior plastic part image into a plurality of pixel planes based on the target vertex coordinates and the corresponding target contour lines, establishing a spatial coordinate system with one of the target vertex coordinates as the origin, and mapping the plurality of pixel planes into the spatial coordinate system to obtain a mapped automotive interior and exterior plastic part image;

[0113] S23, extracting all pixel points of the mapped image of the automobile interior and exterior plastic part in the XZ plane to obtain a mapped pixel point set, and determining the coordinate values of the pixel points in the mapped pixel point set on the X axis and the Z axis respectively to obtain an X coordinate set and a Z coordinate set;

[0114] S24: Extract the pixel point corresponding to the minimum value of the Z coordinate set as the distortion reference point, and calculate the distance between the pixel point in the mapping pixel point set and the distortion reference point. , based on the distance Calculate the X-direction offset :

[0115] ;

[0116] Where, Indicates the distance from the plane passing through the distortion reference point and parallel to the camera plane to the camera plane, is the camera focal length, is the angle between the camera plane and the XZ plane;

[0117] S25, extract the pixel point corresponding to the minimum value of the X coordinate set and repeat the Z direction offset Calculation, based on X-direction offset Offset in the Z direction Performing distortion adjustment on the mapped pixel point set and repeating the distortion adjustment process on the remaining planes to obtain an adjusted image of the automobile interior and exterior plastic parts;

[0118] Specifically, after extracting the pixel point corresponding to the minimum value of the X coordinate set, use it as a new distortion reference point and repeat the above steps to obtain the Z direction offset Similarly, the same method can be used to determine the offset on the YZ plane, and then determine the offset in the Y direction.

[0119] S3. Performing a discrete wavelet transform on the adjusted image of the automobile interior and exterior plastic part to obtain a high-frequency image component and a low-frequency image component, performing threshold screening on the high-frequency image component and filtering on the low-frequency image component to respectively obtain a screened image component and a filtered image component, and determining an enhanced image of the automobile interior and exterior plastic part based on the screened image component and the filtered image component;

[0120] The steps of performing threshold screening on the high-frequency image component and filtering on the low-frequency image component to obtain a screened image component and a filtered image component respectively include:

[0121] S311, determining the storage method of the wavelet coefficients after the discrete wavelet transform of the image of the automobile interior and exterior plastic parts is performed. , determine the fixed threshold based on the storage method :

[0122] ;

[0123] Where, Indicates the median value, represents the coefficient space set, is the coefficient length, Indicates adjusting the size of the image of the interior and exterior plastic parts of the car;

[0124] Specifically, the coefficient length here is specifically 1.

[0125] S312: Based on the fixed threshold Determine the first wavelet adjustment threshold :

[0126] ;

[0127] Where, is the wavelet coefficient after the first decomposition, denote the first and second adjustment factors respectively;

[0128] Specifically, the first and second adjustment factors can compensate for the image and retain more image detail features. When the second adjustment factor is 0, as the first adjustment factor increases, the image contour information or edge lines can be effectively retained to avoid information loss after enhancement; when the first and second adjustment factors are both 1, the noise suppression signal oscillation phenomenon can be avoided, and it will be presented in the form of a soft threshold function to effectively reduce the high-frequency noise of the image and retain more detail features in the image. Therefore, in this application, the first and second adjustment factors are both 1.

[0129] S313: Adjust the threshold based on the first wavelet. Determine the second wavelet adjustment threshold :

[0130] ;

[0131] S314, will be less than the second wavelet adjustment threshold The wavelet coefficients corresponding to the high-frequency image components are eliminated to obtain the filtered image components;

[0132] Specifically, by adjusting the threshold value to be less than the second wavelet Eliminating the wavelet coefficients corresponding to the high-frequency image components can prevent the high-frequency components from being misjudged as noise, resulting in the pseudo-Gibbs phenomenon after denoising.

[0133] S315, in the low-frequency image component A filtering window is determined for the radius, and filtering is performed on the low-frequency image component based on the filtering window to obtain a filtered image component:

[0134] ;

[0135] Where, Represents the filtered image component The gray value at Represent the low-frequency image components Gray value at the center of the filter window The gray value at Indicates the standard deviation of grayscale similarity;

[0136] Specifically, through the above formula, the spatial range can be adjusted, and the pixels closer to the center point have greater weights. At the same time, the grayscale range can also be adjusted, and pixels with similar grayscales have greater weights, and pixels with larger grayscale differences have smaller weights. , if the distance between the pixel point in the filter window and the center point of the filter window is not greater than , then the spatial domain and pixel value domain are considered simultaneously in the filtering process, which can retain the image details and avoid the halo phenomenon. , then the pixel is considered to be far away from the center pixel and the processing of the pixel is ignored to avoid affecting the edge of the image.

[0137] The step of determining and enhancing the image of the automobile interior and exterior plastic parts based on the screened image component and the filtered image component includes:

[0138] S321, performing inverse discrete wavelet transform on the screened image component and the filtered image component to obtain a to-be-determined enhanced image .

[0139] S322: Determine an R channel enhanced image based on the to-be-determined enhanced image. , G channel enhanced image , B channel enhanced image :

[0140] ; ;

[0141] ;

[0142] Where, 、 Respectively represent the adjustment of the image of the interior and exterior plastic parts of the car The image in R, G, B channels.

[0143] S323, enhance the R channel image , G channel enhanced image , B channel enhanced image Combined to obtain enhanced images of automotive interior and exterior plastic parts.

[0144] S4. performing a first brightness correction and a second brightness correction on the enhanced image of the automobile interior and exterior plastic part to obtain a first corrected image and a second corrected image, respectively, and fusing the first corrected image with the second corrected image to obtain a corrected image of the automobile interior and exterior plastic part;

[0145] The step of performing a first brightness correction and a second brightness correction on the enhanced image of the automobile interior and exterior plastic part to obtain a first corrected image and a second corrected image respectively includes:

[0146] S411: Decompose the enhanced automobile interior and exterior plastic parts image into a plurality of image sub-blocks, and determine a minimum filtered image based on the image sub-blocks:

[0147] ;

[0148] Where, Indicated by pixels The image sub-block centered on An image representing enhanced images of automobile interior and exterior plastic parts in the R, G, and B channels.

[0149] S412: Identify the brightness of the pixels of the minimum filtered image, and arrange the pixels of the minimum filtered image in descending order according to the brightness to obtain a brightness pixel set, select the first several pixels in the brightness pixel set as undetermined brightness pixel points, determine the pixels corresponding to the undetermined brightness pixel points in the enhanced image of the automobile interior and exterior plastic parts as basic pixel points, and use the maximum pixel value among the basic pixel points as the environmental reference value ;

[0150] Specifically, the environmental reference value is determined in step S412 , which can avoid judging obvious light sources and white objects as atmospheric light.

[0151] S413, based on the environmental reference value Determine the first transmittance :

[0152]

[0153] Where, represents the brightness parameter, Indicates the environmental reference values corresponding to the R, G, and B channels;

[0154] Specifically, the brightness parameter here can ensure that the image is more natural and in line with the natural sense of the human eye, and the brightness parameter here is 0.95.

[0155] S414, calculating the second transmittance :

[0156] ;

[0157] Where, represents the atmospheric dissipation coefficient, represents the correction factor, Respectively represent the brightness and maximum brightness of the image of the interior and exterior plastic parts of the car;

[0158] The atmospheric dissipation coefficient is specifically the dissipation coefficient of the transmission medium in the atmosphere, and the correction coefficient is used to correct the influence of brightness on the second transmittance. The correction coefficient is specifically 3.5.

[0159] S415, based on the first transmittance With the second transmittance Calculate the third transmittance :

[0160] ;

[0161] ; ;

[0162] Where, represent the first adjustment parameter and the second adjustment parameter respectively;

[0163] The first adjustment parameter is a parameter used to adjust the slope of the sigmoid function, and the second adjustment parameter is the center of the horizontal coordinate set determined according to the range of the first transmittance.

[0164] S416, based on the third transmittance Determine the first correction image :

[0165] ;

[0166] Where, is the calibration constant, It indicates the enhancement of images of automobile interior and exterior plastic parts;

[0167] S417, converting the enhanced automobile interior and exterior plastic part image into Lab space and extracting an L component image, performing histogram equalization on the L component image to obtain a balanced image, converting the balanced image into RGB space and combining it with the remaining component images in the Lab space to obtain a second corrected image;

[0168] Specifically, the histogram equalization here is a commonly used equalization algorithm in the prior art, and thus will not be described in detail.

[0169] The step of fusing the first corrected image with the second corrected image to obtain a corrected image of an automobile interior and exterior plastic part includes:

[0170] S421. Perform a wavelet transform on the first corrected image to obtain a first low-frequency sub-image and a first high-frequency sub-image, perform a wavelet transform on the second corrected image to obtain a second low-frequency sub-image and a second high-frequency sub-image, and perform weighted fusion on the first low-frequency sub-image and the second low-frequency sub-image to obtain a first fused image.

[0171] S422: Calculate a first fusion value of the first high-frequency sub-image The second fusion value with the second high frequency sub-image :

[0172] ;

[0173] ;

[0174] Where, Indicates the size of the local area, represents the cost weight, express The first high-frequency sub-image and the second high-frequency sub-image in the direction The intensity value at Indicates one of the three directions: horizontal, vertical, and diagonal.

[0175] S423, based on the first fusion value With the second fusion value Calculate fusion trust :

[0176] .

[0177] S424: Based on the fusion trust Calculate fusion weights :

[0178] ;

[0179] Where, represents the fusion threshold.

[0180] S425: Determine the fusion trust Is it less than the fusion threshold? , if the trust Less than the fusion threshold , then the second fused image for:

[0181] ;

[0182] S426, if the trust is integrated Not less than the fusion threshold , then the second fused image for:

[0183] ;

[0184] Specifically, when the fusion trust between the first high-frequency sub-image and the second high-frequency sub-image in the same direction is small, it is only necessary to select one of the images with higher fusion value as the second fusion image. If the fusion trust is large, the weighted average method is used for fusion, and a greater weight is given to the image with higher fusion value.

[0185] S427: Combine the first fused image and the second fused image in each direction Perform inverse wavelet transform to obtain the corrected image of automobile interior and exterior plastic parts.

[0186] S5. Obtain training images of automobile interior and exterior plastic parts, input the training images of automobile interior and exterior plastic parts into a preset detection model for training, input the corrected images of automobile interior and exterior plastic parts into the trained preset detection model for detection, and output defect detection results.

[0187] Specifically, it should be noted that after correcting the images of automobile interior and exterior plastic parts, it is necessary to use the Otsu method to segment the foreground image, and then input the foreground image into the trained preset detection model for defect detection, and output the corresponding defect detection results. The preset detection model here is the convolutional neural network CNN model.

[0188] The first embodiment of the present invention provides a method for detecting defects in automobile interior and exterior plastic parts. The method first acquires a target automobile interior and exterior plastic part image, pre-processes the target automobile interior and exterior plastic part image to obtain a processed automobile interior and exterior plastic part image; then performs edge extraction on the processed automobile interior and exterior plastic part image to obtain an edge image, and performs distortion adjustment on the processed automobile interior and exterior plastic part image based on the pixels in the edge image to obtain an adjusted automobile interior and exterior plastic part image; then performs discrete wavelet transform on the adjusted automobile interior and exterior plastic part image to obtain a high-frequency image component and a low-frequency image component, performs threshold screening on the high-frequency image component and filters the low-frequency image component to obtain a screened image component and a filtered image component, respectively, and determines an enhanced automobile interior and exterior plastic part image based on the screened image component and the filtered image component; then performs a first brightness correction and a second brightness correction on the enhanced automobile interior and exterior plastic part image. Two brightness corrections are performed to obtain a first corrected image and a second corrected image respectively, and the first corrected image and the second corrected image are fused to obtain a corrected image of automobile interior and exterior plastic parts; then a training image of automobile interior and exterior plastic parts is obtained, and the training image of automobile interior and exterior plastic parts is input into a preset detection model for training, and the corrected image of automobile interior and exterior plastic parts is input into the trained preset detection model for detection to output a defect detection result. The present invention adjusts the image, which can effectively improve the geometric correction accuracy of the image and reduce the geometric error of the image. After that, the image is enhanced, which can effectively retain the detail information in the image, eliminate reflections, artifacts, halos, etc. in the image, and improve the contrast of the image. After that, the image is brightness corrected, which can fully retain the color features and edge features of the original image while avoiding distortion, thereby improving the precision and accuracy of subsequent model defect detection.

[0189] Example 2

[0190] like Figure 2 As shown, in a second embodiment of the present invention, a system for detecting defects in automobile interior and exterior plastic parts is provided, the system comprising:

[0191] Processing module 1 is used to obtain a target automobile interior and exterior plastic part image and pre-process the target automobile interior and exterior plastic part image to obtain a processed automobile interior and exterior plastic part image;

[0192] Adjustment module 2, configured to extract edges of the processed image of the automobile interior and exterior plastic parts to obtain an edge image, and perform distortion adjustment on the processed image of the automobile interior and exterior plastic parts based on pixels in the edge image to obtain an adjusted image of the automobile interior and exterior plastic parts;

[0193] an enhancement module 3, configured to perform a discrete wavelet transform on the adjusted image of the automobile interior and exterior plastic parts to obtain a high-frequency image component and a low-frequency image component, perform threshold screening on the high-frequency image component and perform filtering on the low-frequency image component to obtain a screened image component and a filtered image component, respectively, and determine an enhanced image of the automobile interior and exterior plastic parts based on the screened image component and the filtered image component;

[0194] a correction module 4 for performing a first brightness correction and a second brightness correction on the enhanced image of the automobile interior and exterior plastic parts, respectively, to obtain a first corrected image and a second corrected image, respectively, and fusing the first corrected image with the second corrected image to obtain a corrected image of the automobile interior and exterior plastic parts;

[0195] Detection module 5, used to obtain training images of automobile interior and exterior plastic parts, input the training images of automobile interior and exterior plastic parts into a preset detection model for training, input the corrected images of automobile interior and exterior plastic parts into the trained preset detection model for detection, and output defect detection results;

[0196] The adjustment module 2 includes:

[0197] a traversal submodule, configured to traverse the pixel points in the edge image to obtain an edge pixel point set, and determine an adjusted contour line set based on the edge pixel point set;

[0198] a mapping submodule, configured to calculate the intersection of two adjacent target contour lines in the adjusted contour line set to obtain target vertex coordinates, segment the processed automotive interior and exterior plastic part image into a plurality of pixel planes based on the target vertex coordinates and the corresponding target contour lines, establish a spatial coordinate system with one of the target vertex coordinates as an origin, and map the plurality of pixel planes into the spatial coordinate system to obtain a mapped automotive interior and exterior plastic part image;

[0199] A coordinate axis submodule is configured to extract all pixel points of the mapped automobile interior and exterior plastic part image in the XZ plane to obtain a mapped pixel point set, and determine the coordinate values of the pixel points in the mapped pixel point set on the X axis and the Z axis respectively to obtain an X coordinate set and a Z coordinate set;

[0200] The offset submodule is used to extract the pixel point corresponding to the minimum value of the Z coordinate set as the distortion reference point, and calculate the distance between the pixel point in the mapping pixel point set and the distortion reference point. , based on the distance Calculate the X-direction offset :

[0201] ;

[0202] Where, Indicates the distance from the plane passing through the distortion reference point and parallel to the camera plane to the camera plane, is the camera focal length, is the angle between the camera plane and the XZ plane;

[0203] The adjustment submodule is used to extract the pixel point corresponding to the minimum value of the X coordinate set and repeatedly perform the Z direction offset Calculation, based on X-direction offset Offset in the Z direction The mapping pixel point set is distorted and the distortion adjustment process is repeated on the remaining planes to obtain an adjusted image of the automobile interior and exterior plastic parts.

[0204] The traversal submodule includes:

[0205] a direction unit, configured to traverse the pixels in the edge image to obtain an edge pixel set, select any pixel coordinate direction as a reference direction, calculate the distance between the pixel in the reference direction and the pixel with the largest ordinate in the edge pixel set, and store the pixel with a distance less than a first distance threshold in a first undetermined pixel set;

[0206] a first fitting unit, configured to arrange the pixels in the first undetermined pixel point set in ascending order according to the magnitude of the abscissa, select three reference pixels from the sorted first undetermined pixel point set for function fitting to obtain a first reference line, calculate the distance between the pixels in the first undetermined pixel point set and the first reference line, and store the pixels whose distance is less than a second distance threshold into a second undetermined pixel point set;

[0207] a second fitting unit, configured to perform function fitting on the pixels in the second undetermined pixel point set to obtain a second reference line, calculate the distance between the pixels in the second undetermined pixel point set and the second reference line, store the pixels whose distance is less than a third distance threshold into a third undetermined pixel point set, and perform function fitting on the pixels in the third undetermined pixel point set to obtain a target contour line;

[0208] a third fitting unit, configured to perform the process of determining the undetermined pixel point set and fitting the function on the pixel points in the remaining pixel coordinate directions to obtain a contour line set, determine the slope and intercept of each target contour line in the contour line set, and arrange the contour line set in ascending order according to the slope of each target contour line to obtain an arranged contour line set;

[0209] A position adjustment unit is used to determine the size between the intercept of the Ath target contour line and the intercept of the A+1th target contour line in the arranged contour line set if the absolute value of the difference between the slope of the Ath target contour line and the slope of the A+1th target contour line in the arranged contour line set is not greater than the slope threshold; if the intercept of the Ath target contour line is greater than the intercept of the A+1th target contour line, the position of the Ath target contour line and the A+1th target contour line are exchanged to obtain an adjusted contour line set.

[0210] The enhancement module 3 includes:

[0211] The fixed threshold submodule is used to determine the storage method of the wavelet coefficients after the discrete wavelet transform of the image of the automobile interior and exterior plastic parts is performed. , determine the fixed threshold based on the storage method :

[0212] ;

[0213] Where, Indicates the median value, represents the coefficient space set, is the coefficient length, Indicates adjusting the size of the image of the interior and exterior plastic parts of the car;

[0214] The first threshold submodule is used to Determine the first wavelet adjustment threshold :

[0215] ;

[0216] Where, is the wavelet coefficient after the first decomposition, denote the first and second adjustment factors respectively;

[0217] A second threshold submodule is used to adjust the threshold based on the first wavelet. Determine the second wavelet adjustment threshold :

[0218] ;

[0219] Elimination submodule, used to adjust the threshold value of the second wavelet The wavelet coefficients corresponding to the high-frequency image components are eliminated to obtain the filtered image components;

[0220] A filtering submodule is used to filter the low-frequency image components by A filtering window is determined for the radius, and filtering is performed on the low-frequency image component based on the filtering window to obtain a filtered image component:

[0221] ;

[0222] Where, Represents the filtered image component The gray value at Represent the low-frequency image components Gray value at the center of the filter window The gray value at Indicates the standard deviation of grayscale similarity.

[0223] The enhancement module 3 further includes:

[0224] The transformation submodule is used to perform inverse discrete wavelet transformation on the screened image component and the filtered image component to obtain the to-be-determined enhanced image. ;

[0225] A channel submodule is used to determine the R channel enhanced image based on the to-be-determined enhanced image , G channel enhanced image , B channel enhanced image :

[0226] ; ;

[0227] ;

[0228] Where, 、 Respectively represent the adjustment of the image of the interior and exterior plastic parts of the car Images in R, G, and B channels;

[0229] Combined submodule for enhancing the R channel image , G channel enhanced image , B channel enhanced image Combined to obtain enhanced images of automotive interior and exterior plastic parts.

[0230] The correction module 4 includes:

[0231] A decomposition submodule is configured to decompose the enhanced automobile interior and exterior plastic parts image into a plurality of image sub-blocks, and determine a minimum filtered image based on the image sub-blocks:

[0232] ;

[0233] Where, Indicated by pixels The image sub-block centered on Represents an image that enhances the R, G, and B channels of an image of an interior and exterior plastic part of a car;

[0234] An environmental reference submodule is used to identify the brightness of the pixels of the minimum filtered image, and arrange the pixels of the minimum filtered image in descending order according to the brightness to obtain a brightness pixel set, select the first several pixels in the brightness pixel set as the undetermined brightness pixel points, determine the pixels corresponding to the undetermined brightness pixel points in the enhanced automobile interior and exterior plastic parts image as basic pixels, and use the maximum pixel value among the basic pixels as the environmental reference value ;

[0235] The first transmittance submodule is used to Determine the first transmittance :

[0236]

[0237] Where, represents the brightness parameter, Indicates the environmental reference values corresponding to the R, G, and B channels;

[0238] The second transmittance submodule is used to calculate the second transmittance :

[0239] ;

[0240] Where, represents the atmospheric dissipation coefficient, represents the correction factor, Respectively represent the brightness and maximum brightness of the image of the interior and exterior plastic parts of the car;

[0241] The third transmittance submodule is used to With the second transmittance Calculate the third transmittance :

[0242] ;

[0243] ; ;

[0244] Where, represent the first adjustment parameter and the second adjustment parameter respectively;

[0245] A first correction submodule is configured to correct the error based on the third transmittance. Determine the first correction image :

[0246] ;

[0247] Where, is the calibration constant, It indicates the enhancement of images of automobile interior and exterior plastic parts;

[0248] The second correction submodule is used to convert the enhanced automobile interior and exterior plastic parts image into Lab space and extract the L component image, perform histogram equalization on the L component image to obtain a balanced image, convert the balanced image into RGB space and combine it with the remaining component images in Lab space to obtain a second corrected image.

[0249] The correction module 4 also includes:

[0250] a wavelet transform submodule, configured to perform a wavelet transform on the first corrected image to obtain a first low-frequency sub-image and a first high-frequency sub-image, perform a wavelet transform on the second corrected image to obtain a second low-frequency sub-image and a second high-frequency sub-image, and perform weighted fusion on the first low-frequency sub-image and the second low-frequency sub-image to obtain a first fused image;

[0251] A value submodule, configured to calculate a first fusion value of the first high-frequency sub-image The second fusion value with the second high frequency sub-image :

[0252] ;

[0253] ;

[0254] Where, Indicates the size of the local area, represents the cost weight, express The first high-frequency sub-image and the second high-frequency sub-image in the direction The intensity value at Indicates one of the three directions: horizontal, vertical, and diagonal;

[0255] Trust submodule, for With the second fusion value Calculate fusion trust :

[0256] ;

[0257] The weight submodule is used to calculate the weight of the fusion trust Calculate fusion weights :

[0258] ;

[0259] Where, represents the fusion threshold;

[0260] The first fusion submodule is used to determine the fusion trust Is it less than the fusion threshold? , if the trust Less than the fusion threshold , then the second fused image for:

[0261] ;

[0262] The second fusion submodule is used to fuse the trust Not less than the fusion threshold , then the second fused image for:

[0263] ;

[0264] Output submodule, used to convert the first fused image and the second fused image in each direction into Perform inverse wavelet transform to obtain the corrected image of automobile interior and exterior plastic parts.

[0265] In other embodiments of the present invention, embodiments of the present invention provide the following technical solutions: a computer comprising a memory 102, a processor 101, and a computer program stored on the memory 102 and executable on the processor 101; the processor 101 implements the above-described method for detecting defects in automobile interior and exterior plastic parts when executing the computer program.

[0266] Specifically, the processor 101 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured as one or more integrated circuits for implementing the embodiments of the present invention.

[0267] Memory 102 may include a large-capacity memory for data or instructions. By way of example, and not limitation, memory 102 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 102 may include removable or non-removable (or fixed) media. Where appropriate, memory 102 may be internal or external to the data processing device. In certain embodiments, memory 102 is non-volatile memory. In certain embodiments, memory 102 includes read-only memory (ROM) and random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically alterable ROM (EAROM) or a flash memory (FLASH), or a combination of two or more of these. Under appropriate circumstances, the RAM can be a static random access memory (SRAM) or a dynamic random access memory (DRAM), where the DRAM can be a fast page mode dynamic random access memory (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.

[0268] The memory 102 may be used to store or cache various data files that need to be processed and / or used for communication, as well as possible computer program instructions executed by the processor 101 .

[0269] The processor 101 implements the above-mentioned method for detecting defects in automobile interior and exterior plastic parts by reading and executing computer program instructions stored in the memory 102 .

[0270] In some embodiments, the computer may further include a communication interface 103 and a bus 100. Figure 3 As shown, the processor 101 , the memory 102 , and the communication interface 103 are connected via a bus 100 and communicate with each other.

[0271] The communication interface 103 is used to implement communication between the various modules, devices, units, and / or equipment in the embodiments of the present invention. The communication interface 103 can also implement data communication with other components such as external devices, image / data acquisition equipment, databases, external storage, and image / data processing workstations.

[0272] Bus 100 includes hardware, software, or both, and couples components of a computer device to each other. Bus 100 includes, but is not limited to, at least one of the following: a data bus, an address bus, a control bus, an expansion bus, and a local bus. By way of example and not limitation, bus 100 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses, or a combination of two or more of these. Bus 100 may include one or more buses, where appropriate. Although embodiments of the present invention describe and illustrate a particular bus, the present invention contemplates any suitable bus or interconnect.

[0273] The computer can execute the automobile interior and exterior plastic parts defect detection method of the present invention based on the acquired automobile interior and exterior plastic parts defect detection system, thereby realizing automobile interior and exterior plastic parts defect detection.

[0274] In some further embodiments of the present invention, in combination with the above-mentioned method for detecting defects in automobile interior and exterior plastic parts, the embodiments of the present invention provide the following technical solutions: a storage medium having a computer program stored thereon, which implements the above-mentioned method for detecting defects in automobile interior and exterior plastic parts when executed by a processor.

[0275] Those skilled in the art will appreciate that the logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device), or in conjunction with such instruction execution system, apparatus, or device. For purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by an instruction execution system, apparatus, or device, or in conjunction with such instruction execution system, apparatus, or device.

[0276] More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk cartridge (magnetic devices), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disc read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering, or processing in another suitable manner as necessary, and then stored in a computer memory.

[0277] It should be understood that various components of the present invention may be implemented using hardware, software, firmware, or a combination thereof. In the aforementioned embodiments, multiple steps or methods may be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one or a combination of the following technologies known in the art may be used: a discrete logic circuit having logic gate circuits for implementing logic functions on data signals, an application-specific integrated circuit having suitable combinational logic gate circuits, a programmable gate array (PGA), a field-programmable gate array (FPGA), etc.

[0278] The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0279] The above-described embodiments merely represent several implementations of the present invention, and while their descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent. It should be noted that a person of ordinary skill in the art would be able to make numerous variations and improvements without departing from the spirit of the present invention, and these variations and improvements fall within the scope of protection of the present invention. Therefore, the scope of protection of the patent for this invention shall be determined by the appended claims.

Claims

1. A method for detecting defects in automobile interior and exterior plastic parts, characterized in that: include: Acquire a target automobile interior and exterior plastic part image, and pre-process the target automobile interior and exterior plastic part image to obtain a processed automobile interior and exterior plastic part image; performing edge extraction on the processed image of the automobile interior and exterior plastic part to obtain an edge image, and performing distortion adjustment on the processed image of the automobile interior and exterior plastic part based on pixels in the edge image to obtain an adjusted image of the automobile interior and exterior plastic part; performing a discrete wavelet transform on the adjusted image of the automobile interior and exterior plastic part to obtain a high-frequency image component and a low-frequency image component, performing threshold screening on the high-frequency image component and filtering on the low-frequency image component to obtain a screened image component and a filtered image component, respectively, and determining an enhanced image of the automobile interior and exterior plastic part based on the screened image component and the filtered image component; performing a first brightness correction and a second brightness correction on the enhanced image of the automobile interior and exterior plastic part to obtain a first corrected image and a second corrected image, respectively, and fusing the first corrected image with the second corrected image to obtain a corrected image of the automobile interior and exterior plastic part; Acquire training images of automobile interior and exterior plastic parts, input the training images of automobile interior and exterior plastic parts into a preset detection model for training, and input the corrected images of automobile interior and exterior plastic parts into the trained preset detection model for detection to output defect detection results; The step of performing distortion adjustment on the processed image of the automobile interior and exterior plastic part based on the pixel points in the edge image to obtain the adjusted image of the automobile interior and exterior plastic part comprises: Traversing pixel points in the edge image to obtain an edge pixel point set, and determining an adjusted contour line set based on the edge pixel point set; Calculating the intersection of two adjacent target contour lines in the adjusted contour line set to obtain target vertex coordinates, segmenting the processed automobile interior and exterior plastic part image into a plurality of pixel planes based on the target vertex coordinates and the corresponding target contour lines, establishing a spatial coordinate system with one of the target vertex coordinates as an origin, and mapping the plurality of pixel planes into the spatial coordinate system to obtain a mapped automobile interior and exterior plastic part image; Extracting all pixel points of the mapped image of the automobile interior and exterior plastic parts in the XZ plane to obtain a mapped pixel point set, and determining the coordinate values of the pixel points in the mapped pixel point set on the X axis and the Z axis respectively to obtain an X coordinate set and a Z coordinate set; Extract the pixel point corresponding to the minimum value of the Z coordinate set as the distortion reference point, and calculate the distance between the pixel point in the mapping pixel point set and the distortion reference point , based on the distance Calculate the X-direction offset : ; Where, Indicates the distance from the plane passing through the distortion reference point and parallel to the camera plane to the camera plane, is the camera focal length, is the angle between the camera plane and the XZ plane; Extract the pixel point corresponding to the minimum value of the X coordinate set and repeat the Z direction offset Calculation, based on X-direction offset Offset in the Z direction The mapping pixel point set is distorted and the distortion adjustment process is repeated on the remaining planes to obtain an adjusted image of the automobile interior and exterior plastic parts.

2. The method for detecting defects in automobile interior and exterior plastic parts according to claim 1, characterized in that: The step of traversing the pixel points in the edge image to obtain an edge pixel point set, and determining an adjusted contour line set based on the edge pixel point set comprises: Traversing the pixel points in the edge image to obtain an edge pixel point set, selecting any pixel coordinate direction as a reference direction, calculating the distance between the pixel point in the reference direction and the pixel point with the largest ordinate in the edge pixel point set, and storing the pixel points with a distance less than a first distance threshold in a first undetermined pixel point set; Arrange the pixels in the first undetermined pixel point set in ascending order according to their abscissas, select three reference pixels from the sorted first undetermined pixel point set, and perform function fitting to obtain a first reference line; calculate the distances from the pixels in the first undetermined pixel point set to the first reference line, and store the pixels whose distances are less than a second distance threshold into a second undetermined pixel point set; Performing function fitting on the pixels in the second undetermined pixel point set to obtain a second reference line, calculating the distance between the pixels in the second undetermined pixel point set and the second reference line and storing the pixels whose distance is less than a third distance threshold into a third undetermined pixel point set, and performing function fitting on the pixels in the third undetermined pixel point set to obtain a target contour line; Performing the process of determining the undetermined pixel point set and function fitting on the pixel points in the remaining pixel coordinate directions to obtain a contour line set, determining the slope and intercept of each target contour line in the contour line set, and arranging the contour line set in ascending order according to the slope of each target contour line to obtain an arranged contour line set; If the absolute value of the difference between the slope of the Ath target contour line and the slope of the A+1th target contour line in the arranged contour line set is not greater than the slope threshold, then the size between the intercept of the Ath target contour line and the intercept of the A+1th target contour line in the arranged contour line set is determined; if the intercept of the Ath target contour line is greater than the intercept of the A+1th target contour line, then the position of the Ath target contour line and the A+1th target contour line are swapped to obtain an adjusted contour line set.

3. The method for detecting defects in automobile interior and exterior plastic parts according to claim 1, characterized in that: The steps of performing threshold screening on the high-frequency image component and filtering on the low-frequency image component to obtain a screened image component and a filtered image component respectively include: Determine the storage method of the wavelet coefficients after the discrete wavelet transform of the image of the automobile interior and exterior plastic parts is , determine the fixed threshold based on the storage method : ; Where, Indicates the median value, represents the coefficient space set, is the coefficient length, Indicates adjusting the size of the image of the interior and exterior plastic parts of the car; Based on the fixed threshold Determine the first wavelet adjustment threshold : ; Where, is the wavelet coefficient after the first decomposition, denote the first and second adjustment factors respectively; Adjust the threshold based on the first wavelet Determine the second wavelet adjustment threshold : ; will be less than the second wavelet adjustment threshold The wavelet coefficients corresponding to the high-frequency image components are eliminated to obtain the filtered image components; In the low-frequency image component A filtering window is determined for the radius, and filtering is performed on the low-frequency image component based on the filtering window to obtain a filtered image component: ; Where, Represents the filtered image component The gray value at Represent the low-frequency image components Gray value at the center of the filter window The gray value at Indicates the standard deviation of grayscale similarity.

4. The method for detecting defects in automobile interior and exterior plastic parts according to claim 1, characterized in that: The step of determining an enhanced image of an automobile interior and exterior plastic part based on the screened image component and the filtered image component comprises: Perform inverse discrete wavelet transform on the screened image component and the filtered image component to obtain the to-be-determined enhanced image. ; Determine the R channel enhanced image based on the to-be-determined enhanced image , G channel enhanced image , B channel enhanced image : ; ; ; Where, 、 Respectively represent the adjustment of the image of the interior and exterior plastic parts of the car Images in R, G, and B channels; Enhance the R channel image , G channel enhanced image , B channel enhanced image Combined to obtain enhanced images of automotive interior and exterior plastic parts.

5. The method for detecting defects in automobile interior and exterior plastic parts according to claim 1, characterized in that: The step of performing a first brightness correction and a second brightness correction on the enhanced image of the automobile interior and exterior plastic part to obtain a first corrected image and a second corrected image respectively includes: Decompose the enhanced automobile interior and exterior plastic parts image into several image sub-blocks, and determine the minimum filtered image based on the image sub-blocks: ; Where, Indicated by pixels The image sub-block centered on Represents an image that enhances the R, G, and B channels of an image of an interior and exterior plastic part of a car; Identify the brightness of the pixels of the minimum filtered image, and arrange the pixels of the minimum filtered image in descending order according to the brightness to obtain a brightness pixel set, select the first several pixels in the brightness pixel set as the undetermined brightness pixel points, determine the pixels corresponding to the undetermined brightness pixel points in the enhanced image of the automobile interior and exterior plastic parts as the basic pixel points, and use the maximum pixel value among the basic pixel points as the environmental reference value ; Based on the environmental reference values Determine the first transmittance : Where, represents the brightness parameter, Indicates the environmental reference values corresponding to the R, G, and B channels; Calculate the second transmittance : ; Where, represents the atmospheric dissipation coefficient, represents the correction factor, Respectively represent the brightness and maximum brightness of the image of the interior and exterior plastic parts of the car; Based on the first transmittance With the second transmittance Calculate the third transmittance : ; ; ; Where, represent the first adjustment parameter and the second adjustment parameter respectively; Based on the third transmittance Determine the first correction image : ; Where, is the calibration constant, It indicates the enhancement of images of automobile interior and exterior plastic parts; The enhanced automobile interior and exterior plastic parts image is converted into Lab space and the L component image is extracted. The L component image is histogram equalized to obtain a balanced image. The balanced image is converted into RGB space and combined with the remaining component images in Lab space to obtain a second corrected image.

6. The method for detecting defects in automobile interior and exterior plastic parts according to claim 1, characterized in that: The step of fusing the first corrected image with the second corrected image to obtain a corrected image of an automobile interior and exterior plastic part includes: performing a wavelet transform on the first corrected image to obtain a first low-frequency sub-image and a first high-frequency sub-image, performing a wavelet transform on the second corrected image to obtain a second low-frequency sub-image and a second high-frequency sub-image, and performing weighted fusion on the first low-frequency sub-image and the second low-frequency sub-image to obtain a first fused image; Calculate the first fusion value of the first high-frequency sub-image The second fusion value with the second high frequency sub-image : ; ; Where, Indicates the size of the local area, represents the cost weight, express The first high-frequency sub-image and the second high-frequency sub-image in the direction The intensity value at Indicates one of the three directions: horizontal, vertical, and diagonal; Based on the first fusion value With the second fusion value Calculate fusion trust : ; Based on the fusion trust Calculate fusion weights : ; Where, represents the fusion threshold; Determine the fusion trust Is it less than the fusion threshold? , if the trust Less than the fusion threshold , then the second fused image for: ; If the trust Not less than the fusion threshold , then the second fused image for: ; The first fused image and the second fused image in each direction Perform inverse wavelet transform to obtain the corrected image of automobile interior and exterior plastic parts.

7. A system for detecting defects in automobile interior and exterior plastic parts, the system adopting the method for detecting defects in automobile interior and exterior plastic parts according to claim 1, characterized in that: The system comprises: a processing module, configured to obtain a target automobile interior and exterior plastic part image, and pre-process the target automobile interior and exterior plastic part image to obtain a processed automobile interior and exterior plastic part image; an adjustment module, configured to extract edges of the processed image of the automobile interior and exterior plastic parts to obtain an edge image, and perform distortion adjustment on the processed image of the automobile interior and exterior plastic parts based on pixels in the edge image to obtain an adjusted image of the automobile interior and exterior plastic parts; an enhancement module, configured to perform a discrete wavelet transform on the adjusted image of the automobile interior and exterior plastic part to obtain a high-frequency image component and a low-frequency image component, perform threshold screening on the high-frequency image component and perform filtering on the low-frequency image component to obtain a screened image component and a filtered image component, respectively, and determine an enhanced image of the automobile interior and exterior plastic part based on the screened image component and the filtered image component; a correction module, configured to perform a first brightness correction and a second brightness correction on the enhanced image of the automobile interior and exterior plastic part, respectively, to obtain a first corrected image and a second corrected image, respectively, and fuse the first corrected image with the second corrected image to obtain a corrected image of the automobile interior and exterior plastic part; The detection module is used to obtain training images of automobile interior and exterior plastic parts, input the training images of automobile interior and exterior plastic parts into a preset detection model for training, and input the corrected images of automobile interior and exterior plastic parts into the trained preset detection model for detection to output defect detection results.

8. A computer comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method for detecting defects in automobile interior and exterior plastic parts according to any one of claims 1 to 6 is implemented.

9. A storage medium, characterized in that: The storage medium stores a computer program, which, when executed by a processor, implements the method for detecting defects in automobile interior and exterior plastic parts according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Image processing method and device for executing the same

    CN107403412A

  • Image splicing method and system based on deep learning, medium and computer

    CN115456876A