A method and system for detecting automobile coating defects based on machine vision

By using machine vision technology to divide the car surface into edge and non-edge positions during the car painting process, dynamically setting weights for light intensity fitting, and combining the MacAdam ellipse theory, the problem of the influence of reflected light intensity differences at different incident angles on the car surface on detection accuracy is solved, and accurate identification of paint color difference and reliability of detection results are achieved.

CN120142303BActive Publication Date: 2025-09-19GUANGDONG ENG TREASURE TECH CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510621583.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-15
Publication Date
2025-09-19
Estimated Expiration
2045-05-15

AI Technical Summary

Technical Problem

During the automobile painting process, existing technologies fail to effectively consider the differences in reflected light intensity at different incident angles on different parts of the automobile surface, resulting in poor accuracy in the paint color difference detection results and an inability to accurately identify actual color differences and normal colors.

Method used

A machine vision-based method is used to collect light intensity values ​​at different observation angles at various locations on the vehicle surface. The surface is divided into edge and non-edge locations using an edge detection algorithm. Weights are dynamically set for weighted least squares fitting. Three-dimensional and two-dimensional Gaussian fitting is combined to obtain the actual color. Paint defect detection is then performed using the MacAdam ellipse theory.

Benefits of technology

It improves the accuracy and comprehensiveness of coating defect detection, can effectively identify coating color differences, conforms to the visual characteristics of the human eye, and ensures the accuracy of color reproduction and the reliability of detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120142303B_ABST
    Figure CN120142303B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of machine vision technology, and specifically relates to a method and system for detecting automotive paint defects based on machine vision. The method comprises: determining the edge position of an automotive surface based on an image of the automotive surface; collecting light intensity values ​​of each wavelength at each position at different observation angles; setting observation angle weights based on the distances from the edge position to the corresponding directions of each observation angle within a local range of the non-edge position; and fitting the light intensity values ​​of the target wavelength at the non-edge position at different observation angles using a weighted least squares method; slicing a three-dimensional space based on the observation angle corresponding to the maximum light intensity value of the edge position at the target wavelength and the edge at which the edge position is located; fitting the light intensity values ​​of the target wavelength at each observation angle in the sliced ​​two-dimensional plane of the edge position; obtaining the actual color of each position based on the fitting results, and performing paint defect detection. The present invention eliminates the interference of light illumination and provides more accurate paint defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of machine vision technology, and more particularly to a method and system for detecting automobile paint defects based on machine vision. Background Art

[0002] In the automotive manufacturing process, the coating process is a critical step in ensuring the vehicle's exterior quality and corrosion resistance. Color difference is one of the most common coating defects. Color difference manifests as a visual difference between the coating color and the standard color palette. Therefore, during the automotive production process, precise measurement of the coating color on various parts of the vehicle is required to determine whether the difference between the coating color and the standard color palette meets the color benchmark requirements to ensure vehicle quality.

[0003] With the rapid development of machine vision technology, automated inspection methods based on image processing have been applied to the field of automotive paint color difference detection. For example, Chinese patent application publication number CN119067942A discloses a method for detecting color difference defects in automotive paint topcoats, including: S1. Acquiring an RGB image of the tested area of ​​the automotive paint topcoat and a standard sample using a camera, and segmenting the obtained image into several regions of equal size; S2. Converting the RGB color space of the images of the standard sample area and each tested sub-region to the CIELAB color space; S3. Calculating whether the color difference between each tested sub-region and the standard sample area is within a preset range; if the color difference exceeds the preset range, the sub-region is determined to have a color defect.

[0004] The above solution fails to account for the differences in reflected light intensity across the car's surface at different angles of incidence. This difference in reflected light intensity across the car's surface can be significant at different viewing angles, resulting in inconsistent visual perception of the same color at different angles. This optical characteristic results in poor accuracy when color difference detection is performed directly on car images. Normal colors may be misidentified as color differences, and actual color differences may be masked by variations in light intensity, making accurate identification impossible. Summary of the Invention

[0005] In order to solve the above-mentioned technical problem that the difference in reflected light intensity at different incident angles at various parts of the automobile surface affects the accuracy of the detection results, the present invention provides solutions in the following aspects.

[0006] In a first aspect, the present invention provides a method for detecting automobile paint defects based on machine vision, comprising:

[0007] The light intensity values ​​of each wavelength at each position on the car surface at different observation angles are collected; the car surface image is collected, and the various positions on the car surface are divided into edge positions and non-edge positions according to the edge pixels in the car surface image; any wavelength is used as the target wavelength; for each non-edge position on the car surface, the weight of each observation angle is set according to the distance from the edge position in the local range of the non-edge position to the corresponding direction of each observation angle, and the weighted least squares method is used to perform three-dimensional Gaussian fitting on the light intensity values ​​of the target wavelength at the non-edge position at different observation angles; the actual color of the non-edge position is obtained according to the fitting result; for each edge position on the car surface, the three-dimensional space is sliced ​​according to the observation angle corresponding to the maximum light intensity value of the target wavelength at the edge position at different observation angles and the edge where the edge position is located to obtain a two-dimensional plane, and a two-dimensional Gaussian fitting is performed on the light intensity values ​​of the target wavelength at the edge position at each observation angle in the two-dimensional plane; the actual color of the edge position is obtained according to the fitting result; coating defect detection is performed according to the standard color and the actual color of each position.

[0008] The present invention is based on an image edge detection algorithm, which divides the surface of a car into edge positions and non-edge positions, providing a spatial positioning basis for subsequent processing. For non-edge positions, the present invention dynamically sets the weight coefficient of each observation angle based on the geometric relationship between the non-edge position and the surrounding edge positions. Through weighted fitting, the light intensity distribution of the non-edge position at the target wavelength is accurately restored, thereby obtaining its true color information, fully considering the difference in reflected light intensity at different incident angles at various positions on the car surface, and improving the accuracy of color restoration. For edge positions, the present invention first determines the maximum light intensity direction of the target wavelength at each observation angle at the edge position, slices the three-dimensional space in combination with the edge geometric features, reduces the problem to a two-dimensional plane, performs Gaussian fitting on the two-dimensional plane, and accurately obtains the actual color of the edge area, avoiding the influence of structural changes at the edge position on the reflected light intensity, and ensuring the accuracy of color restoration. Paint defect detection is performed based on the actual color of each position, and the detection results are more accurate.

[0009] Preferably, the observation angle refers to the direction of the received light signal, which includes three dimensions, namely, the angle between the direction of the received light signal and the positive direction of the Z axis, the angle between the direction of the received light signal and the positive direction of the X axis, and the angle between the direction of the received light signal and the positive direction of the Y axis; the coordinate system is defined as: the measured position is the origin, the tangent plane of the measured position is the XOY plane, an arbitrarily selected direction in the XOY plane is the X axis, the direction perpendicular to the X axis in the XOY plane is the Y axis, and the normal direction of the measured position is the Z axis.

[0010] Preferably, the dividing of various positions on the car surface into edge positions and non-edge positions based on edge pixels in the car surface image includes: extracting edge pixels in the car surface image using an edge detection algorithm, mapping the edge pixels in the car surface image to the car surface based on camera calibration parameters, obtaining edge positions of the car surface, and treating the remaining positions on the car surface as non-edge positions.

[0011] Preferably, the method for obtaining the weight is as follows: for any non-edge position, project each edge position of the automobile surface onto the tangent plane of the non-edge position, and in response to the absence of an edge position on the tangent plane whose distance to the non-edge position is less than a distance threshold, the weights of each observation angle are equal; conversely, the edge position on the tangent plane whose distance to the non-edge position is less than the distance threshold is used as the reference edge position; obtain the reference edge position closest to the projection direction of each observation angle on the tangent plane, obtain the angle 𝛿 between the line between the nearest reference edge position and the non-edge position and the projection direction of the corresponding observation angle on the tangent plane, and obtain the distance d from the nearest reference edge position to the projection direction of the corresponding observation angle on the tangent plane; obtain the weight factor of the corresponding observation angle based on the angle 𝛿 and the distance d, normalize the weight factor, and obtain the weight of the corresponding observation angle.

[0012] The present invention comprehensively considers the influence of angle and distance, makes the weight distribution more in line with physical laws, normalizes the weight factors, ensures the rationality of the weight distribution, and provides a data basis for the subsequent use of weighted least squares method to perform three-dimensional Gaussian fitting on the light intensity values ​​of the target wavelength at non-edge positions under different observation angles.

[0013] Preferably, the weight factor satisfies the expression: ;Use any non-edge position on the car surface as the first target position, Indicates the The weighting factor for each observation angle; Indicates the The line between the reference edge position and the first target position is The angle between the projection directions of the observation angles on the tangent plane; Indicates the Reference edge position to the The distance in the direction of projection of the observation angle on the tangent plane; represents the tangent function; represents the hyperbolic tangent function.

[0014] The present invention uses angle and distance parameters to reflect the relative position relationship between the edge position and the projection direction of the observation angle on the tangent plane. When the relative position is closer, the structural change of the edge position has a greater impact on the light intensity value in the direction corresponding to the observation angle. The smaller the weight factor, the smaller the corresponding weight. When the weighted least squares method is used to perform three-dimensional Gaussian fitting on the light intensity value of the target wavelength at a non-edge position at different observation angles, the structural change of the edge position has a smaller impact on the fitting result, thereby improving the accuracy of the fitting result and providing accurate model support for the subsequent acquisition of the actual color of the non-edge position.

[0015] Preferably, obtaining the actual color of the non-edge position based on the fitting result includes: obtaining the function value at the mean position of the three-dimensional Gaussian fitting function of the light intensity value of the non-edge position at the target wavelength as the actual light intensity value of the non-edge position at the target wavelength; converting the actual light intensity value of the non-edge position at each wavelength into the CIE-XYZ color space to obtain the actual color of the non-edge position.

[0016] Preferably, the three-dimensional space is sliced ​​to obtain a two-dimensional plane, and a two-dimensional Gaussian fitting is performed on the light intensity value of the target wavelength at each observation angle of the edge position in the two-dimensional plane, including: for any edge position, obtaining the two-dimensional plane formed by the observation angle corresponding to the maximum value of the light intensity value of the target wavelength at the edge position at all observation angles and the edge where the edge position is located, and re-establishing a rectangular coordinate system in the two-dimensional plane: taking the edge position as the origin, the tangent of the edge at the edge position as the horizontal axis, and the vertical direction of the horizontal axis as the vertical axis; converting all observation angles in the two-dimensional plane into the rectangular coordinate system of the two-dimensional plane, recorded as projected observation angles, taking the light intensity values ​​of the target wavelength at the edge position at different projected observation angles as data samples, and performing two-dimensional Gaussian fitting on the data samples using the least squares method.

[0017] The present invention slices the three-dimensional space, reduces the problem to a two-dimensional plane, and performs Gaussian fitting on the two-dimensional plane, thereby avoiding the influence of structural changes at the edge position on the intensity of reflected light at different angles, and providing model support for subsequent restoration of the edge position color based on the fitting results.

[0018] Preferably, the coating defect detection is performed based on the standard color and the actual color of each position, including: for any position on the surface of the car, in response to the actual color of the position being within the standard color, The position outside the MacAdam ellipse is marked as the coating defect position, where The default order.

[0019] Preferably, the paint defect detection is performed based on the standard color and the actual color of each position, including: for any position on the surface of the automobile, converting the light intensity value of each wavelength at the position at different observation angles into the CIE-XYZ color space to obtain the observed color of the position at different observation angles; in response to the actual color of the position being outside the 𝑚-order MacAdam ellipse of the standard color, or the actual color of the position being outside the 𝑚−1-order MacAdam ellipse of the standard color and inside the 𝑚-order MacAdam ellipse, and the observed color of the position at a certain observation angle being outside the 𝑚+1-order MacAdam ellipse of the standard color, marking the position as a paint defect position, where 𝑚 is a preset order.

[0020] This method converts the light intensity values ​​of each wavelength at different observation angles into a color space, accurately reflecting the color variation characteristics at different observation angles and improving detection accuracy. Based on the color difference theory of MacAdam ellipses, this method detects coating defects. The detection results are consistent with the visual characteristics of the human eye and can effectively identify coating defects. This method also considers the distribution of actual and observed colors within MacAdam ellipses of different orders, enabling a comprehensive assessment of coating quality.

[0021] In a second aspect, the present invention provides a machine vision-based automobile paint defect detection system, comprising a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned machine vision-based automobile paint defect detection method is implemented.

[0022] By adopting the above technical solution, the above-mentioned automobile paint defect detection method based on machine vision is generated into a computer program and stored in the memory to be loaded and executed by the processor, so that a terminal device is made based on the memory and the processor for easy use.

[0023] The beneficial effects of the present invention are as follows: the present invention fully considers the impact of changes in the vehicle's surface structure on light intensity values, dynamically sets weights for each observation angle, accurately restores the light intensity distribution at non-edge locations at the target wavelength, and obtains more accurate actual colors at non-edge locations. The present invention performs a two-dimensional Gaussian fit on the light intensity values ​​of the target wavelength at each observation angle in a two-dimensional plane at the edge location, thereby avoiding the impact of structural changes at the edge location on the reflected light intensity and ensuring the accuracy of color restoration at the edge location. The present invention uses MacAdam ellipses to determine the color difference between the actual color and the observed color at each location, effectively evaluating the changes in the vehicle's surface color at different angles and improving the accuracy and comprehensiveness of paint defect detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 is a flow chart schematically illustrating a method for detecting automobile coating defects based on machine vision in the present invention;

[0025] Figure 2 Schematic diagram showing the angle between the direction of the received optical signal and the positive direction of the Z axis;

[0026] Figure 3 Schematic diagram showing the projection of a direction maintaining the same angle with the Z axis on the XOY plane;

[0027] Figure 4 1 is a flow chart schematically illustrating step S3 of a method for detecting automobile coating defects based on machine vision in the present invention;

[0028] Figure 5 Schematic diagram of a slice is shown schematically;

[0029] Figure 6 FIG4 is a flow chart schematically illustrating step S4 of a method for detecting automobile paint defects based on machine vision in the present invention. DETAILED DESCRIPTION

[0030] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work shall fall within the scope of protection of the present invention.

[0031] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0032] The embodiment of the present invention discloses a method for detecting automobile coating defects based on machine vision, referring to Figure 1 , including steps S1 to S5:

[0033] S1. Collect the light intensity values ​​of each wavelength at different locations on the car surface at different observation angles.

[0034] Specifically, when a vehicle enters the paint color difference detection station, the vehicle positioning system accurately locates the vehicle and transmits the positioning information to the industrial robot. Based on the positioning information, the industrial robot uses a spectrophotometer to collect the light intensity values ​​of each wavelength at different observation angles at each position of the vehicle body. In the present invention, the collected wavelengths cover the visible spectrum, specifically in the range of 400-780nm, and the sampling interval within this range is 5nm.

[0035] The observation angle, as used herein, refers to the direction in which the spectrophotometer receives the light signal and is a three-dimensional data point. Specifically, during measurement, the following coordinate system is used: the measured location is the origin, the tangent plane of the measured location is the XOY plane, an arbitrarily selected direction in the XOY plane is the X-axis, the direction perpendicular to the X-axis in the XOY plane is the Y-axis, and the normal direction of the measured location is the Z-axis. The three dimensions of the observation angle are the angle between the direction of the received light signal and the positive direction of the Z-axis, the angle between the direction of the received light signal and the positive direction of the X-axis, and the angle between the direction of the received light signal and the positive direction of the Y-axis.

[0036] In the present invention, the angle between the direction of receiving the optical signal and the positive direction of the Z axis is specified as as well as 、 、 、 ,..., The implementer can set the angle between the direction of receiving the optical signal and the positive direction of the Z axis according to the actual implementation situation.

[0037] It should be noted that in space, the direction of the received light signal that maintains the same angle with the Z axis is not unique, but has a continuous circular distribution. If sampling is performed on the circumference at intervals, 72 different directions of received light signals can be obtained, and these directions all maintain the same angle with the Z axis, for example, Figure 2 Schematic diagram of the angle between the direction of the received optical signal and the positive direction of the Z axis. Figure 2 C in the middle is the direction of receiving optical signals, is the angle between the direction of the received optical signal and the positive direction of the Z axis, Figure 3 Schematic diagram of the projection of the direction maintaining the same angle with the Z axis on the XOY plane.

[0038] The implementer can set the angle between the direction of the received optical signal and the positive direction of the Z axis and the sampling interval on the circumference according to the actual implementation situation.

[0039] S2. Collecting a surface image of the car, and classifying each position on the surface of the car into an edge position and a non-edge position according to edge pixels in the surface image of the car.

[0040] Specifically, a camera is used to capture images of the car surface from multiple angles. For each image, the Canny edge detection algorithm is used to extract edge pixels. Based on the camera calibration parameters, these edge pixels are mapped to the car surface in three-dimensional space to obtain the edge locations of the car surface. The remaining locations on the car surface are considered non-edge locations.

[0041] It should be noted that edge pixels in the image are represented by pixel coordinates, while the edge positions of the car surface are represented by world coordinates. Since the distance from the camera to the car surface is known, pixel coordinates can be converted to image coordinates, image coordinates to camera coordinates, and camera coordinates to world coordinates. This allows the edge pixels in the image to be mapped to the car surface in three-dimensional space. The conversion methods between pixel coordinates, image coordinates, camera coordinates, and world coordinates are well known and will not be detailed here.

[0042] In other embodiments, implementers may select an edge detection algorithm, such as a Sobel operator, according to actual implementation conditions.

[0043] S3. Take any wavelength as the target wavelength. For each non-edge position on the car surface, use the weighted least squares method to perform three-dimensional Gaussian fitting on the light intensity value of the target wavelength at different observation angles at each non-edge position based on the distance from the edge position in the local range of the non-edge position to the direction corresponding to each observation angle. Obtain the actual color of the non-edge position based on the fitting result.

[0044] It should be noted that the light intensity distribution at each position on the car surface is a superposition of specular reflection and diffuse reflection. In specular reflection, the light intensity value in the specular reflection direction is the largest, and the light intensity values ​​in other directions are related to the angle between this direction and the specular reflection direction. The larger the angle, the smaller the light intensity value in the corresponding direction. In diffuse reflection, light is evenly scattered on the car surface, and the magnitude of the light intensity value in each direction is related to the angle between the incident direction of the light and the normal of the corresponding position on the car surface. Therefore, taking into account specular reflection and diffuse reflection, the light intensity value at each position on the car surface in the specular reflection direction is the largest. As the angle between the observation angle and the specular reflection direction increases, the light intensity value gradually decreases. Therefore, the distribution law of the light intensity value of the target wavelength at each position on the car surface at different observation angles is approximately Gaussian. The light intensity value loss in the specular reflection direction is the smallest, which can reflect the actual color of the corresponding position on the car surface. Therefore, the present invention determines the actual color of the corresponding position on the car surface based on the light intensity value in the specular reflection direction. However, since the incident direction of light at various positions on the car surface is uncertain, the direction of mirror reflection is uncertain. Therefore, the present invention performs Gaussian fitting on the light intensity values ​​of the target wavelength at various positions on the car surface at different observation angles, regards the maximum light intensity value in the fitting function as the light intensity value in the mirror reflection direction, and determines the actual color of the corresponding position on the car surface based on the maximum light intensity value in the fitting function.

[0045] Specifically, refer to Figure 4 , step S3 includes steps S301-S302:

[0046] S301 , performing three-dimensional Gaussian fitting on the light intensity values ​​of the target wavelength at the non-edge position at different observation angles using a weighted least squares method based on the distances from the edge position within the local range of the non-edge position to the directions corresponding to the observation angles.

[0047] Specifically, any non-edge position on the car surface is taken as the first target position, and the light intensity values ​​of the target wavelength at different observation angles at the first target position are taken as data samples. The data samples are subjected to three-dimensional Gaussian fitting using the least squares method. The objective function in the fitting process is:

[0048] ;

[0049] in, is the target function at the target wavelength of the first target position; The first target position is The light intensity value of the target wavelength under the observation angle; Indicates the An observation angle, Indicates the The observation angle represents the angle between the direction of the received light signal and the positive direction of the Z axis. Indicates the The observation angle represents the angle between the direction of the received light signal and the positive direction of the X axis. Indicates the The angle between the direction of the received light signal and the positive direction of the Y axis represented by the observation angle; For about The three-dimensional Gaussian function of Indicates the The weight of each observation angle; Indicates the number of observation angles.

[0050] Among them, the three-dimensional Gaussian function The expression satisfies:

[0051] ;

[0052] in, 、 、 represents the mean parameter of the three-dimensional Gaussian distribution; 、 、 represents the standard deviation parameter of the three-dimensional Gaussian distribution; represents the amplitude of the three-dimensional Gaussian distribution; Indicates the An observation angle, Indicates the The observation angle represents the angle between the direction of the received light signal and the positive direction of the Z axis. Indicates the The observation angle represents the angle between the direction of the received light signal and the positive direction of the X axis. Indicates the The observation angle represents the angle between the direction of the received light signal and the positive direction of the Y axis. 、 、 、 、 、 、 It is an unknown number.

[0053] No. The weight of the observation angle The method to obtain is:

[0054] Project the edge positions of the car surface onto the tangent plane of the first target position, and use the first target position as the center of the circle and the preset distance threshold. The circular area with a radius of is taken as the local range of the first target position. In response to the fact that there is no distance to the first target position on the cutting plane that is less than a preset distance threshold edge position, that is, there is no edge position in the local range of the first target position, then it is considered that there is no structural change around the first target position that affects the light intensity value reflected at each observation angle. At this time, the weight of each observation angle should be the same, which is , that is, The weight of the observation angle ,in Indicates the number of observation angles.

[0055] In response to the distance to the first target position on the cutting plane being less than a preset distance threshold If there is an edge position in the local range of the first target position, it is considered that there is a structural change around the first target position that affects the light intensity value reflected at the observation angle, and the distance from the tangent plane to the first target position is less than the preset distance threshold. The edge position of Project the observation angle onto the tangent plane and obtain the distance The reference edge position closest to the projection direction of the observation angle on the tangent plane is taken as the first Reference edge position, get the The line between the reference edge position and the first target position is The angle between the projection directions of the observation angles on the tangent plane is expressed as Indicates that obtaining Reference edge position to the The distance in the projection direction of the observation angle on the tangent plane is expressed as Indicates. According to the angle and distance Get the The weight factor of the observation angle is The ratio of the weight factor of the observation angle to the sum of the weight factors of all observation angles is taken as the The weight of the observation angle .

[0056] Implementers can set the distance threshold according to actual implementation conditions The value of =5cm.

[0057] Among them, The weight factor of each observation angle satisfies the expression:

[0058] ;

[0059] in, Indicates the The weighting factor for each observation angle; Indicates the The line between the reference edge position and the first target position is The angle between the projection directions of the observation angles on the tangent plane; Indicates the Reference edge position to the The distance in the direction of the projection of the observation angle on the tangent plane; represents the tangent function; represents the hyperbolic tangent function.

[0060] The edge position is the position where the car surface has structural changes. The light reflection near the edge position may be affected by the structural changes, resulting in the light intensity value at the corresponding observation angle not being consistent with the overall distribution law of the light intensity value at other observation angles at the first target position. The line between the reference edge position and the first target position is The angle between the projection directions of the observation angles on the tangent plane When it is an obtuse angle, The reference edge position is not in The projection direction of the observation angle on the tangent plane, Reference edge position to the The light intensity value of the observation angle has no effect, The more the light intensity value of each observation angle conforms to the overall distribution law of the light intensity value of each reflection direction without the influence of structural changes, the better the light intensity value of each observation angle conforms to the overall distribution law of the light intensity value of each reflection direction without the influence of structural changes. Therefore, when performing three-dimensional Gaussian fitting on the light intensity value of the target wavelength at different observation angles at the first target position, the better the light intensity value of each observation angle conforms to the overall distribution law of the light intensity value of each reflection direction without the influence of structural changes. The greater the weight of the observation angle, the greater the weight of the observation angle. The weight factor of the first observation angle is set to 1 to ensure that its weight is large. The line between the reference edge position and the first target position is The angle between the projection directions of the observation angles on the tangent plane When it is less than or equal to 90°, Structural changes in the reference edge position may have an impact on the The light intensity value of each observation angle is affected, which makes it inconsistent with the overall distribution law of the light intensity value of each reflection direction without the influence of structural changes. Reference edge position to the The smaller the distance between the projection directions of the first observation angle on the tangent plane, the smaller the The structural change of the reference edge position has an impact on the The greater the influence of the light intensity value at each observation angle, For the The reference edge position is The distance from the projection point in the projection direction corresponding to the observation angle to the first target position is smaller. The structural change of the reference edge position has an impact on the Therefore, when performing three-dimensional Gaussian fitting on the light intensity values ​​of the target wavelength at different observation angles at the first target position, the first The weight of each observation angle should be smaller, and when The smaller the value, the smaller the weight. As the first The weighting factor for each observation angle is used to ensure The smaller the value, the smaller the weight factor and the corresponding weight.

[0061] So far, we have obtained The weighting factor for each observation angle.

[0062] Furthermore, solving the objective function The smallest 、 、 、 、 、 、 , and obtain the three-dimensional Gaussian fitting function.

[0063] It should be noted that solving the unknown number when the objective function is minimized is a well-known technique in the least squares method and will not be described in detail here.

[0064] S302: Obtain the actual color of the non-edge position according to the fitting result.

[0065] It should be noted that in the Gaussian function, the function value at the mean is the largest. Therefore, the present invention obtains the maximum light intensity value in the three-dimensional Gaussian fitting function based on the function value at the mean position in the three-dimensional Gaussian fitting function of the light intensity value of the first target position at the target wavelength.

[0066] Specifically, the function value at the mean position of the three-dimensional Gaussian fitting function of the light intensity value of the first target position at the target wavelength is obtained. , as the actual light intensity value of the first target position at the target wavelength.

[0067] Similarly, the actual light intensity value of the first target position at each wavelength is obtained.

[0068] The actual light intensity value of the first target position at each wavelength is converted into the CIE-XYZ color space to obtain the actual color of the first target position.

[0069] It should be noted that converting the actual light intensity value at each wavelength into the CIE-XYZ color space is a well-known technology and will not be described in detail here.

[0070] S4. For each edge position on the automobile surface, slice the three-dimensional space according to the observation angle corresponding to the maximum light intensity value of the target wavelength at the edge position at different observation angles and the edge at which the edge position is located to obtain a two-dimensional plane, and perform a two-dimensional Gaussian fitting on the light intensity value of the target wavelength at each observation angle at the edge position in the two-dimensional plane; and obtain the actual color of the edge position based on the fitting result.

[0071] It should be noted that the structure of the edge position changes, and the structural changes of each position on the edge where the edge position is located are similar to those of the edge position. Therefore, in the surface where the edge is located, the light intensity values ​​corresponding to each observation angle are in the form of a two-dimensional Gaussian distribution. The observation angle corresponding to the maximum light intensity value at the edge position is closest to the direction of mirror reflection. Therefore, the present invention slices the three-dimensional space according to the observation angle corresponding to the maximum light intensity value and the edge where the edge position is located, and performs a two-dimensional Gaussian fit on the light intensity values ​​of the target wavelength at each observation angle in the two-dimensional plane obtained by the slice. The maximum light intensity value in the two-dimensional Gaussian fitting function is regarded as the light intensity value in the direction of mirror reflection. The actual color of the edge position of the automobile surface is determined based on the maximum light intensity value in the two-dimensional Gaussian fitting function. Figure 5 A schematic diagram of the slice. Figure 5 The coordinate origin O is the edge position, the line segment D is the edge where the edge position O is located, the hexagon A is the two-dimensional plane obtained by slicing, B2 is the observation angle corresponding to the maximum light intensity value, and B1, B2, B3, B4, and B5 are the observation angles in the two-dimensional plane.

[0072] Specifically, refer to Figure 6 , step S4 includes steps S401 and S402:

[0073] S401. Slice the three-dimensional space according to the observation angle corresponding to the maximum light intensity value of the target wavelength at the edge position at different observation angles and the edge where the edge position is located to obtain a two-dimensional plane, and perform a two-dimensional Gaussian fitting on the light intensity value of the target wavelength at each observation angle of the edge position in the two-dimensional plane.

[0074] Specifically, any edge of the vehicle surface is used as the second target location. The observation angle corresponding to the maximum light intensity of the target wavelength at all observation angles at the second target location is obtained as the target observation angle. The plane formed by the edge at the second target location and the target observation angle is obtained as the target plane. A rectangular coordinate system is re-established in the target plane: the second target location is used as the origin, the tangent line of the edge at the second target location is used as the horizontal axis, and the vertical axis is perpendicular to the horizontal axis.

[0075] It should be noted that when the edge where the second target position is located and the target observation angle cannot form a plane, the plane formed by the tangent line of the second target position on the edge and the target observation angle is used as the target plane.

[0076] All observation angles located on the target plane are converted into the rectangular coordinate system of the target plane, which are recorded as projected observation angles. The projected observation angles are two-dimensional data, and the dimensions are the angles between the observation angle and the horizontal axis of the rectangular coordinate system of the target plane, and the angles between the observation angle and the vertical axis of the rectangular coordinate system of the target plane.

[0077] The light intensity values ​​of the target wavelength at the second target position at different projection observation angles are used as data samples. The data samples are subjected to two-dimensional Gaussian fitting using the least squares method. The objective function in the fitting process is:

[0078] ;

[0079] in, is the target function at the target wavelength of the second target position; The second target position is The light intensity value of the target wavelength under the projection observation angle; Indicates the Projection viewing angle, For the The angle between the direction of the received light signal represented by the projection observation angle and the positive direction of the horizontal axis of the target plane, For the The angle between the direction of the received light signal represented by the projection observation angle and the positive direction of the longitudinal axis of the target plane; For about Two-dimensional Gaussian function of ; Indicates the number of projected viewing angles.

[0080] Among them, the two-dimensional Gaussian function The expression satisfies:

[0081] ;

[0082] in, 、 represents the mean parameter of the two-dimensional Gaussian distribution; 、 represents the standard deviation parameter of the two-dimensional Gaussian distribution; represents the amplitude of a two-dimensional Gaussian distribution; Indicates the Projection viewing angle, For the The angle between the direction of the received light signal represented by the projection observation angle and the positive direction of the horizontal axis of the target plane, For the The projection observation angle represents the angle between the direction of the received light signal and the positive direction of the longitudinal axis of the target plane. 、 、 、 、 It is an unknown number.

[0083] Furthermore, solving the objective function The smallest 、 、 、 、 , and obtain the two-dimensional Gaussian fitting function.

[0084] S402: Obtain the actual color of the edge position according to the fitting result.

[0085] Specifically, the function value at the mean position of the two-dimensional Gaussian fitting function of the light intensity value of the second target position at the target wavelength is obtained. , as the actual light intensity value of the second target position at the target wavelength.

[0086] Similarly, the actual light intensity value of the second target position at each wavelength is obtained.

[0087] The actual light intensity value of the second target position at each wavelength is converted into the CIE-XYZ color space to obtain the actual color of the target position.

[0088] S5. Perform coating defect detection based on the standard color and the actual color of each position.

[0089] It should be noted that in the CIE-XYZ color space, when two color coordinates fall within a MacAdam ellipse of order 1, 2, or 3, the human eye is almost imperceptible to the difference between the two colors. However, when two color coordinates fall within a MacAdam ellipse of order greater than 3, the human eye can perceive the difference between the two colors, and the difference becomes more pronounced as the order of the MacAdam ellipse increases. Therefore, the present invention performs automotive paint defect detection based on the positional relationship between the actual color at each location on the vehicle surface and the standard color in the CIE-XYZ color space.

[0090] In one embodiment, the method for obtaining the coating defect location is:

[0091] For any position on the car surface, the actual color of the position is within the standard color range. The actual color difference of the position outside the MacAdam ellipse can be observed by the human eye, and the position is marked as a coating defect position. is the preset order. In this embodiment , implementation personnel can set it according to actual implementation situation.

[0092] In another embodiment, the method for obtaining the coating defect position is:

[0093] For any position on the car surface, the light intensity values ​​of each wavelength at different observation angles at that position are converted into the CIE-XYZ color space to obtain the observed color of that position at different observation angles.

[0094] The actual color of the position is in the standard color The actual color difference at the position outside the MacAdam ellipse can be observed by human eyes, and the position is marked as a coating defect position;

[0095] The actual color of the position is in the standard color Within the MacAdam ellipse, the color difference at this position is invisible to the human eye, and there is no coating defect at this position;

[0096] The actual color of the position is in the standard color Inside and outside the MacAdam ellipse, The position is within the MacAdam ellipse, and the observed color at a certain observation angle is within the standard color. The actual color difference at this position is not visible to the human eye outside the MacAdam ellipse. However, at other angles, this position has a large difference from the standard color, which affects the visual effect of the car. This position is marked as a coating defect position.

[0097] The actual color of the position is in the standard color Inside and outside the MacAdam ellipse, The observed color of the position at all observation angles is within the standard color. Within the MacAdam ellipse, the actual color difference at this position is invisible to the human eye. At other angles, the difference between this position and the standard color is also very small, and there is no coating defect at this position.

[0098] in is the preset order. In this embodiment , implementation personnel can set it according to actual implementation situation.

[0099] An embodiment of the present invention also discloses a machine vision-based automobile paint defect detection system, including a processor and a memory, wherein the memory stores computer program instructions. When the computer program instructions are executed by the processor, a machine vision-based automobile paint defect detection method according to the present invention is implemented.

[0100] The above system also includes other components well known to those skilled in the art, such as a communication bus and a communication interface. The configuration and functions of these components are known in the art and will not be described in detail here.

Claims

1. A method for detecting automobile coating defects based on machine vision, characterized in that: include: Collect the light intensity values ​​of each wavelength at different locations on the car surface at different observation angles; Collecting a car surface image, dividing each position on the car surface into edge positions and non-edge positions according to edge pixels in the car surface image; and using any wavelength as a target wavelength; For each non-edge position on the surface of the car, the weight of each observation angle is set according to the distance from the edge position within the local range of the non-edge position to the corresponding direction of each observation angle. The method for obtaining the weight is as follows: for any non-edge position, each edge position on the surface of the car is projected onto the tangent plane of the non-edge position. In response to the absence of an edge position on the tangent plane whose distance to the non-edge position is less than a distance threshold, the weights of each observation angle are equal; conversely, the edge position on the tangent plane whose distance to the non-edge position is less than the distance threshold is used as the reference edge position; the reference edge position closest to the projection direction of each observation angle on the tangent plane is obtained, and the angle between the line between the closest reference edge position and the non-edge position and the projection direction of the corresponding observation angle on the tangent plane is obtained. , obtain the distance from the nearest reference edge position to the projection direction of the corresponding observation angle on the tangent plane ; According to the angle and distance Obtaining the weight factor corresponding to the observation angle, normalizing the weight factor to obtain the weight corresponding to the observation angle; performing a three-dimensional Gaussian fit on the light intensity values ​​of the target wavelength at the non-edge position at different observation angles using the weighted least squares method; and obtaining the actual color of the non-edge position based on the fitting result; For each edge position on the car surface, the three-dimensional space is sliced ​​based on the observation angle corresponding to the maximum light intensity value of the target wavelength at different observation angles at the edge position and the edge where the edge position is located to obtain a two-dimensional plane. A two-dimensional Gaussian fit is performed on the light intensity value of the target wavelength at each observation angle at the edge position in the two-dimensional plane; the actual color of the edge position is obtained based on the fitting results; Detect coating defects based on standard colors and the actual colors of each location.

2. The method for detecting automobile coating defects based on machine vision according to claim 1, characterized in that: The observation angle is the direction of the received light signal, which includes three dimensions: the angle between the direction of the received light signal and the positive direction of the Z axis, the angle between the direction of the received light signal and the positive direction of the X axis, and the angle between the direction of the received light signal and the positive direction of the Y axis. The coordinate system is defined as follows: the measured position is the origin, the tangent plane of the measured position is the XOY plane, any direction in the XOY plane is selected as the X-axis, the direction perpendicular to the X-axis in the XOY plane is the Y-axis, and the normal direction of the measured position is the Z-axis.

3. The method for detecting automobile coating defects based on machine vision according to claim 1, characterized in that: The step of dividing each position on the surface of the vehicle into edge positions and non-edge positions according to edge pixels in the vehicle surface image includes: An edge detection algorithm is used to extract edge pixels in the car surface image. Based on the camera calibration parameters, the edge pixels in the car surface image are mapped to the car surface to obtain the edge position of the car surface, and the rest of the car surface position is regarded as non-edge position.

4. The method for detecting automobile coating defects based on machine vision according to claim 1, characterized in that: The weight factor satisfies the expression: ; Take any non-edge position on the car surface as the first target position, Indicates the The weighting factor for each observation angle; Indicates the The line between the reference edge position and the first target position is The angle between the projection directions of the observation angles on the tangent plane; Indicates the Reference edge position to the The distance in the direction of the projection of the observation angle on the tangent plane; represents the tangent function; represents the hyperbolic tangent function.

5. The method for detecting automobile coating defects based on machine vision according to claim 1, characterized in that: The step of obtaining the actual color of the non-edge position according to the fitting result includes: Obtaining the function value at the mean position of the three-dimensional Gaussian fitting function of the light intensity value at the non-edge position at the target wavelength as the actual light intensity value at the non-edge position at the target wavelength; The actual light intensity values ​​at the non-edge positions at each wavelength are converted into the CIE-XYZ color space to obtain the actual colors at the non-edge positions.

6. The method for detecting automobile coating defects based on machine vision according to claim 1, characterized in that: The slicing of the three-dimensional space to obtain a two-dimensional plane and performing a two-dimensional Gaussian fitting on the light intensity value of the target wavelength at each observation angle at the edge position in the two-dimensional plane include: For any edge position, obtain the two-dimensional plane formed by the observation angle corresponding to the maximum value of the light intensity value of the target wavelength at the edge position at all observation angles and the edge where the edge position is located, and re-establish the rectangular coordinate system in the two-dimensional plane: take the edge position as the origin, the tangent of the edge at the edge position as the horizontal axis, and the vertical direction of the horizontal axis as the vertical axis; convert all observation angles located in the two-dimensional plane into the rectangular coordinate system of the two-dimensional plane, recorded as the projected observation angle, and take the light intensity value of the target wavelength at the edge position at different projected observation angles as data samples, and perform two-dimensional Gaussian fitting on the data samples using the least squares method.

7. The method for detecting automobile coating defects based on machine vision according to claim 1 or 5, characterized in that: The coating defect detection is performed based on the standard color and the actual color of each position, including: For any position on the car surface, the actual color of the position is within the standard color range. The position outside the MacAdam ellipse is marked as the coating defect position, where The default order.

8. The method for detecting automobile coating defects based on machine vision according to claim 1 or 5, characterized in that: The coating defect detection is performed based on the standard color and the actual color of each position, including: For any position on the car surface, the light intensity values ​​of each wavelength at different observation angles at that position are converted into the CIE-XYZ color space to obtain the observed color of that position at different observation angles; The actual color of the position is in the standard color The actual color of the position is outside the MacAdam ellipse, or the actual color of the position is outside the standard color. Outside the MacAdam ellipse, The position is within the MacAdam ellipse, and the observed color at a certain observation angle is within the standard color. The position outside the MacAdam ellipse is marked as the coating defect position, where The default order.

9. A machine vision-based automobile paint defect detection system, characterized in that: include: A processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a method for detecting automobile paint defects based on machine vision according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Method for detecting color difference defect of finish paint of automobile paint

    CN119067942A

  • Aluminum oxide ceramic surface processing defect detection method based on machine vision

    CN116385448A

  • Product detection method and system based on machine vision

    CN119323659A