Defect detection method and system for 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 the interior and exterior of the automobile, the problem of low detection accuracy in the prior art is solved, and a more efficient defect detection effect is achieved.

CN120047451AActive Publication Date: 2025-05-27NANCHANG HUAXIANG AUTOMOBILE INTERIOR & EXTERIOR PARTS CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

It is difficult to effectively detect defects of plastic parts in and out of automobiles before assembly, such as scratches, surface damage, burns, abnormal depressions and protrusions. The existing machine vision detection methods are affected by problems such as image reflection, low contrast, and uneven color, resulting in low detection accuracy.

Method used

A defect detection method for plastic parts in the interior and exterior of automobiles is proposed, including obtaining target images and pre-processing, edge extraction and distortion adjustment, discrete wavelet transformation and threshold screening and filtering, brightness correction and image fusion, and finally defect detection is performed through the preset detection model.

Benefits of technology

Through image adjustment and enhancement processing, the image geometric correction accuracy is improved, geometric errors are reduced, image detail information is preserved, reflections and artifacts are eliminated, image contrast is improved, and defect detection accuracy and accuracy of subsequent models are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120047451A_ABST
    Figure CN120047451A_ABST
Patent Text Reader

Abstract

The invention provides an automobile interior and exterior plastic part defect detection method and system. The method comprises the following steps: preprocessing a target automobile interior and exterior plastic part image; edge extraction is carried out on the processed automobile interior and exterior plastic part image, and distortion adjustment is carried out 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 a high-frequency image component, performing filtering processing on a low-frequency image component, and determining an enhanced automobile interior and exterior plastic part image; performing first brightness correction and second brightness correction on the enhanced automobile interior and exterior plastic part image, and fusing the first corrected image and the second corrected image; and inputting the corrected automobile interior and exterior plastic part image into the trained preset detection model for detection so as to output a defect detection result, so that the accuracy of automobile interior and exterior plastic part defect detection can be improved.
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 automobile interior and exterior plastic parts, in order to ensure the appearance of the vehicle and uniform force, it is usually necessary to ensure that there are no defects on the automobile interior and exterior plastic parts, such as scratches, surface damage, burns, abnormal depressions and protrusions, etc. Therefore, defect detection is required. Automobile interior and exterior plastic parts are usually inspected for defects using machine vision. However, the images of automobile interior and exterior plastic parts are usually captured due to factors such as material, shooting, and environment, resulting in reflections, low contrast, and uneven colors, 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] On the one hand, the present invention provides the following technical solution, a method for detecting defects in automobile interior and exterior plastic parts, comprising: Acquire a target automobile interior and exterior plastic part image, and preprocess 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 parts to obtain an edge image, and performing distortion adjustment on the processed image of the automobile interior and exterior plastic parts based on pixel points in the edge image to obtain an adjusted image of the automobile interior and exterior plastic parts; Performing 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, 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 automobile interior and exterior plastic parts image based on the screened image component and the filtered image component; Performing a first brightness correction and a second brightness correction on the enhanced automobile interior and exterior plastic parts image 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 automobile interior and exterior plastic parts image; A training image of an automobile interior and exterior plastic part is obtained, the training image of the automobile interior and exterior plastic part is input into a preset detection model for training, and the corrected image of the automobile interior and exterior plastic part is input into the trained preset detection model for detection to output a defect detection result.

[0006] 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, and pre-processes the target automobile interior and exterior plastic parts image to obtain a processed automobile interior and exterior plastic parts image; then, edge extraction is performed on the processed automobile interior and exterior plastic parts image to obtain an edge image, and distortion adjustment is performed 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, discrete wavelet transform is performed on the adjusted automobile interior and exterior plastic parts image to obtain a high-frequency image component and a low-frequency image component, threshold screening is performed on the high-frequency image component, and filtering is performed on the low-frequency image component to obtain a screened image component and a filtered image component, respectively, and an enhanced automobile interior and exterior plastic parts image is determined based on the screened image component and the filtered image component; then, a first brightness correction and a second brightness correction are performed on the enhanced automobile interior and exterior plastic parts image, respectively. degree correction 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 automobile interior and exterior plastic parts; then obtain a training image of automobile interior and exterior plastic parts, input the training image of automobile interior and exterior plastic parts into a preset detection model for training, and input the corrected image of automobile interior and exterior plastic parts into the trained preset detection model for detection to output a defect detection result. The present invention adjusts the image to effectively improve the geometric correction accuracy of the image and reduce the geometric error of the image. After that, the image is enhanced to effectively retain the detail information in the image, eliminate the reflection, artifact, halo, etc. in the image, and improve the contrast of the image. After that, the image is brightness corrected to fully retain the color characteristics and edge characteristics of the original image while avoiding distortion, thereby improving the precision and accuracy of subsequent model defect detection.

[0007] Preferably, the step of performing distortion adjustment on the processed automobile interior and exterior plastic part image based on the pixel points in the edge image to obtain the adjusted automobile interior and exterior plastic part image comprises: Traversing pixel points in the edge image to obtain an edge pixel point set, and determining an adjustment contour line set based on the edge pixel point set; Calculating the intersection point between two adjacent target contour lines in the adjusted contour line set to obtain the target vertex coordinates, dividing the processed automobile interior and exterior plastic part image into a plurality of pixel planes according to the target vertex coordinates and the corresponding target contour lines, taking one of the target vertex coordinates as the origin and establishing a spatial coordinate system, mapping the plurality of pixel planes to the spatial coordinate system to obtain a mapped automobile interior and exterior plastic part image; Extract all pixel points of the mapped automobile interior and exterior plastic parts 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; 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 : ; In the formula, Represents 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 corresponding to the minimum value of the X coordinate set and repeat the Z direction offset Calculation, based on X-direction offset Offset in Z direction The mapping pixel point set is distorted and adjusted, and the distortion adjustment process is repeated on the remaining planes to obtain an adjusted automobile interior and exterior plastic part image.

[0008] 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 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 point 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 the size of the horizontal coordinates and select three reference pixel points from the sorted first undetermined pixel point set to perform 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 pixel points whose distance is less than a second distance threshold into the second undetermined pixel point set; Performing function fitting on the pixel points in the second undetermined pixel point set to obtain a second reference line, calculating the distance between the pixel points in the second undetermined pixel point set and the second reference line and storing the pixel points whose distance is less than a third distance threshold into a third undetermined pixel point set, and performing function fitting on the pixel points in the third undetermined pixel point set to obtain a target contour line; The process of determining the undetermined pixel point set and fitting the function is performed 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; 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.

[0009] Preferably, the steps of threshold screening the high-frequency image component and filtering 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 adjusted as follows: , determine the fixed threshold based on the storage method : ; In the formula, represents 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 : ; In the formula, 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 removed 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: ; In the formula, Represents the filtered image component The gray value at Represents the low-frequency image components Gray value at the center of the filter window The gray value at Represents the standard deviation of grayscale similarity.

[0010] Preferably, 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 comprises: The screened image component and the filtered image component are subjected to inverse discrete wavelet transform to obtain a 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 : ; ; ; In the formula, , Respectively represent the adjustment of the images of the interior and exterior plastic parts of the car Images in R, G, 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.

[0011] Preferably, the step of performing a first brightness correction and a second brightness correction on the enhanced automobile interior and exterior plastic parts image to obtain a first corrected image and a second corrected image respectively comprises: Decompose the enhanced automobile interior and exterior plastic parts image into several image sub-blocks, and determine the minimum filter image based on the image sub-blocks: ; In the formula, Indicated in pixels The image sub-block centered at Represents an image of enhanced automobile interior and exterior plastic parts in R, G, and B channels; 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 pixels, determine the pixels corresponding to the undetermined brightness pixels in the enhanced automobile interior and exterior plastic parts image as basic pixels, and use the maximum pixel value in the basic pixels as the environmental reference value ; Based on the environmental reference values Determine the first transmittance :

[0012] In the formula, represents the brightness parameter, Indicates the environmental reference values ​​corresponding to the R, G, and B channels; Calculate the second transmittance : ; In the formula, represents the atmospheric dissipation coefficient, represents the correction factor, They represent the brightness and maximum brightness of the image of the interior and exterior plastic parts of the car, respectively; Based on the first transmittance With the second transmittance Calculate the third transmittance : ; ; ; In the formula, represent the first adjustment parameter and the second adjustment parameter respectively; Based on the third transmittance Determine the first correction image : ; In the formula, is the calibration constant, It means enhancing the image 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 subjected to histogram equalization to obtain a balanced image, the balanced image is converted into RGB space and combined with the remaining component images of Lab space to obtain a second corrected image.

[0013] 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 comprises: Performing wavelet transformation on the first corrected image to obtain a first low-frequency sub-image and a first high-frequency sub-image, performing wavelet transformation on the second corrected image to obtain a second low-frequency sub-image and a second high-frequency sub-image, and weighted fusion of 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 of the second high frequency sub-image : ; ; In the formula, represents 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 the fusion trust : ; Based on the fusion trust Calculate fusion weights : ; In the formula, represents the fusion threshold; Determine the fusion trust Is it less than the fusion threshold? , if the trust is integrated 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 automobile interior and exterior plastic parts image.

[0014] 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: A processing module, used for acquiring a target automobile interior and exterior plastic part image, and preprocessing the target automobile interior and exterior plastic part image to obtain a processed automobile interior and exterior plastic part image; An adjustment module is used to extract edges of the processed automobile interior and exterior plastic parts image to obtain an edge image, and to perform distortion adjustment on the processed automobile interior and exterior plastic parts image based on pixels in the edge image to obtain an adjusted automobile interior and exterior plastic parts image; an enhancement module, configured to perform 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, perform threshold screening on the high-frequency image component and filter processing on the low-frequency image component to obtain a screened image component and a filtered image component respectively, and determine an enhanced automobile interior and exterior plastic parts image 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 automobile interior and exterior plastic parts image, 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 automobile interior and exterior plastic parts image; 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, input the corrected images of automobile interior and exterior plastic parts into the trained preset detection model for detection, and output defect detection results.

[0015] 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, wherein the processor implements the above-mentioned method for detecting defects in automobile interior and exterior plastic parts when executing the computer program.

[0016] 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

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

[0018] Figure 1 A flow chart of a method for detecting defects in automobile interior and exterior plastic parts provided in Embodiment 1 of the present invention; Figure 2 A structural block diagram of a defect detection system for automobile interior and exterior plastic parts provided in the second embodiment of the present invention; Figure 3 A schematic diagram of the hardware structure of a computer provided in another embodiment of the present invention.

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

[0020] Embodiments of the present invention are described in detail below, 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.

[0021] Embodiment 1 In the first embodiment of the present invention, Figure 1 As shown, a method for detecting defects in automobile interior and exterior plastic parts comprises: S1, acquiring a target automobile interior and exterior plastic part image, and preprocessing the target automobile interior and exterior plastic part image to obtain a processed automobile interior and exterior plastic part image; 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.

[0022] S2, performing edge extraction on the processed image of the automobile interior and exterior plastic parts to obtain an edge image, and performing distortion adjustment on the processed image of the automobile interior and exterior plastic parts based on pixel points in the edge image to obtain an adjusted image of the automobile interior and exterior plastic parts; Wherein, the step S2 comprises: S21, traversing pixel points in the edge image to obtain an edge pixel point set, and determining an adjustment contour line set based on the edge pixel point set; Wherein, the step S21 comprises: S211, 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 point with a distance less than a first distance threshold in a first undetermined pixel point set; Specifically, the edge image here can be obtained by a canny operator, and the pixel coordinate directions here are specifically ±u and ±v directions.

[0023] S212, arranging the pixels in the first undetermined pixel point set in ascending order according to the size of the horizontal coordinates and selecting three reference pixels from the sorted first undetermined pixel point set to perform function fitting to obtain a first reference line, calculating the distance between the pixels in the first undetermined pixel point set and the first reference line and storing the pixels whose distance is less than a second distance threshold into the second undetermined pixel point set; 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.

[0024] S213, performing function fitting on the pixel points in the second undetermined pixel point set to obtain a second reference line, calculating the distance between the pixel points in the second undetermined pixel point set and the second reference line and storing the pixel points whose distance is less than a third distance threshold into a third undetermined pixel point set, performing function fitting on the pixel points in the third undetermined pixel point set to obtain a target contour line; Specifically, the first to third distance thresholds may be determined according to the image 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.

[0025] 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; Specifically, in the above steps S211-S213, the target contour line in a single pixel coordinate direction is specifically determined, and the target contour lines in other directions can be determined by the same method to obtain a contour line set.

[0026] 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 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.

[0027] S22, calculating the intersection point between two adjacent target contour lines in the adjusted contour line set to obtain the target vertex coordinates, dividing the processed automobile interior and exterior plastic part image into a plurality of pixel planes according to the target vertex coordinates and the corresponding target contour lines, taking one of the target vertex coordinates as the origin and establishing a spatial coordinate system, mapping the plurality of pixel planes to the spatial coordinate system to obtain a mapped automobile interior and exterior plastic part image; S23, extracting all pixel points of the mapped automobile interior and exterior plastic parts image 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; S24, extracting the pixel point corresponding to the minimum value of the Z coordinate set as the distortion reference point, and calculating 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 : ; In the formula, Represents 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; 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 Z direction Distortion adjustment is performed on the mapping pixel point set, and the distortion adjustment process is repeated on the remaining planes to obtain an adjusted automobile interior and exterior plastic part image; 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.

[0028] S3, performing 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, 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 automobile interior and exterior plastic parts image based on the screened image component and the filtered image component; 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: 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 adjusted as follows: , determine the fixed threshold based on the storage method : ; In the formula, represents 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; Specifically, the coefficient length here is specifically 1.

[0029] S312: Based on the fixed threshold Determine the first wavelet adjustment threshold : ; In the formula, is the wavelet coefficient after the first decomposition, denote the first and second adjustment factors respectively; 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 image high-frequency noise and retain more detail features in the image. Therefore, in this application, the first and second adjustment factors are both 1.

[0030] S313: adjusting the threshold based on the first wavelet Determine the second wavelet adjustment threshold : ; S314, less than the second wavelet adjustment threshold The wavelet coefficients corresponding to the high-frequency image components are removed to obtain the filtered image components; Specifically, by adjusting the threshold value by The wavelet coefficients corresponding to the high-frequency image components are removed to avoid the high-frequency components being misjudged as noise, resulting in the pseudo-Gibbs phenomenon after denoising.

[0031] 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: ; In the formula, Represents the filtered image component The gray value at Respectively 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; Specifically, through the above formula, the spatial range can be adjusted, and the pixels closer to the center point have a greater weight. At the same time, the grayscale range can also be adjusted. Pixels with similar grayscales have a greater weight, and pixels with large grayscale differences have a smaller weight. , if the distance between the pixel point in the filter window and the center point of the filter window is not greater than , then both the spatial domain and the pixel value domain are considered during the filtering process, which can preserve 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.

[0032] Wherein, 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 comprises: S321, performing inverse discrete wavelet transform on the screened image component and the filtered image component to obtain a to-be-determined enhanced image .

[0033] S322: Determine an R channel enhanced image based on the to-be-determined enhanced image , G channel enhanced image , B channel enhanced image : ; ; ; In the formula, , Respectively represent the adjustment of the images of the interior and exterior plastic parts of the car An image in R, G, B channels.

[0034] 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.

[0035] S4, performing a first brightness correction and a second brightness correction on the enhanced automobile interior and exterior plastic parts image 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 automobile interior and exterior plastic parts image; The step of performing a first brightness correction and a second brightness correction on the enhanced automobile interior and exterior plastic parts image to obtain a first corrected image and a second corrected image respectively comprises: S411, decomposing the enhanced automobile interior and exterior plastic parts image into a plurality of image sub-blocks, and determining a minimum filter image based on the image sub-blocks: ; In the formula, Indicated in pixels The image sub-block centered at An image representing an enhanced image of automobile interior and exterior plastic parts in R, G, and B channels.

[0036] S412, identifying the brightness of the pixels of the minimum filtered image, and arranging the pixels of the minimum filtered image in descending order according to the brightness to obtain a brightness pixel set, selecting the first several pixels in the brightness pixel set as undetermined brightness pixel points, determining the pixels corresponding to the undetermined brightness pixel points in the enhanced automobile interior and exterior plastic parts image as basic pixels, and taking the maximum pixel value among the basic pixels as the environmental reference value ; Specifically, the environmental reference value is determined in step S412 , which can avoid judging obvious light sources and white objects as atmospheric light.

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

[0038] In the formula, represents the brightness parameter, Indicates the environmental reference values ​​corresponding to the R, G, and B channels; 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.

[0039] S414, calculating the second transmittance : ; In the formula, represents the atmospheric dissipation coefficient, represents the correction factor, They represent the brightness and maximum brightness of the image of the interior and exterior plastic parts of the car, respectively; 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, and the correction coefficient is specifically 3.5.

[0040] S415: Based on the first transmittance With the second transmittance Calculate the third transmittance : ; ; ; In the formula, represent the first adjustment parameter and the second adjustment parameter respectively; 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.

[0041] S416: Based on the third transmittance Determine the first correction image : ; In the formula, is the calibration constant, It means enhancing the image of automobile interior and exterior plastic parts; S417, converting the enhanced automobile interior and exterior plastic parts 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 of the Lab space to obtain a second corrected image; Specifically, the histogram equalization here is a commonly used equalization algorithm in the prior art, so it will not be described in detail.

[0042] 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 comprises: S421. Perform wavelet transform on the first corrected image to obtain a first low-frequency sub-image and a first high-frequency sub-image, perform 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.

[0043] S422: Calculate the first fusion value of the first high-frequency sub-image The second fusion value of the second high frequency sub-image : ; ; In the formula, represents 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.

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

[0045] S424: Based on the fusion trust Calculate fusion weights : ; In the formula, represents the fusion threshold.

[0046] S425: Determine the fusion trust Is it less than the fusion threshold? , if the trust is integrated Less than the fusion threshold , then the second fused image for: ; S426, if the integration trust Not less than the fusion threshold , then the second fused image for: ; 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, weighted averaging is used for fusion, giving greater weight to the image with higher fusion value.

[0047] S427: The first fused image and the second fused image in each direction are combined. Perform inverse wavelet transform to obtain the corrected automobile interior and exterior plastic parts image.

[0048] 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.

[0049] 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 a convolutional neural network CNN model.

[0050] The method for detecting defects in automobile interior and exterior plastic parts provided in the first embodiment of the present invention first acquires a target automobile interior and exterior plastic part image, and 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 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 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, respectively. Second brightness correction is performed to obtain a first corrected image and a second corrected image respectively, and the first corrected image is merged with the second corrected image 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 the reflection, artifact, halo, etc. in the image, and improve the contrast of the image. After that, the image is brightness corrected, which can fully retain the color characteristics and edge characteristics of the original image while avoiding distortion, thereby improving the precision and accuracy of subsequent model defect detection.

[0051] Embodiment 2 like Figure 2 As shown, in the second embodiment of the present invention, a system for detecting defects of automobile interior and exterior plastic parts is provided, and the system comprises: Processing module 1, used for acquiring a target automobile interior and exterior plastic part image, and preprocessing the target automobile interior and exterior plastic part image to obtain a processed automobile interior and exterior plastic part image; An adjustment module 2 is used to extract edges of the processed automobile interior and exterior plastic parts image to obtain an edge image, and to perform distortion adjustment on the processed automobile interior and exterior plastic parts image based on pixels in the edge image to obtain an adjusted automobile interior and exterior plastic parts image; Enhancement module 3, used for performing discrete wavelet transform on the adjusted automobile interior and exterior plastic parts image to obtain high-frequency image components and low-frequency image components, performing threshold screening on the high-frequency image components and filtering on the low-frequency image components to obtain screening image components and filtering image components respectively, and determining to enhance the automobile interior and exterior plastic parts image based on the screening image components and the filtering image components; A correction module 4 is used to perform a first brightness correction and a second brightness correction on the enhanced automobile interior and exterior plastic parts image 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 automobile interior and exterior plastic parts image; The detection module 5 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, input the corrected images of automobile interior and exterior plastic parts into the trained preset detection model for detection, and output defect detection results; The adjustment module 2 comprises: A traversal submodule, used for traversing the pixel points in the edge image to obtain an edge pixel point set, and determining an adjustment contour line set based on the edge pixel point set; A mapping submodule, for calculating the intersection of two adjacent target contour lines in the adjusted contour line set to obtain target vertex coordinates, dividing the processed automobile interior and exterior plastic part image into a plurality of pixel planes according to the target vertex coordinates and the corresponding target contour lines, taking one of the target vertex coordinates as the origin and establishing a spatial coordinate system, and mapping the plurality of pixel planes into the spatial coordinate system to obtain a mapped automobile interior and exterior plastic part image; A coordinate axis submodule is used to extract all pixel points of the mapped automobile interior and exterior plastic parts 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; 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 : ; In the formula, Represents 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; 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 Z direction The mapping pixel point set is distorted and adjusted, and the distortion adjustment process is repeated on the remaining planes to obtain an adjusted automobile interior and exterior plastic part image.

[0052] The traversal submodule includes: a direction unit, configured to traverse the pixel points in the edge image to obtain an edge pixel point set, select any pixel coordinate direction as a reference direction, calculate 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 store the pixel point with a distance less than a first distance threshold in a first undetermined pixel point set; A first fitting unit is used to arrange the pixels in the first undetermined pixel point set in ascending order according to the size of the horizontal coordinates and select three reference pixels from the sorted first undetermined pixel point set to perform 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 the second undetermined pixel point set; A second fitting unit is used to perform function fitting on the pixel points in the second undetermined pixel point set to obtain a second reference line, calculate the distance between the pixel points in the second undetermined pixel point set and the second reference line and store the pixel points whose distance is less than a third distance threshold into a third undetermined pixel point set, and perform function fitting on the pixel points in the third undetermined pixel point set to obtain a target contour line; A third fitting unit is used 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; 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 is exchanged with the A+1th target contour line to obtain an adjusted contour line set.

[0053] The enhancement module 3 comprises: 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 adjusted. , determine the fixed threshold based on the storage method : ; In the formula, represents 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; The first threshold submodule is used to Determine the first wavelet adjustment threshold : ; In the formula, is the wavelet coefficient after the first decomposition, denote the first and second adjustment factors respectively; A second threshold submodule is used to adjust the threshold based on the first wavelet Determine the second wavelet adjustment threshold : ; The elimination submodule is used to adjust the threshold value of the second wavelet. The wavelet coefficients corresponding to the high-frequency image components are removed to obtain the filtered image components; A filtering submodule is used to filter the low-frequency image component 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: ; In the formula, Represents the filtered image component The gray value at Represents the low-frequency image components Gray value at the center of the filter window The gray value at Represents the standard deviation of grayscale similarity.

[0054] The enhancement module 3 also includes: A transform submodule is used to perform an inverse discrete wavelet transform on the screened image component and the filtered image component to obtain a to-be-determined enhanced image. ; A channel submodule, used to determine the R channel enhanced image based on the to-be-determined enhanced image , G channel enhanced image , B channel enhanced image : ; ; ; In the formula, , Respectively represent the adjustment of the images of the interior and exterior plastic parts of the car Images in R, G, B channels; Combination submodule, used to 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.

[0055] The correction module 4 comprises: A decomposition submodule is used to decompose the enhanced automobile interior and exterior plastic parts image into a plurality of image sub-blocks, and determine a minimum filter image based on the image sub-blocks: ; In the formula, Indicated in pixels The image sub-block centered at Represents an image of enhanced automobile interior and exterior plastic parts in R, G, and B channels; The 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 of the basic pixels as the environmental reference value ; The first transmittance submodule is used to Determine the first transmittance :

[0056] In the formula, represents the brightness parameter, Indicates the environmental reference values ​​corresponding to the R, G, and B channels; The second transmittance submodule is used to calculate the second transmittance : ; In the formula, represents the atmospheric dissipation coefficient, represents the correction factor, They represent the brightness and maximum brightness of the image of the interior and exterior plastic parts of the car, respectively; The third transmittance submodule is used to With the second transmittance Calculate the third transmittance : ; ; ; In the formula, represent the first adjustment parameter and the second adjustment parameter respectively; A first correction submodule is configured to correct the error based on the third transmittance Determine the first correction image : ; In the formula, is the calibration constant, It means enhancing the image of automobile interior and exterior plastic parts; 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 of the Lab space to obtain a second corrected image.

[0057] The correction module 4 also includes: 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; A value submodule, for calculating a first fusion value of the first high-frequency sub-image The second fusion value of the second high frequency sub-image : ; ; In the formula, represents 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; The trust submodule is used to With the second fusion value Calculate the fusion trust : ; A weight submodule is used to calculate the weight of the fusion trust Calculate fusion weights : ; In the formula, represents the fusion threshold; The first fusion submodule is used to determine the fusion trust Is it less than the fusion threshold? , if the trust is integrated Less than the fusion threshold , then the second fused image for: ; The second fusion submodule is used to fuse the trust Not less than the fusion threshold , then the second fused image for: ; The output submodule is used to output the first fused image and the second fused image in each direction. Perform inverse wavelet transform to obtain the corrected automobile interior and exterior plastic parts image.

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

[0059] Specifically, the processor 101 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiment of the present invention.

[0060] Among them, the memory 102 may include a large-capacity memory for data or instructions. By way of example and not limitation, the memory 102 may include a hard disk drive (HDD), a floppy disk drive, a solid state drive (SSD), a 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, the memory 102 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 102 may be inside or outside the data processing device. In a specific embodiment, the memory 102 is a non-volatile memory. In a specific embodiment, the memory 102 includes a read-only memory (ROM) and a 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), wherein 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.

[0061] 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 .

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

[0063] 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.

[0064] The communication interface 103 is used to implement communication between the modules, devices, units and / or equipment in the embodiment 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.

[0065] The bus 100 includes hardware, software or both, and couples the components of the computer device to each other. The 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. Where appropriate, bus 100 may include one or more buses. Although embodiments of the present invention describe and illustrate a particular bus, the present invention contemplates any suitable bus or interconnect.

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

[0067] 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, and the computer program implements the above-mentioned method for detecting defects in automobile interior and exterior plastic parts when executed by a processor.

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

[0069] More specific examples of readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a 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, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0070] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0071] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described 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.

[0072] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention patent. It should be pointed out that for ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be based on the attached 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 preprocess 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 parts to obtain an edge image, and performing distortion adjustment on the processed image of the automobile interior and exterior plastic parts based on pixel points in the edge image to obtain an adjusted image of the automobile interior and exterior plastic parts; Performing 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, 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 automobile interior and exterior plastic parts image based on the screened image component and the filtered image component; Performing a first brightness correction and a second brightness correction on the enhanced automobile interior and exterior plastic parts image 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 automobile interior and exterior plastic parts image; A training image of an automobile interior and exterior plastic part is obtained, the training image of the automobile interior and exterior plastic part is input into a preset detection model for training, and the corrected image of the automobile interior and exterior plastic part is input into the trained preset detection model for detection to output a defect detection result.

2. The method for detecting defects in automobile interior and exterior plastic parts according to claim 1, characterized in that: The step of performing distortion adjustment on the processed automobile interior and exterior plastic part image based on the pixel points in the edge image to obtain the adjusted automobile interior and exterior plastic part image comprises: Traversing pixel points in the edge image to obtain an edge pixel point set, and determining an adjustment contour line set based on the edge pixel point set; Calculating the intersection point between two adjacent target contour lines in the adjusted contour line set to obtain the target vertex coordinates, dividing the processed automobile interior and exterior plastic part image into a plurality of pixel planes according to the target vertex coordinates and the corresponding target contour lines, taking one of the target vertex coordinates as the origin and establishing a spatial coordinate system, mapping the plurality of pixel planes to the spatial coordinate system to obtain a mapped automobile interior and exterior plastic part image; Extract all pixel points of the mapped automobile interior and exterior plastic parts 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; 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 : ; In the formula, Represents 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 corresponding to the minimum value of the X coordinate set and repeat the Z direction offset Calculation, based on X-direction offset Offset in Z direction The mapping pixel point set is distorted and adjusted, and the distortion adjustment process is repeated on the remaining planes to obtain an adjusted automobile interior and exterior plastic part image.

3. The method for detecting defects in automobile interior and exterior plastic parts according to claim 2, characterized in that: The step of traversing the pixel points in the edge image to obtain an edge pixel point set and determining an adjustment 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 point 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 the size of the horizontal coordinates and select three reference pixel points from the sorted first undetermined pixel point set to perform 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 pixel points whose distance is less than a second distance threshold into the second undetermined pixel point set; Performing function fitting on the pixel points in the second undetermined pixel point set to obtain a second reference line, calculating the distance between the pixel points in the second undetermined pixel point set and the second reference line and storing the pixel points whose distance is less than a third distance threshold into a third undetermined pixel point set, and performing function fitting on the pixel points in the third undetermined pixel point set to obtain a target contour line; The process of determining the undetermined pixel point set and fitting the function is performed 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; 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.

4. 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 adjusted as follows: , determine the fixed threshold based on the storage method : ; In the formula, represents 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 : ; In the formula, 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 removed 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: ; In the formula, Represents the filtered image component The gray value at Respectively represent the low-frequency image components Gray value at the center of the filter window The gray value at Represents the standard deviation of grayscale similarity.

5. The method for detecting defects of automobile interior and exterior plastic parts according to claim 1, characterized in that: The step of determining and enhancing the image of the automobile interior and exterior plastic parts based on the screening image component and the filtering image component comprises: The screened image component and the filtered image component are subjected to inverse discrete wavelet transform to obtain a 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 : ; ; ; In the formula, , Respectively represent the adjustment of the images of the interior and exterior plastic parts of the car Images in R, G, 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.

6. The method for detecting defects of automobile interior and exterior plastic parts according to claim 1, characterized in that: The steps of performing a first brightness correction and a second brightness correction on the enhanced automobile interior and exterior plastic parts image to obtain a first corrected image and a second corrected image respectively include: Decompose the enhanced automobile interior and exterior plastic parts image into several image sub-blocks, and determine the minimum filter image based on the image sub-blocks: ; In the formula, Indicated in pixels The image sub-block centered at Represents an image of enhanced automobile interior and exterior plastic parts in R, G, and B channels; 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 of the basic pixels as the environmental reference value ; Based on the environmental reference values Determine the first transmittance : In the formula, represents the brightness parameter, Indicates the environmental reference values ​​corresponding to the R, G, and B channels; Calculate the second transmittance : ; In the formula, represents the atmospheric dissipation coefficient, represents the correction factor, They represent the brightness and maximum brightness of the image of the interior and exterior plastic parts of the car, respectively; Based on the first transmittance With the second transmittance Calculate the third transmittance : ; ; ; In the formula, represent the first adjustment parameter and the second adjustment parameter respectively; Based on the third transmittance Determine the first correction image : ; In the formula, is the calibration constant, It means enhancing the image 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 subjected to histogram equalization to obtain a balanced image, the balanced image is converted into RGB space and combined with the remaining component images of Lab space to obtain a second corrected image.

7. 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 comprises: Performing wavelet transformation on the first corrected image to obtain a first low-frequency sub-image and a first high-frequency sub-image, performing wavelet transformation on the second corrected image to obtain a second low-frequency sub-image and a second high-frequency sub-image, and weighted fusion of 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 of the second high frequency sub-image : ; ; In the formula, represents 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 the fusion trust : ; Based on the fusion trust Calculate fusion weights : ; In the formula, represents the fusion threshold; Determine the fusion trust Is it less than the fusion threshold? , if the trust is integrated 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 automobile interior and exterior plastic parts image.

8. A defect detection system for automobile interior and exterior plastic parts, characterized in that: The system comprises: A processing module, used for acquiring a target automobile interior and exterior plastic part image, and preprocessing the target automobile interior and exterior plastic part image to obtain a processed automobile interior and exterior plastic part image; An adjustment module is used to extract edges of the processed automobile interior and exterior plastic parts image to obtain an edge image, and to perform distortion adjustment on the processed automobile interior and exterior plastic parts image based on pixels in the edge image to obtain an adjusted automobile interior and exterior plastic parts image; an enhancement module, configured to perform 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, perform threshold screening on the high-frequency image component and filter processing on the low-frequency image component to obtain a screened image component and a filtered image component respectively, and determine an enhanced automobile interior and exterior plastic parts image 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 automobile interior and exterior plastic parts image, 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 automobile interior and exterior plastic parts image; 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, input the corrected images of automobile interior and exterior plastic parts into the trained preset detection model for detection, and output defect detection results.

9. A computer comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: 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 7 is implemented.

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

Citation Information

Patent Citations

  • Image processing method and device for executing the same

    CN107403412A

  • Leather identification method, device and system and computer readable storage medium

    CN112085726A

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

    CN115456876A

  • Pole piece defect detection method and device based on multi-scale wavelet transform

    CN118154518A

  • Image correction method and device, computer equipment and storage medium

    CN118429231A