Method and device for detecting defects on a paint surface based on a color active reference, and medium

By using image processing methods with color active reference objects, the problems of low efficiency and low accuracy in traditional paint surface defect detection have been solved, and high-precision automated detection has been achieved.

CN115760704BActive Publication Date: 2025-11-21GREAT WALL MOTOR CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211316622.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-26
Publication Date
2025-11-21
Estimated Expiration
2042-10-26

AI Technical Summary

Technical Problem

Traditional methods for detecting paint defects rely on manual visual inspection, which is inefficient, has low detection accuracy, a high rate of missed detections, and produces significantly different results for different paint colors.

Method used

An image processing method based on color active reference objects is adopted. By acquiring vehicle body images and performing preprocessing and multidimensional binarization, the color code matching relationship and limit gradient value of the color active reference objects are used to identify single-pixel level paint defects.

Benefits of technology

It improves the accuracy and efficiency of paint defect detection, can identify defects at the single pixel or even sub-pixel scale, reduces the need for training with a large number of images, and has good versatility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115760704B_ABST
    Figure CN115760704B_ABST
Patent Text Reader

Abstract

The application provides a paint defect detection method and device based on a color active reference object and a medium, and relates to the technical field of paint detection. Different to-be-detected vehicle body images are acquired, and a to-be-detected image set is generated. Each to-be-detected vehicle body image is preprocessed and subjected to multidimensional binarization processing, and fourth-layer attribute values of each pixel point in the to-be-detected vehicle body image, in addition to RGB three-layer grayscale data, are obtained. Whether a paint defect exists in the to-be-detected vehicle body image is determined according to the fourth-layer attribute values of each pixel point. The position of the paint defect of the vehicle body is determined according to the shooting time of the to-be-detected vehicle body image and the layout position of an image acquisition device used for shooting the to-be-detected vehicle body image. In the application, the required computing power for determining the type of the paint defect is small, and defects of a single pixel point or even a sub-pixel point scale can be identified, so that the identification accuracy is improved, a large number of pictures do not need to be collected and labeled for training, and the application also has good universality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of paint surface inspection technology, and in particular to a method, apparatus and medium for detecting paint surface defects based on a colored active reference. Background Technology

[0002] During the painting process on automobile bodies, defects such as "sags," "solvent spots," "bubbles," and "fine lines" frequently occur, which can be described as abnormalities in the smoothness of localized areas of the paint surface. These are abnormal areas that are either "dented" or "raised." Traditionally, these defects are inspected manually by visual inspection. The main problem is that these defects are often only reliably observed from specific angles and are often not very obvious. This requires quality inspectors to conduct detailed and repeated observations of the same area from multiple angles. This is not only time-consuming and labor-intensive but also suffers from low inspection efficiency, limited inspection range, and the risk of personnel fatigue and oversight.

[0003] In related technologies, black and white striped active reference objects are used to detect paint defects, but there are problems such as low detection accuracy, high false negative rate, and large differences in detection effect for different paint colors. Summary of the Invention

[0004] This invention provides a method, apparatus, and medium for detecting paint surface defects based on a colored active reference, aiming to solve or partially solve the problems existing in the background art.

[0005] To solve the above-mentioned technical problems, the present invention is implemented as follows:

[0006] In a first aspect, embodiments of the present invention provide a method for detecting paint surface defects based on a colored active reference, the method comprising:

[0007] Different vehicle body images to be detected are acquired, and a set of images to be detected is generated, wherein the vehicle body images to be detected contain inverted images of color active reference objects;

[0008] For each vehicle body image to be detected in the image set, the following processing is performed: the vehicle body image to be detected is preprocessed and multidimensional binarized to obtain the fourth attribute value of each pixel in the vehicle body image to be detected, in addition to the RGB three-layer grayscale data;

[0009] Based on the fourth-layer attribute values ​​of each pixel, determine whether there are paint defects in the vehicle body image to be detected;

[0010] If it is determined that there is a paint defect in the image of the vehicle body to be inspected, the location of the paint defect is determined based on the time when the image of the vehicle body to be inspected was captured and the location of the image acquisition equipment used to capture the image of the vehicle body to be inspected.

[0011] Optionally, the steps of preprocessing and multidimensional binarization of the vehicle body image to be detected to obtain the fourth-layer attribute value of each pixel in the vehicle body image in addition to the RGB three-layer grayscale data include:

[0012] The vehicle body image to be detected is converted from an RGB mode image to a Lab mode image to obtain the Lab three-dimensional values ​​of the vehicle body image to be detected.

[0013] The vehicle body image to be detected is converted from an RGB mode image to an HSV mode image to obtain the HS two-dimensional value of the vehicle body image to be detected;

[0014] Based on the relationship between the RGB three-dimensional values, Lab three-dimensional values, and HS two-dimensional values ​​of the vehicle body image to be detected and the preset threshold range, values ​​are assigned to the fourth-layer attribute values, which are initially zero, dimension by dimension.

[0015] Optionally, the step of determining whether there are paint defects in the vehicle body image to be detected based on the fourth-layer attribute values ​​of each pixel includes:

[0016] Based on the matching relationship between the fourth-layer attribute values ​​of each pixel and the color code of the color active reference, the single-pixel level paint color defects in the vehicle body image to be detected are determined.

[0017] Based on the fourth-layer attribute values ​​of each pixel, a target array is determined, and multi-pixel level paint size defects in the vehicle body image to be detected are determined based on the target array.

[0018] Optionally, the step of determining single-pixel level paint color defects in the vehicle body image to be detected based on the matching relationship between the fourth-layer attribute values ​​of each pixel and the color code of the color active reference includes:

[0019] Determine the limiting gradient values ​​of various pure colors corresponding to the colored active reference object;

[0020] The color number of each pixel is determined based on the fourth-layer attribute value of each pixel.

[0021] Iterate through each row of pixels in the vehicle body image to be detected, and determine the mixed-color pixel rows in the vehicle body image to be detected;

[0022] Based on the relationship between the extreme gradient values ​​of the mixed color pixels and the adjacent pure color pixels in the mixed color pixel row, as well as the color number matching relationship, the mixed color pixel row is filled with color, and the type of single-pixel level paint color defect in the vehicle body image to be detected is determined.

[0023] Optionally, the steps for determining the limiting gradient values ​​of various pure colors corresponding to the colored active reference object include:

[0024] Traverse every pixel in the vehicle image to be detected, determine the mixed-color pixels, and generate solid-color pixel rows based on the single-sided adjacent pixels of the mixed-color pixels.

[0025] Select two adjacent pairs of pixels of the same color from the solid color pixel row and calculate the Euclidean distance between the pairs of pixels of the same color.

[0026] Based on the calculation results of the Euclidean distance, the limiting gradient values ​​of various pure colors are determined.

[0027] Optionally, after the step of filling the mixed pixel rows, the method further includes:

[0028] Iterate through each target pixel in the vehicle image to be detected;

[0029] The color numbers of the first pixel and the second pixel are compared sequentially, where the first pixel and the second pixel are the left and right adjacent pixels of the target pixel;

[0030] Based on the color matching relationship between the first and second pixels, the type of single-pixel level paint color defect in the vehicle body image to be detected is determined.

[0031] Optionally, the steps of determining a target array based on the fourth-layer attribute values ​​of each pixel, and determining multi-pixel level paint size defects in the vehicle body image to be detected based on the target array, include:

[0032] Based on the fourth-level attribute values ​​of each pixel row in the vehicle image to be detected, generate the corresponding initial array;

[0033] Traverse the initial array and generate the target array corresponding to each pixel row based on the changing relationship of the values ​​in the initial array;

[0034] Based on the trend of changes in the values ​​in the target array and the relationship between the number of pixels and the preset threshold, the type of multi-pixel level paint size defects in the vehicle body image to be detected is determined.

[0035] Optionally, the steps of traversing the initial array and generating the target array corresponding to each pixel row based on the changes in the values ​​in the initial array include:

[0036] Iterate through all elements of the initial array;

[0037] Compare the first value corresponding to the first array element and the second value corresponding to the second array element in turn to see if they are the same, where the first array element and the second array element are any adjacent array elements;

[0038] If the first value and the second value are different, the second value is used as the first dimension of the target array, and the number of digits of the second array element in the initial array is used as the second dimension of the target array; wherein, the first dimension and the second dimension constitute the target array.

[0039] Secondly, embodiments of the present invention provide a paint surface defect detection device based on a colored active reference, the device comprising:

[0040] The acquisition module is used to acquire different images of the vehicle body to be detected and generate a set of images to be detected, wherein the images of the vehicle body to be detected contain the inverted image of a color active reference object;

[0041] The image processing module is used to process each vehicle body image to be detected in the image set as follows: preprocess and multidimensional binarization of the vehicle body image to be detected to obtain the fourth attribute value of each pixel in the vehicle body image to be detected, in addition to the RGB three-layer grayscale data.

[0042] The defect detection module is used to determine whether there are paint defects in the vehicle body image to be detected based on the fourth-layer attribute values ​​of each pixel.

[0043] The defect location determination module is used to determine the location of the paint defect on the vehicle body based on the shooting time of the vehicle body image and the location of the image acquisition device that captured the image, when it is determined that there is a paint defect in the vehicle body image to be inspected.

[0044] Optionally, the image processing module includes:

[0045] The first processing submodule is used to convert the vehicle body image to be detected from an RGB mode image to a Lab mode image to obtain the Lab three-dimensional values ​​of the vehicle body image to be detected.

[0046] The second processing submodule is used to convert the vehicle body image to be detected from an RGB mode image to an HSV mode image to obtain the HS two-dimensional value of the vehicle body image to be detected.

[0047] The assignment submodule is used to assign values ​​to the fourth-layer attribute values, which are initially zero, dimension by dimension, based on the relationship between the RGB three-dimensional values, the Lab three-dimensional values, and the HS two-dimensional values ​​of the vehicle body image to be detected and the preset threshold range.

[0048] Optionally, the defect type determination module includes:

[0049] The first defect type determination submodule is used to determine the single-pixel level paint color defects in the vehicle body image to be detected based on the matching relationship between the fourth layer attribute values ​​of each pixel and the color number of the color active reference.

[0050] The second defect type determination submodule is used to determine the target array based on the fourth-layer attribute values ​​of each pixel, and to determine the multi-pixel level paint size defects in the vehicle body image to be detected based on the target array.

[0051] Optionally, the first defect type determination submodule includes:

[0052] The limiting gradient value determination unit is used to determine the limiting gradient values ​​of various pure colors corresponding to the color active reference object.

[0053] The color number determination unit is used to determine the color number of each pixel based on the fourth-layer attribute value of each pixel.

[0054] The color mixing pixel row determination unit is used to traverse each row of pixels in the vehicle body image to be detected and determine the color mixing pixel row in the vehicle body image to be detected.

[0055] The first defect type determination unit is used to fill the mixed color pixel row with color based on the relationship between the extreme gradient values ​​of the mixed color pixels and the adjacent pure color pixels and the color number matching relationship, and to determine the type of single-pixel level paint color defect in the vehicle body image to be detected.

[0056] Optionally, the limiting gradient value determination unit includes:

[0057] The solid color pixel row determination subunit is used to traverse every pixel in the vehicle image to be detected, determine the mixed color pixels, and generate solid color pixel rows based on the single-sided adjacent pixels of the mixed color pixels.

[0058] The first calculation subunit is used to select pairs of adjacent same-color pixels from the solid-color pixel row and calculate the Euclidean distance value of the same-color pixel pair.

[0059] The second calculation subunit is used to determine the limiting gradient values ​​of various pure colors based on the calculation results of the Euclidean distance values.

[0060] Optionally, the first defect type determination submodule also includes:

[0061] The search unit is used to traverse every target pixel in the vehicle image to be detected;

[0062] The comparison unit is used to compare the color numbers of the first pixel and the second pixel in sequence, wherein the first pixel and the second pixel are the left and right adjacent pixels of the target pixel;

[0063] The second defect type determination unit is used to determine the type of single-pixel level paint color defect in the vehicle body image to be detected based on the color number matching relationship between the first pixel and the second pixel.

[0064] Optionally, the second defect type determination submodule includes:

[0065] The initial array determination unit is used to generate the corresponding initial array based on the fourth-layer attribute values ​​of each pixel row in the vehicle image to be detected.

[0066] The target array determination unit is used to traverse the initial array and generate the target array corresponding to each pixel row based on the changing relationship of the values ​​in the initial array.

[0067] The multi-pixel level paint size defect judgment unit is used to determine the type of multi-pixel level paint size defect in the vehicle body image to be detected based on the magnitude change trend of the values ​​in the target array and the relationship between the number of pixels and the preset threshold.

[0068] Optionally, the target array determination unit includes:

[0069] Array element unit, used to traverse all array elements of the initial array;

[0070] The comparison sub-unit is used to compare whether the first value corresponding to the first array element and the second value corresponding to the second array element are the same, wherein the first array element and the second array element are any adjacent array elements;

[0071] An array generation sub-unit is used to, when the first value and the second value are different, take the second value as the first dimension data of the target array and take the number of digits of the second array element in the initial array as the second dimension data of the target array; wherein, the first dimension data and the second dimension data constitute the target array.

[0072] The third aspect of the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the paint surface defect detection method based on a colored active reference object proposed in the first aspect of the present invention.

[0073] The embodiments of this invention include the following advantages: First, different images of the vehicle body to be detected are acquired, and a set of images to be detected is generated. Each image in the set contains an inverted image of a colored active reference object. Each image in the set is then processed as follows: preprocessing and multidimensional binarization are performed to obtain a fourth-layer attribute value for each pixel in the image, in addition to the RGB three-layer grayscale data. Then, based on the fourth-layer attribute value of each pixel, it is determined whether a paint defect exists in the image. Finally, if a paint defect is determined to exist in the image, the location of the paint defect is determined based on the shooting time of the image and the location of the image acquisition device used to capture it. In this application, the computational power required to determine paint defects is low, and defects at the single-pixel or even sub-pixel scale can be identified, thereby improving the accuracy of the identification. It does not require collecting and labeling a large number of images for training and also has good versatility.

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

[0075] Figure 1 This is a schematic diagram of the application environment in an embodiment of the present invention;

[0076] Figure 2 This is a flowchart of the steps of a paint surface defect detection method based on a colored active reference in an embodiment of the present invention;

[0077] Figure 3 This is a schematic diagram of the external structure of the active reference object in an embodiment of the present invention;

[0078] Figure 4 This is a schematic diagram of an active reference object in the form of a colored LED flexible silicone light strip array in an embodiment of the present invention;

[0079] Figure 5 This is a schematic diagram of an active reference object in the form of a color filter mounted on the emitting surface of a common white surface light source in an embodiment of the present invention;

[0080] Figure 6 This is a schematic diagram of an active reference object in the form of a display in an embodiment of the present invention;

[0081] Figure 7 This is a schematic diagram of another paint surface defect detection device based on a colored active reference in an embodiment of the present invention. Detailed Implementation

[0082] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0083] In related technologies, when using black and white stripes to detect paint defects on vehicles, it is first necessary to train a deep learning algorithm that achieves the defect detection function using a dataset consisting of a large amount of defect data. Then, the trained deep learning algorithm is used to detect paint defects on the vehicle.

[0084] However, the above-mentioned solutions face the problem of difficulty in collecting training samples and poor versatility, and may only be applicable to one type of vehicle and not to other types of vehicles. Based on this, the inventors proposed the inventive concept of this application: to use a novel active reference object for optical vision enhancement, and to construct an image processing method with low computing power requirements, no need to collect and label a large number of images for training, and high recognition accuracy.

[0085] First, the application environment of this application is described. Vehicles that need to be inspected for paint defects move in a straight line at a constant speed along an assembly line guide. A proximity sensor is installed on one side of the assembly line guide. Multiple industrial cameras and multiple active reference objects are installed on both sides and above the assembly line guide.

[0086] As an example, refer to Figure 1 The system for detecting paint defects based on color active reference objects according to this application is described below. First, the vehicle 1 to be inspected is placed on the assembly line guide rail 2 and moves in a straight line at a constant speed. Then, a proximity sensor 3 is installed on one side of the assembly line guide rail 2, and multiple industrial cameras 5 and multiple active reference objects 6 are installed on both sides and above the assembly line guide rail 2. The optical axis of the industrial camera 5 and the light-emitting surface of the active reference object 6 are both pointed towards the body of the vehicle 1 to be inspected, so that when the industrial camera acquires an image of the vehicle to be inspected, the color active reference object will form an inverted image in the paint image of the vehicle. The output signal of the sensor 3 is connected to the industrial control computer 4, and the industrial camera 5 is connected to the industrial control computer 4 through a data cable.

[0087] This invention provides a method for detecting paint surface defects based on a colored active reference object. (See also...) Figure 2 The industrial control computer used in the aforementioned paint defect detection system Figure 2 This application illustrates a flowchart of a paint surface defect detection method based on a colored active reference, comprising the following steps:

[0088] S201: Acquire different vehicle body images to be detected and generate a set of images to be detected.

[0089] In this embodiment, the trigger signal refers to the signal generated by the proximity sensor when the vehicle to be inspected moves along the assembly line guide rail. The trigger signal is sent from the proximity sensor to the industrial control computer. Upon receiving the trigger signal, the industrial control computer controls the industrial camera to acquire an image of the vehicle body to be inspected. It should be noted that the image of the vehicle body to be inspected is an image of the paint surface of the vehicle, and according to the principle of optical imaging, a color active reference object will form an inverted image in the vehicle's paint surface image. Then, images of the vehicle body to be inspected acquired by industrial cameras at different locations at different times are obtained, thereby generating an image set to be inspected.

[0090] In one feasible implementation, multiple light-emitting strips of equal width but different colors are arranged side by side on a plane of one side of the colored active reference object.

[0091] In this embodiment, the active reference is a light emitter, the specific structure of which is as follows: Figure 3 As shown. Several equally wide light-emitting strips are installed side-by-side on one side of the plane. The light-emitting strips have at least three colors, and the number and arrangement of the colors are determined by the user's settings. All strips are arranged in a fixed color order. The light-emitting strips can be, but are not limited to, the following forms: a) a colored LED flexible silicone light strip array, such as... Figure 4 As shown in Figure b, a colored filter is installed on the emitting surface of a regular white surface light source, such as... Figure 5 As shown; c, various types of displays such as LCD, etc. Figure 6 As shown.

[0092] S202: For each vehicle body image to be detected in the image set, perform the following processing: preprocess and multidimensional binarization processing on the vehicle body image to be detected to obtain the fourth attribute value of each pixel in the vehicle body image to be detected, in addition to the RGB three-layer grayscale data.

[0093] In this embodiment, each vehicle body image captured by the industrial camera needs to undergo corresponding image preprocessing. The specific process is as follows: the vehicle body image is cropped according to a pre-defined image area, which is the detection range. Pixels outside the defined area are replaced with transparent pixels. Then, the processed image undergoes multi-dimensional binarization. Each RGB mode image contains at least R, G, and B color attribute values. The fourth layer of attribute values ​​refers to attribute values ​​other than R, G, and B. The specific steps can be as follows:

[0094] S202-1: Convert the vehicle body image to be detected from RGB mode image to Lab mode image to obtain the Lab three-dimensional value of the vehicle body image to be detected.

[0095] In this embodiment, Lab consists of one luminance channel and two color channels. In the Lab color space, each color is represented by three numbers: L, a, and b. The meanings of each component are as follows: a represents the luminance from green to red, and b represents the luminance from blue to yellow.

[0096] As an example, for any pixel A, its corresponding RGB three-dimensional value is (R, G, B). According to the conversion formula between RGB three-dimensional value and Lab three-dimensional value, the Lab three-dimensional value (L, X, Y) corresponding to pixel A can be obtained, thus generating the Lab three-dimensional value of pixel A.

[0097] S202-2: Convert the vehicle body image to be detected from RGB mode image to HSV mode image to obtain the HS two-dimensional value of the vehicle body image to be detected.

[0098] In this embodiment, HSV stands for Hue, Saturation, and Value.

[0099] As an example, for any pixel A, its corresponding RGB three-dimensional value is (R, G, B). According to the conversion formula between RGB three-dimensional value and HSV three-dimensional value, the HSV three-dimensional value (h, s, v) corresponding to pixel A can be obtained. In the original code, only the two values ​​h and s are retained, thus generating the HSV two-dimensional value of pixel A.

[0100] S202-3: Based on the relationship between the RGB three-dimensional values ​​of the vehicle body image to be detected, the Lab three-dimensional values ​​of the vehicle body image to be detected, and the HS two-dimensional values ​​of the vehicle body image to be detected and the preset threshold range, assign values ​​to the fourth-layer attribute values, which have an initial value of zero, dimension by dimension.

[0101] In this embodiment, the RGB, Lab, and HS values ​​are pre-divided into threshold ranges, with each threshold range corresponding to a dimension. After obtaining the Lab 3D value, HS 2D value, and RGB 3D value for each pixel, the corresponding fourth-layer attribute value needs to be determined based on the correspondence between the Lab 3D value, HS 2D value, and RGB 3D value for each pixel and the preset threshold range.

[0102] This can be achieved by: determining the threshold range level of each channel value of each pixel, then determining whether all channels are in the same threshold range level. If all channels are in the same threshold range level, then assigning the magnitude corresponding to that threshold range level to the pixel. If all channels are not in the same threshold range level, then determining the fourth-layer attribute value of the pixel based on the threshold range level of each channel.

[0103] As an example, the Lab 3D value (L, X, Y) corresponding to pixel A, the RGB 3D value (R, G, B), and the HS value (H, S) are assigned according to the following logic.

[0104] It should be noted that there are three Lab channels, two HS channels, and three RGB channels, for a total of eight channels. For each channel, multiple threshold ranges are set. For example, for the R channel, since the color value range is [0, 255], its multiple threshold ranges can be [0, 10] as the first range, [15, 20] as the second range, [25, 30] as the third range, and so on. The threshold ranges for other channels are similar.

[0105] First, determine the relationship between the RGB 3D values ​​(R, G, B) and the preset upper limit. If (RZ>R)&(GZ>G)&(BZ>B), the corresponding 4th layer value is 0, where RZ, GZ, and BZ are the preset upper limits. If the above condition is not met, continue to determine the relationship between the RGB 3D values ​​(R, G, B), the Lab 3D values ​​(L, X, Y), and the HS values ​​(H, S) and the preset interval thresholds.

[0106] If (RH0>R>RL0)&(GH0>G>GL0)&(BH0>B>BL0)&(LH0>L>LL0)&(XH0>X>XL0)&(YH0>Y>YL0)&(HH0>H>HL0)&(SH0>S>SL0), the corresponding value for the 4th layer is a; where RH0 and RL0 correspond to the upper and lower limit thresholds of the first interval level of the R channel, GH0 and GL0 correspond to the upper and lower limit thresholds of the first interval of the G channel, BH0 and BL0 correspond to the upper and lower limit thresholds of the first interval of the B channel, LH0 and LL0 correspond to the upper and lower limit thresholds of the first interval of the L channel, XH0 and XL0 correspond to the upper and lower limit thresholds of the first interval of the L channel, YH0 and YL0 correspond to the upper and lower limit thresholds of the first interval of the Y channel, HH0 and HL0 correspond to the upper and lower limit thresholds of the first interval of the H channel, and SH0 and SL correspond to the upper and lower limit thresholds of the first interval of the S channel. If the values ​​of the eight channels of a pixel, namely the RGB three-dimensional value (R, G, B), the Lab three-dimensional value (L, X, Y), and the HS value (H, S), are all within the upper and lower limits of their respective preset first interval levels, then the corresponding fourth layer value 'a' will be assigned to that pixel.

[0107] If the judgment conditions of the first interval level are not met, the judgment of the second interval level continues. GH1 and GL1 correspond to the upper and lower limit thresholds of the second interval of the G channel; BH1 and BL1 correspond to the upper and lower limit thresholds of the second interval of the B channel; LH1 and LL1 correspond to the upper and lower limit thresholds of the second interval of the L channel; XH1 and XL1 correspond to the upper and lower limit thresholds of the second interval of the L channel; YH1 and YL1 correspond to the upper and lower limit thresholds of the second interval of the Y channel; HH1 and HL1 correspond to the upper and lower limit thresholds of the second interval of the H channel; and SH1 and SL correspond to the upper and lower limit thresholds of the second interval of the S channel. That is, if the values ​​of the eight channels of the pixel, namely the RGB three-dimensional value (R, G, B), the Lab three-dimensional value (L, X, Y), and the HS value (H, S), are all within the upper and lower limit thresholds of their respective preset second interval levels, then the corresponding fourth layer value of b is assigned to the pixel.

[0108] Up to the nth interval level, if (RHn>R>RLn)&(GHn>G>GLn)&(BHn>B>BLn)&(LHn>L>LLn)&(XHn>X>XLn)&(YHn>Y>YLn)&(HHn>H>HLn)&(SHn>S>SLn), the corresponding value for the nth layer is n. If it was already a non-zero value before, then the corresponding value is directly 250. Here, GHn and GLn correspond to the nth level of the G channel. The upper and lower limit thresholds for N intervals are defined as follows: BHn and BLn correspond to the upper and lower limit thresholds of the Nth interval of the B channel; LHn and LLn correspond to the upper and lower limit thresholds of the Nth interval of the L channel; XHn and XLn correspond to the upper and lower limit thresholds of the Nth interval of the L channel; YHn and YLn correspond to the upper and lower limit thresholds of the Nth interval of the Y channel; HHn and HLn correspond to the upper and lower limit thresholds of the Nth interval of the H channel; and SHn and SL correspond to the upper and lower limit thresholds of the Nth interval of the S channel.

[0109] In other cases, the corresponding value for the 4th layer is 250. That is, for pixel A, only if the values ​​of each of its channels are within the same range can its corresponding value for the 4th layer be the given value of that range. In other cases, its corresponding value for the 4th layer is 250.

[0110] S203: Determine whether there are paint defects in the vehicle body image to be detected based on the fourth layer attribute values ​​of each pixel.

[0111] In this embodiment, after obtaining the fourth-layer attribute values ​​of each pixel in each vehicle body image to be inspected, it is possible to determine whether there are paint defects in the vehicle body image to be inspected based on the fourth-layer attribute values ​​of each pixel. The specific steps are as follows:

[0112] S203-1: Based on the matching relationship between the fourth-layer attribute values ​​of each pixel and the color code of the color active reference, determine the single-pixel level paint color defects in the vehicle body image to be detected.

[0113] In this embodiment, single-pixel level paint color defects can be divided into two types: single-pixel scale level paint smoothness abnormality defects and paint color abnormality or surface roughness abnormality defects. The step of determining whether single-pixel level paint color defects exist in the vehicle image to be detected may include:

[0114] S203-1-1: Determine the limiting gradient values ​​of various pure colors corresponding to the color active reference object.

[0115] In this embodiment, the step of determining the limiting gradient values ​​of various pure colors corresponding to the colored active reference object may include:

[0116] S203-1-1-1: Traverse every pixel in the vehicle image to be detected, determine the mixed-color pixels, and generate a row of pure-color pixels based on the adjacent pixels on one side of the mixed-color pixels.

[0117] S203-1-1-2: Select two adjacent pairs of pixels of the same color from the solid color pixel row and calculate the Euclidean distance value of the pairs of pixels of the same color.

[0118] S203-1-1-3: Determine the limiting gradient values ​​for various pure colors based on the calculation results of the Euclidean distance values.

[0119] In the embodiments S203-1-1-1 to S203-1-1-3, a mixed-color pixel refers to a pixel whose color number is different from that of its left and right adjacent pixels. If N consecutive pixels to the right of a mixed-color pixel have the same color number, then these N consecutive pixels to the right of the mixed-color pixel are extracted to generate a pure-color pixel row. Conversely, if N consecutive pixels to the left of a mixed-color pixel have the same color number, then these N consecutive pixels to the left of the mixed-color pixel are extracted to generate a pure-color pixel row. Then, for each pair of adjacent pixels of the same color in the pure-color pixel row, their Euclidean distance is calculated, and these results are included in the dispersion result statistics table of the pure color corresponding to the pure-color pixel row. After completing the traversal, the expected value and standard deviation of all the average distribution fitting results in the dispersion result statistics table of each pure color are calculated. Finally, the expected value plus three times the standard deviation is used as the limiting gradient value of the pure color for each pair of pure-color pixel rows. The Euclidean distance is calculated as follows: for pixel points A(R1,G1,B1) and B(R2,G2,B2), the corresponding Euclidean distance value is ((R1-R2)^2+(G1-G2)^2+(B1-B2)^2)^0.5.

[0120] S203-1-2: Determine the color number of each pixel based on the fourth-layer attribute values ​​of each pixel.

[0121] In this embodiment, the colors of the vehicle paint are defined as follows: Pure color pixels, color codes: Pixels with fourth-layer values ​​of 0, a, b..., n are called pure color pixels. The specific value divided by the corresponding value is the color attribute code of that pixel. This is abbreviated as color code, for example: color 0, color 1, color 2..., color n. It should be noted that the color code matches the color of the light-emitting band. Same color: Two pixels with the same color code are the same color; Different colors: Two different color codes are different colors; Adjacent colors: According to the arrangement of the color bands, the colors of two adjacent color bands are adjacent colors. It should be noted that color 0 and other color codes both have adjacent colors, corresponding to two cases: color 0 on the left and color 0 on the right. This is because sheet metal seams or openings may be located anywhere on the color band. Intermediate color: A third color that may appear in the transition area between these two color bands is called the intermediate color between these two adjacent colors; Mixed color: A color with a value of 250 is called n+1 color or mixed color.

[0122] S203-1-3: Traverse each row of pixels in the vehicle body image to be detected and determine the mixed-color pixel rows in the vehicle body image to be detected.

[0123] In this embodiment, after obtaining the color number attribute of each pixel, the system traverses each row of pixels in the vehicle body image to be detected, and searches for mixed-color pixel rows in the vehicle body image to be detected. A mixed-color pixel row is a pixel row with consecutive mixed-color pixels.

[0124] As an example, if pixels B, C, and D are consecutive mixed-color pixels, then the pixel row consisting of B, C, and D is a mixed-color pixel row, and the left adjacent solid-color pixel of the mixed-color pixel row is A, and the right adjacent solid-color pixel is E.

[0125] S203-1-4: Based on the relationship between the extreme gradient values ​​of the mixed color pixels and the adjacent pure color pixels in the mixed color pixel row and the color number matching relationship, the mixed color pixel row is filled with color, and the type of single-pixel level paint color defect in the vehicle body image to be detected is determined.

[0126] In this embodiment, the above-described example will continue to be used. Starting from the mixed color pixel B, the following logic will be followed one by one from left to right to make judgments. The mixed color pixel to be judged is defined as pixel o, and o-1 and o+1 represent the left and right adjacent pixels of pixel o.

[0127] First, if o-1 is an empty pixel or o is the first pixel in the current row, then skip the current iteration and proceed to the next iteration. Both o-1 being an empty pixel and o being the first pixel in the current row indicate that pixel o is located at the very edge of the image.

[0128] Then, if pixel o-1 is another solid color pixel, the Euclidean distance between pixel o and pixel o-1 is calculated, and there are several possible cases:

[0129] Case 1: If the gradient value is less than the limit gradient value corresponding to color number o-1, then the color number of pixel o is corrected to be the same as that of pixel o-1.

[0130] Case 2: If the gradient value is greater than or equal to the extreme gradient value corresponding to color number o-1, and the adjacent pure color pixel A on the left and the adjacent pure color pixel E on the right of the mixed color pixel row are adjacent or intermediate colors, then continue to determine the trend direction of pixel o: that is, determine that the Euclidean distance between "the adjacent pure color pixel E on the right of the mixed color pixel row and pixel o" is less than the Euclidean distance between "the adjacent pure color pixel E on the right of the mixed color pixel row and pixel o-1". Furthermore, the Euclidean distance between "pixel o-1 and pixel o" is less than the Euclidean distance between "the adjacent pure color pixel E on the right of the mixed color pixel row and pixel o-1".

[0131] If the above trend direction judgment conditions are met, then pixel o is considered to be a pixel with the same edge color, so the current traversal is terminated. At the same time, the color number of pixel o is corrected to the color number of A.

[0132] If the above trend direction judgment conditions are not met, then pixel o is considered to be an edge-mixed pixel. At the same time, the color number of pixel o will be corrected to the color number of A, and o will be marked as a defective pixel. The current traversal will be terminated directly.

[0133] Case 3: If the gradient value is greater than or equal to the limiting gradient value corresponding to the color number of pixel o-1, and A and E are not adjacent or intermediate colors, then change pixel o to the same color as A, mark pixel o as a defective pixel, and exit the current traversal.

[0134] Case 4: If a solid color pixel E or another solid color pixel is reached, the current traversal will be terminated.

[0135] The second traversal begins after exiting the previous traversal. The process and conditions are the same as the first traversal, except the traversal direction is changed. Specifically, o+1 replaces o-1, pixel A is swapped with pixel E, and the traversal direction is changed to right to left. After completing these two traversals, the color filling process for the mixed-color pixel rows is finished. Traversing the AB pixel interval, if there are still mixed-color pixels, they are directly identified as defective pixels and marked as defect 1. Defect 1 refers to abnormal paint surface smoothness at the single-pixel scale, such as small-radius paint spots or other paint surface defects.

[0136] In one feasible implementation, after completing the color filling process for the mixed-color pixel rows, the pixels in the vehicle body image to be detected that cannot be filled are then subjected to intermediate color correction. The specific steps can be as follows:

[0137] Iterate through each target pixel in the vehicle image to be detected;

[0138] Compare the color numbers of the first and second pixels sequentially;

[0139] Based on the color matching relationship between the first and second pixels, the type of single-pixel level paint color defect in the vehicle body image to be detected is determined.

[0140] In this embodiment, the vehicle body image to be detected is traversed. The target pixel refers to the middle segment pixel in each pixel row excluding the first and last pixels. For each target pixel, the first pixel and the second pixel are the left and right adjacent pixels of the target pixel. That is, if the target pixel is o, then the first pixel and the second pixel are o-1 and o+1. Then, based on the color number of pixel o-1 and pixel o+1, the following logical judgment is performed to determine the type of single-pixel level paint color defect in the vehicle body image to be detected.

[0141] The specific judgment logic can be as follows: First, determine whether pixel o-1 and pixel o+1 belong to the same color number as pixel o. If they are the same color number, then skip pixel o.

[0142] If pixels o-1 and o+1 have the same color number, but are different from the color number of pixel o, then the color number of pixel o is changed to the color number of pixel o+1, and the pixel is marked as defect 1.

[0143] If pixel o is the intermediate color between pixel o-1 and a certain solid color (color A), then determine whether pixel o+1 is color A or the same color as pixel o. If not, then mark pixel o as defect 1.

[0144] If o+1 is the same color as pixel o, then continue to identify whether o+2 is color A or the same color as o, and so on. This continues until o+n is found to be the same color as A. Then, take pixels o to o+n-1 and perform color separation correction. Simultaneously, if n is greater than a threshold, then pixel o is marked as defect 2. Defect 2 is a single-pixel level paint color defect, specifically an abnormal paint color or surface roughness defect, such as paint color cast or scratches from polishing.

[0145] S203-2: Determine the target array based on the fourth-layer attribute values ​​of each pixel, and determine the multi-pixel level paint size defects in the vehicle body image to be detected based on the target array.

[0146] In this embodiment, for the determination of paint surface size defects, only the fourth layer attribute values ​​of the image are retained. The rotation angle is determined according to the configuration information, the vehicle body image to be inspected is rotated, and then sequence extraction and defect detection are performed. The specific steps are as follows:

[0147] S203-2-1: Generate the corresponding initial array based on the fourth-layer attribute values ​​of each pixel row in the vehicle image to be detected.

[0148] In the implementation method, each pixel row in the vehicle image to be detected is extracted into an initial array F. The initial array F is a one-dimensional matrix, and each element in the one-dimensional matrix is ​​the fourth-level attribute value for each pixel row.

[0149] S203-2-2: Traverse the initial array and generate the target array corresponding to each pixel row based on the changing relationship of the values ​​in the initial array.

[0150] In the implementation method, the step of determining the target array corresponding to each pixel row based on the changing relationship of the initial array values ​​can be as follows:

[0151] S203-2-2-1: Traverse all elements of the initial array;

[0152] S203-2-2-3: Compare the first value corresponding to the first array element and the second value corresponding to the second array element in turn to see if they are the same, where the first array element and the second array element are any adjacent array elements;

[0153] S203-2-2-4: When the first value and the second value are different, the second value is used as the first dimension of the target array, and the number of digits of the second array element in the initial array is used as the second dimension of the target array; wherein, the first dimension and the second dimension constitute the target array.

[0154] In the implementations of S203-2-2-1 to S203-2-2-4, the initial array F is traversed. For each element in the initial array F, the value in the target array is determined by comparing the numerical values ​​of its adjacent elements. First, if the first value corresponding to the first element and the second value corresponding to the second element are the same, they are ignored. Whenever a value changes, the changed value is used as the first dimension of the two-dimensional array, and the number of digits of that element in the initial array F is used as the second dimension of the two-dimensional array, thus obtaining the target array E.

[0155] S203-2-3: Based on the trend of changes in the value in the target array and the relationship between the number of pixels and the preset threshold, determine the type of multi-pixel level paint size defects in the vehicle body image to be detected.

[0156] In this embodiment, the types of multi-pixel level paint surface size defects include three types: abnormal paint surface smoothness, abnormal paint surface moderate curvature, and abnormal paint surface large curvature. For defect determination, the number of adjacent pixels in the target array is first sorted by size. When the multiple of the largest number divided by the smallest number is greater than a first preset threshold, the type of paint surface size defect is determined to be defect 3, which is an abnormal paint surface smoothness defect, such as paint drips. When the number of consecutive decreases exceeds a second preset threshold, the type of paint surface size defect is determined to be defect 4, which is an abnormal paint surface moderate curvature defect, such as sheet metal deformation. When the decrease in the initial array E exceeds a third preset threshold or the increase exceeds a fourth preset threshold, and the number of pixels corresponding to the first and second pixels is required, the type of paint surface size defect is determined to be defect 5, which is an abnormal paint surface large curvature defect, such as paint drips.

[0157] S204: If it is determined that there is a paint defect in the vehicle body image to be inspected, the location of the paint defect on the vehicle body shall be determined according to the shooting time of the vehicle body image to be inspected and the location of the image acquisition equipment that took the image of the vehicle body image to be inspected.

[0158] In this embodiment, once it is determined that there is a paint defect in the image of the vehicle body to be inspected, the specific location of the paint defect can be determined based on the position of the industrial camera that took the image and the time of the shooting, and the detection result of the defect at that location on the vehicle body can be output.

[0159] This application employs a novel rainbow stripe pattern texture design for active reference objects. Compared to ordinary surface light sources or ordinary striped active reference objects, it possesses richer textures, fully utilizing color information for modulation while maintaining structural symmetry. This translates to a larger sampling bandwidth for the detection area, allowing for the acquisition of more effective detection information when processing the same amount of image data. Consequently, it reduces the system's requirements for the number and performance of image acquisition and data processing equipment, resulting in lower hardware costs and higher system reliability. Furthermore, based on the expansion of information dimensions through color information under the same grayscale conditions, it enhances the dynamic range of parameters measuring defect severity, thereby improving the accuracy and sensitivity of defect detection. The symmetry characteristics of structured light significantly reduce the imaging blind zone of defects, lowering the probability of missed detections. Moreover, based on the three-dimensional properties of the color gamut, it ensures compatibility with different paint colors without adaptive adjustments to the hardware system, overcoming the impact of different paint colors on detection performance. By identifying the color gamut coordinates of different imaging points within the defect area, the curvature parameters of the imaging points can be reconstructed. Correspondingly, it enables the system to identify subtle defects. It allows for the detection of subtle defects and makes it easier to quantitatively assess the severity of defects.

[0160] This invention also provides a paint surface defect detection device based on a colored active reference object, with reference to... Figure 7 The diagram illustrates a functional block diagram of a paint surface defect detection device based on a color active reference, which may include the following modules:

[0161] The acquisition module 701 is used to acquire different images of the vehicle body to be detected and generate a set of images to be detected, wherein the images of the vehicle body to be detected contain the inverted image of a color active reference object;

[0162] The image processing module 702 is used to perform the following processing on each vehicle body image to be detected in the image set to be detected: preprocessing and multidimensional binarization processing on the vehicle body image to be detected to obtain the fourth attribute value of each pixel in the vehicle body image to be detected in addition to the RGB three-layer grayscale data;

[0163] The defect judgment module 703 is used to determine whether there are paint defects in the vehicle body image to be detected based on the fourth-layer attribute values ​​of each pixel.

[0164] The defect location determination module 704 is used to determine the location of the paint defect on the vehicle body based on the shooting time of the vehicle body image and the location of the image acquisition device that captured the vehicle body image, when it is determined that there is a paint defect in the vehicle body image to be inspected.

[0165] In one feasible implementation, the image processing module includes:

[0166] The first processing submodule is used to convert the vehicle body image to be detected from an RGB mode image to a Lab mode image to obtain the Lab three-dimensional values ​​of the vehicle body image to be detected.

[0167] The second processing submodule is used to convert the vehicle body image to be detected from an RGB mode image to an HSV mode image to obtain the HS two-dimensional value of the vehicle body image to be detected.

[0168] The assignment submodule is used to assign values ​​to the fourth-layer attribute values, which are initially zero, dimension by dimension, based on the relationship between the RGB three-dimensional values, the Lab three-dimensional values, and the HS two-dimensional values ​​of the vehicle body image to be detected and the preset threshold range.

[0169] In one feasible implementation, the defect type determination module includes:

[0170] The first defect type determination submodule is used to determine the single-pixel level paint color defects in the vehicle body image to be detected based on the matching relationship between the fourth layer attribute values ​​of each pixel and the color number of the color active reference.

[0171] The second defect type determination submodule is used to determine the target array based on the fourth-layer attribute values ​​of each pixel, and to determine the multi-pixel level paint size defects in the vehicle body image to be detected based on the target array.

[0172] In one feasible implementation, the first defect type determination submodule includes:

[0173] The limiting gradient value determination unit is used to determine the limiting gradient values ​​of various pure colors corresponding to the color active reference object.

[0174] The color number determination unit is used to determine the color number of each pixel based on the fourth-layer attribute value of each pixel.

[0175] The color mixing pixel row determination unit is used to traverse each row of pixels in the vehicle body image to be detected and determine the color mixing pixel row in the vehicle body image to be detected.

[0176] The first defect type determination unit is used to fill the mixed color pixel row with color based on the relationship between the extreme gradient values ​​of the mixed color pixels and the adjacent pure color pixels and the color number matching relationship, and to determine the type of single-pixel level paint color defect in the vehicle body image to be detected.

[0177] In one feasible implementation, the limiting gradient value determination unit includes:

[0178] The solid color pixel row determination subunit is used to traverse every pixel in the vehicle image to be detected, determine the mixed color pixels, and generate solid color pixel rows based on the single-sided adjacent pixels of the mixed color pixels.

[0179] The first calculation subunit is used to select pairs of adjacent same-color pixels from the solid-color pixel row and calculate the Euclidean distance value of the same-color pixel pair.

[0180] The second calculation subunit is used to determine the limiting gradient values ​​of various pure colors based on the calculation results of the Euclidean distance values.

[0181] In one feasible implementation, the first defect type determination submodule further includes:

[0182] The search unit is used to traverse every target pixel in the vehicle image to be detected;

[0183] The comparison unit is used to compare the color numbers of the first pixel and the second pixel in sequence, wherein the first pixel and the second pixel are the left and right adjacent pixels of the target pixel;

[0184] The second defect type determination unit is used to determine the type of single-pixel level paint color defect in the vehicle body image to be detected based on the color number matching relationship between the first pixel and the second pixel.

[0185] In one feasible implementation, the second defect type determination submodule includes:

[0186] The initial array determination unit is used to generate the corresponding initial array based on the fourth-layer attribute values ​​of each pixel row in the vehicle image to be detected.

[0187] The target array determination unit is used to traverse the initial array and generate the target array corresponding to each pixel row based on the changing relationship of the values ​​in the initial array.

[0188] The multi-pixel level paint size defect judgment unit is used to determine the type of multi-pixel level paint size defect in the vehicle body image to be detected based on the magnitude change trend of the values ​​in the target array and the relationship between the number of pixels and the preset threshold.

[0189] Optionally, the target array determination unit includes:

[0190] Array element unit, used to traverse all array elements of the initial array;

[0191] The comparison sub-unit is used to compare whether the first value corresponding to the first array element and the second value corresponding to the second array element are the same, wherein the first array element and the second array element are any adjacent array elements;

[0192] An array generation sub-unit is used to, when the first value and the second value are different, take the second value as the first dimension data of the target array and take the number of digits of the second array element in the initial array as the second dimension data of the target array; wherein, the first dimension data and the second dimension data constitute the target array.

[0193] Based on the same inventive concept, in another embodiment of the present invention, a computer-readable storage medium is provided, storing a computer program, which, when executed by a processor, implements the paint surface defect detection method based on a colored active reference object proposed in the first aspect of the present invention.

[0194] Based on the same inventive concept, another embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0195] Memory, used to store computer programs;

[0196] When a processor executes a program stored in a memory, it implements the paint surface defect detection method based on a color active reference object proposed in the first aspect of the present invention or the second aspect of the present invention.

[0197] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of representation, only one thick line is used in the diagram, but this does not indicate that there is only one bus or one type of bus. The communication interface is used for communication between the aforementioned terminal and other devices. The memory can include Random Access Memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory can also be at least one storage system located remotely from the aforementioned processor.

[0198] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0199] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable vehicles (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0200] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A system that specifies functions in one or more boxes.

[0201] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including an instruction set implemented in a process. Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0202] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0203] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. "And / or" indicates that either one or both can be chosen. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0204] The foregoing has provided a detailed description of the paint surface defect detection method, apparatus, and medium based on a colored active reference object provided by the present invention. Specific examples have been used to illustrate the principle and implementation of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation and application scope based on the idea of ​​the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for detecting paint surface defects based on a colored active reference, characterized in that, The method includes: Different vehicle body images to be detected are acquired, and a set of images to be detected is generated, wherein the vehicle body images to be detected contain inverted images of a color active reference object; For each vehicle body image in the image set to be detected, the following processing is performed: The vehicle body image to be detected is preprocessed and subjected to multidimensional binarization to obtain the fourth-layer attribute values ​​of each pixel in the vehicle body image, in addition to the RGB three-layer grayscale data. This includes: converting the vehicle body image to be detected from an RGB mode image to a Lab mode image to obtain the Lab three-dimensional value of the vehicle body image; converting the vehicle body image to be detected from an RGB mode image to an HSV mode image to obtain the HSV two-dimensional value of the vehicle body image; and assigning values ​​to the fourth-layer attribute values, which initially have a value of zero, dimension by dimension, based on the relationship between the RGB three-dimensional value of the vehicle body image, the Lab three-dimensional value of the vehicle body image, the HSV two-dimensional value of the vehicle body image, and the preset threshold range. Determining whether there are paint defects in the vehicle body image to be detected based on the fourth-layer attribute values ​​of each pixel includes: determining single-pixel level paint color defects in the vehicle body image to be detected based on the color code matching relationship between the fourth-layer attribute values ​​of each pixel and the color active reference object; determining a target array based on the fourth-layer attribute values ​​of each pixel, and determining multi-pixel level paint size defects in the vehicle body image to be detected based on the target array. If it is determined that there is a paint defect in the vehicle body image to be inspected, the location of the paint defect is determined based on the shooting time of the vehicle body image to be inspected and the location of the image acquisition device that took the image.

2. The paint surface defect detection method based on a color active reference as described in claim 1, characterized in that, The steps for determining single-pixel level paint color defects in the vehicle body image to be detected based on the matching relationship between the fourth-layer attribute values ​​of each pixel and the color code of the color active reference object include: Determine the limiting gradient values ​​of various pure colors corresponding to the color active reference object; The color number of each pixel is determined based on the fourth-layer attribute value of each pixel. Traverse each row of pixels in the vehicle body image to be detected, and determine the mixed-color pixel row in the vehicle body image to be detected; Based on the relationship between the extreme gradient values ​​of the mixed color pixels and the adjacent pure color pixels in the mixed color pixel row and the color number matching relationship, the mixed color pixel row is filled with color, and the type of single-pixel level paint color defect in the vehicle body image to be detected is determined.

3. The paint surface defect detection method based on a colored active reference as described in claim 2, characterized in that, The steps for determining the limiting gradient values ​​of various pure colors corresponding to the color active reference object include: Traverse each pixel of the vehicle image to be detected, determine the mixed-color pixel, and generate a solid-color pixel row based on the single-sided adjacent pixels of the mixed-color pixel. Select two adjacent pairs of pixels of the same color from the solid color pixel row and calculate the Euclidean distance value of the pairs of pixels of the same color. Based on the calculation results of the Euclidean distance value, the limiting gradient values ​​of the various pure colors are determined.

4. The paint surface defect detection method based on a color active reference as described in claim 2, characterized in that, After the step of filling the mixed-color pixel row, the method further includes: Iterate through each target pixel in the vehicle image to be detected; The color numbers of the first pixel and the second pixel are compared sequentially, wherein the first pixel and the second pixel are the left and right adjacent pixels of the target pixel; Based on the color matching relationship between the first pixel and the second pixel, the type of paint color defect at the single pixel level in the vehicle body image to be detected is determined.

5. The paint surface defect detection method based on a color active reference as described in claim 1, characterized in that, The steps of determining a target array based on the fourth-layer attribute values ​​of each pixel, and determining multi-pixel level paint size defects in the vehicle body image to be detected based on the target array, include: Based on the fourth-layer attribute values ​​of each pixel row in the vehicle body image to be detected, a corresponding initial array is generated; Traverse the initial array and generate the target array corresponding to each pixel row according to the changing relationship of the values ​​in the initial array; Based on the magnitude change trend of the values ​​in the target array and the relationship between the number of pixels and the preset threshold, the type of multi-pixel level paint size defects in the vehicle body image to be detected is determined.

6. The paint surface defect detection method based on a color active reference as described in claim 5, characterized in that, The step of traversing the initial array and generating the target array corresponding to each pixel row based on the changing relationships of the values ​​in the initial array includes: Iterate through all elements of the initial array; Compare the first value corresponding to the first array element and the second value corresponding to the second array element in turn to see if they are the same, wherein the first array element and the second array element are any adjacent array elements; If the first value is different from the second value, the second value is used as the first dimension of the target array, and the number of digits of the second array element in the initial array is used as the second dimension of the target array; wherein the first dimension and the second dimension constitute the target array.

7. A paint surface defect detection device based on a color active reference, characterized in that, The device includes: The acquisition module is used to acquire different images of the vehicle body to be detected and generate a set of images to be detected, wherein the images of the vehicle body to be detected include inverted images of a color active reference object; The image processing module is used to preprocess and perform multidimensional binarization processing on each vehicle body image to be detected in the image set to be detected, to obtain the fourth-layer attribute values ​​of each pixel in the vehicle body image to be detected in addition to the RGB three-layer grayscale data, including: converting the vehicle body image to be detected from an RGB mode image to a Lab mode image to obtain the Lab three-dimensional value of the vehicle body image to be detected; converting the vehicle body image to be detected from an RGB mode image to an HSV mode image to obtain the HSV two-dimensional value of the vehicle body image to be detected; and assigning values ​​to the fourth-layer attribute values, which are initially zero, dimension by dimension according to the relationship between the RGB three-dimensional value of the vehicle body image to be detected, the Lab three-dimensional value of the vehicle body image to be detected, the HSV two-dimensional value of the vehicle body image to be detected, and a preset threshold range. The defect judgment module is used to determine whether there are paint defects in the vehicle body image to be detected based on the fourth-layer attribute values ​​of each pixel, including: determining single-pixel level paint color defects in the vehicle body image to be detected based on the color code matching relationship between the fourth-layer attribute values ​​of each pixel and the color active reference object; determining a target array based on the fourth-layer attribute values ​​of each pixel, and determining multi-pixel level paint size defects in the vehicle body image to be detected based on the target array; The defect location determination module is used to determine the location of the paint defect on the vehicle body based on the shooting time of the vehicle body image and the location of the image acquisition device that captured the vehicle body image, when it is determined that there is a paint defect in the vehicle body image to be inspected.

8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the paint surface defect detection method based on a color active reference as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Surface defect inspection system and method

    CA2251323A1

  • Resolution correction method and device based on sub-pixel level visual positioning technology

    CN111415314A