Object surface defect detection method and system and computer readable storage medium

By acquiring surface images under multi-angle light sources, and using the Lambertian reflection model and Gaussian filtering, a reflection map is generated and defects are detected. This solves the problems of insignificant defect features and missed detection in existing technologies, and achieves efficient and accurate detection of surface defects.

CN120997150APending Publication Date: 2025-11-21GREE ELECTRIC APPLIANCE INC OF ZHUHAI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511092543.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-05
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

Existing methods for detecting surface defects cannot effectively highlight defect features and are prone to missing defects. Deep learning models rely on dataset consistency, while traditional image processing algorithms have significant limitations.

Method used

By acquiring multiple surface images of an object under light sources from different directions, the illumination vector and grayscale value are determined using the Lambertian reflection model, Gaussian filtering is performed, and image fusion and adaptive algorithms are combined to generate a reflection map and detect defects.

Benefits of technology

It improves the accuracy and robustness of surface defect detection, enhances the prominence of defect features, reduces the false negative rate, and lowers the waste and cost of light source resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120997150A_ABST
    Figure CN120997150A_ABST
Patent Text Reader

Abstract

The invention provides an object surface defect detection method and system and a computer readable storage medium. The method comprises the steps that a plurality of surface images of an object under light sources in different directions are collected through an image collection device, illumination vectors corresponding to the surface images are determined, and the illumination vectors are obtained according to the position relation among the light sources, the image collection device and the object; determining gray values of the surface images by adopting a Lambert reflection model through the illumination vectors, and determining a reflection map of the object at least according to the gray values corresponding to the surface images; and performing Gaussian filtering processing on the reflection image to obtain a response result image, and detecting the defect of the object according to the response result image. The problems that an existing object surface detection scheme cannot effectively highlight defect characteristics, and defect missing detection is prone to occurring are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of surface defect detection technology, and more specifically, to a surface defect detection method, a surface defect detection system, and a computer-readable storage medium. Background Technology

[0002] Current technologies for detecting surface defects mainly rely on deep learning or improved image processing algorithms. While deep learning-based methods can achieve high accuracy in detecting surface defects and detect most surface defects, deep learning models are affected by the dataset and require the collection of surface defects with good consistency. At the same time, traditional image processing algorithms have limitations in handling surface defects and cannot perform good post-processing on all defects, which can easily lead to missed defects. Summary of the Invention

[0003] The main objective of this application is to provide a method, system and computer-readable storage medium for detecting defects on the surface of an object, so as to at least solve the problem that existing surface inspection schemes cannot effectively highlight defect features and are prone to missing defects.

[0004] To achieve the above objectives, according to one aspect of this application, a method for detecting surface defects of an object is provided, comprising: acquiring multiple surface images of an object under light sources from different directions using an image acquisition device, and determining illumination vectors corresponding to the multiple surface images, wherein the illumination vectors are obtained based on the positional relationship between the light source, the image acquisition device, and the object; determining the grayscale values ​​of the surface images using the illumination vectors and employing a Lambertian reflection model, and determining a reflection map of the object based at least on the grayscale values ​​corresponding to each of the surface images; performing Gaussian filtering on the reflection map to obtain a response result image, and detecting defects of the object based on the response result image.

[0005] Optionally, the reflection image is subjected to Gaussian filtering to obtain a response result image, including: generating a filter kernel based on Gaussian filtering, rotating the filter kernel according to a preset rotation rule to obtain multiple target filter kernels with different rotation directions; using each of the target filter kernels to filter the reflection image to obtain multiple sub-response result images, and weighted summing the multiple sub-response result images to obtain the response result image.

[0006] Optionally, determining the illumination vectors corresponding to multiple surface images includes: determining the illumination angle when the image acquisition device acquires the surface image, wherein the illumination angle includes a first illumination angle and a second illumination angle, the first illumination angle being the angle between a first line and a second line, the first line representing the line connecting the center point of the light source and the center point of the object, the second line representing the line connecting the center point of the camera in the image acquisition device and the center point of the object, and the second illumination angle representing the angle between the first line and the coordinate axis; and determining the illumination vector corresponding to the surface image based on the first illumination angle and the second illumination angle.

[0007] Optionally, determining the reflection map of the object based at least on the grayscale values ​​corresponding to each of the surface images includes: determining the surface normal vector of the object; determining the generalized reflectivity of the object based on the illumination vector corresponding to the surface image, the grayscale values, and the surface normal vector; and using the generalized reflectivity to determine the reflectivity results of each pixel on the surface of the object to obtain the reflection map.

[0008] Optionally, determining the reflectance result of each pixel on the surface of the object using the generalized reflectance to obtain the reflection map includes: fusing each of the surface images using an image fusion algorithm to obtain a surface fused image; and determining the reflectance result of the object based on the surface fused image and the generalized reflectance to obtain the reflection map.

[0009] Optionally, after determining the reflection map of the object, the method further includes: adjusting the contrast of the reflection map using an adaptive algorithm; detecting defects of the object based on the response result image, including: inputting the response result image into a defect detection model to obtain a defect detection result of the object.

[0010] Optionally, acquiring multiple surface images of an object under light sources from different directions using an image acquisition device includes: controlling the rotation of a rotatable structure so that a light source mounted on the rotatable structure rotates along a preset direction, and acquiring multiple surface images of the object under light sources from different directions using the image acquisition device.

[0011] According to another aspect of this application, a surface defect detection system for an object is provided, comprising: a processor for executing any of the surface defect detection methods described above; and a defect detection device, wherein the defect detection device is located above the object, the defect detection device including a rotatable structure, a light source, and an image acquisition device, the light source being mounted on the rotatable structure, and the image acquisition device being used to acquire an image of the surface of the object.

[0012] Optionally, the defect detection device further includes an infrared sensor mounted on the rotatable structure to determine when the light source has rotated to a preset position.

[0013] According to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored program, wherein, when the program is executed, it controls the device where the computer-readable storage medium is located to perform any of the described object surface defect detection methods.

[0014] This application utilizes a technical solution to acquire multiple surface images of an object under different directional light sources using an image acquisition device. The illumination vectors corresponding to these surface images are then determined, based on the positional relationship between the light source, the image acquisition device, and the object. Using the illumination vectors, a Lambertian reflection model is employed to determine the grayscale values ​​of the surface images. At least based on the grayscale values ​​of each surface image, a reflection map of the object is determined. Gaussian filtering is applied to the reflection map to obtain a response image, which is then used to detect defects in the object. By using the Lambertian reflection model to determine the relationship between the illumination vectors and image grayscale values ​​from object surface images acquired under different light sources, the reflection characteristics of the object surface are determined, resulting in a reflection map. This solution increases the accuracy and robustness of surface defect detection by fusing images from multiple light sources. Gaussian filtering of the reflection map effectively highlights surface defects, solving the problem that existing object surface detection schemes cannot effectively highlight defect features and are prone to missed defects. Attached Figure Description

[0015] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0016] Figure 1 A schematic flowchart of a method for detecting surface defects of an object according to an embodiment of this application is shown;

[0017] Figure 2 A front view of an object surface defect detection provided according to an embodiment of this application is shown;

[0018] Figure 3 A top view of an object surface defect detection method provided according to an embodiment of this application is shown;

[0019] Figure 4 A schematic diagram of the structure of an object surface defect detection system provided according to an embodiment of this application is shown;

[0020] Figure 5A schematic flowchart of a specific object surface defect detection method provided according to an embodiment of this application is shown;

[0021] Figure 6 A structural block diagram of an object surface defect detection device provided according to an embodiment of this application is shown.

[0022] The above figures include the following reference numerals:

[0023] 1. Processor; 2. Defect detection device; 21. Rotatable structure; 22. Light source; 23. Image acquisition device; 24. Infrared sensor; 3. Object; 41. First position; 42. Second position; 43. Third position; 44. Fourth position; 61. First determining unit; 62. Second determining unit; 63. Detection unit. Detailed Implementation

[0024] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0025] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0026] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0027] As described in the background section, existing object surface detection schemes cannot effectively highlight defect features and are prone to missing defects. To solve the problem that existing object surface detection schemes cannot effectively highlight defect features and are prone to missing defects, embodiments of this application provide an object surface defect detection method, an object surface defect detection system, and a computer-readable storage medium.

[0028] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.

[0029] This embodiment provides a method for detecting surface defects of an object that runs on a mobile terminal, computer terminal, or similar computing device. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0030] Figure 1 This is a flowchart of a method for detecting surface defects of an object according to an embodiment of this application. Figure 1 As shown, the method includes the following steps:

[0031] Step S201: The image acquisition device acquires multiple surface images of the object under light sources from different directions, and determines the illumination vectors corresponding to the multiple surface images. The illumination vectors are obtained based on the positional relationship between the light source, the image acquisition device and the object.

[0032] The image acquisition device is a camera;

[0033] Step S202: Using the above illumination vector, the grayscale value of the above surface image is determined by the Lambertian reflection model, and the reflection map of the above object is determined at least based on the grayscale value corresponding to each of the above surface images.

[0034] Step S203: Perform Gaussian filtering on the above reflection image to obtain a response result image, and detect defects in the above object based on the above response result image.

[0035] In this embodiment, by applying steps S201, S202, and S203, the relationship between the illumination vector and the image grayscale value is determined using the Lambertian reflection model based on object surface images acquired under different light sources. This determines the reflection characteristics of the object surface and obtains a reflection map. This embodiment uses image fusion algorithms from multiple light sources to obtain the reflection map, increasing the accuracy and robustness of surface defect detection. By applying Gaussian filtering to the reflection map, the purpose of highlighting surface defects in the image is achieved. This solves the problem that existing object surface detection schemes cannot effectively highlight defect features and are prone to missing defects.

[0036] In the specific implementation process, the above reflection image is subjected to Gaussian filtering to obtain the response result image, including: generating a filter kernel based on Gaussian filtering, rotating the filter kernel according to a preset rotation rule to obtain multiple target filter kernels with different rotation directions; using each of the above target filter kernels to filter the above reflection image to obtain multiple sub-response result images, and weighted summing the multiple sub-response result images to obtain the above response result image.

[0037] The preset rotation rule can be set to be between 0° and 180°, rotating the filter kernel every 30° to obtain 6 target filter kernels with different rotation directions. These 6 target filter kernels with different rotation directions are used to filter the reflection image to obtain 6 sub-response result images. By assigning weights to the sub-response result images, the weighted sum is obtained to obtain the final response result image.

[0038] This method highlights surface defects at different angles by adjusting the direction and weights of the Gaussian filter kernel. Rotation and weighted summation of the Gaussian filter kernel control the filtering effect at different angles, thereby optimizing defect detection performance. It effectively enhances the contrast of surface defects, improving the accuracy and efficiency of defect detection.

[0039] Specifically, determining the illumination vectors corresponding to multiple surface images includes: determining the illumination angle when the image acquisition device acquires the surface images, wherein the illumination angle includes a first illumination angle and a second illumination angle, the first illumination angle being the angle between a first line and a second line, the first line representing the line connecting the center point of the light source and the center point of the object, the second line representing the line connecting the center point of the camera in the image acquisition device and the center point of the object, and the second illumination angle representing the angle between the first line and the coordinate axis; and determining the illumination vectors corresponding to the surface images based on the first illumination angle and the second illumination angle.

[0040] Among them, the first illumination angle Slant is as follows Figure 2 As shown, the image acquisition device is located directly above the object, and the second illumination angle (Tilt) is as follows: Figure 3 As shown;

[0041] The illumination vector is I L = (vx, vy, vz);

[0042] Where, vx = sin(Slant)*cos(Tilt), vy = Sin(Slant)*sin(Slant), vz = cos(Slant).

[0043] This method ensures the accuracy of the illumination vector by precisely calculating the illumination angle, thereby improving the performance of the photometric stereo algorithm. In principle, the calculation of the illumination vector is based on the geometric relationship between the light source, the object, and the image acquisition device, ensuring the scientific validity and effectiveness of the algorithm. The technique in this embodiment can precisely control the angle of the light source, improving the quality of image acquisition and thus enhancing the accuracy of surface defect detection.

[0044] More specifically, determining the reflection map of the object based at least on the gray values ​​corresponding to each of the aforementioned surface images includes: determining the surface normal vector of the object; determining the generalized reflectivity of the object based on the illumination vector corresponding to the aforementioned surface image, the aforementioned gray values, and the aforementioned surface normal vector; and using the aforementioned generalized reflectivity to determine the reflectivity results of each pixel on the surface of the object to obtain the aforementioned reflection map.

[0045] Given the three-dimensional coordinate function of an object's surface as z = f(x, y), then the surface normal vector... The calculation results are as follows: The relationship between the illumination vector and the image grayscale value is determined based on the Lambertian reflection model. Then, the generalized reflectivity of the object is determined based on the illumination vector, grayscale value, and surface normal vector, according to the system of equations:

[0046] Determine the generalized reflectivity ρ′ of the object, and I1, I2, I3, and I4 are the gray values ​​corresponding to the surface images acquired by the light source at four different locations.

[0047] [Lx 1 Ly 1 Lz 1 ]、[Lx 2 Ly 2 Lz 2 ]、[Lx 3 Ly 3 Lz 3 ]、[Lx 4 Ly 4 Lz 4 These are the illumination vectors of the light source at four different locations. This is the unit surface normal vector of the object.

[0048] This method achieves an accurate description of the reflective properties of an object's surface by calculating generalized reflectivity. In principle, the calculation of generalized reflectivity is based on the Lambertian reflection model and illumination vectors, ensuring the accuracy and reliability of the reflectance map. In terms of effectiveness, the technique in this embodiment can generate high-quality reflectance maps, providing a solid foundation for subsequent defect detection.

[0049] Further, the reflectance result of each pixel on the surface of the object is determined by the generalized reflectance to obtain the reflection map, including: fusing the surface images of each of the above-mentioned surfaces by using an image fusion algorithm to obtain a surface fused image; and obtaining the reflection map based on the surface fused image and the generalized reflectance result of the object.

[0050] This method effectively integrates images from multiple light sources using an image fusion algorithm. The algorithm generates a fused image based on information from multiple images, employing methods such as weighted summation to ensure the comprehensiveness and accuracy of the reflectance map. This approach generates clearer and more comprehensive reflectance maps, providing richer information for subsequent defect detection.

[0051] Furthermore, after determining the reflection image of the object, the method further includes: adjusting the contrast of the reflection image using an adaptive algorithm; detecting defects in the object based on the response result image, including: inputting the response result image into a defect detection model to obtain the defect detection result of the object.

[0052] This method adjusts the contrast of the reflectance image using an adaptive algorithm, thereby highlighting surface defect features. The adaptive algorithm adjusts the contrast according to the local characteristics of the image, ensuring the prominence of defect features. In terms of effectiveness, the technique in this embodiment can significantly enhance the contrast of defect features, improving the accuracy and efficiency of defect detection. In other embodiments, other image enhancement techniques, such as histogram equalization and local contrast enhancement, can also be used to address the problem of indistinct defect features in low-contrast environments.

[0053] Specifically, acquiring multiple surface images of an object under light sources from different directions using an image acquisition device includes: controlling the rotation of a rotatable structure so that a light source mounted on the rotatable structure rotates along a preset direction, and acquiring multiple surface images of the object under light sources from different directions using the image acquisition device.

[0054] This method automates the adjustment of the light source's position and orientation by controlling the rotation of a rotatable structure. In principle, the adjustment of the light source's position and orientation is based on the mechanical movement of the rotatable structure, ensuring precise control of the light source's direction. This solution improves image acquisition efficiency, reduces human error, and thus enhances the accuracy and efficiency of surface defect detection.

[0055] In addition, this embodiment also includes a deep learning-based defect feature enhancement mechanism. In the post-processing stage, besides traditional contrast adjustment and weighted filtering, a deep learning model is introduced to enhance the features of the fused image. This model can be a pre-trained convolutional neural network (CNN), trained to learn how to extract and enhance surface defect features from photometric stereo images. For example, a deep learning model with a U-Net architecture can be used to perform pixel-level feature extraction and enhancement, further highlighting defect areas and reducing the false negative rate in post-processing steps.

[0056] Defect feature enhancement mechanisms based on deep learning can perform deeper analysis and processing of defect features in images, significantly improving the accuracy and robustness of defect detection. Deep learning models can learn more complex feature representations and have better adaptability to different types of surface defects, thereby improving the comprehensiveness and efficiency of the detection system.

[0057] This embodiment also provides a surface defect detection system for objects, such as Figure 4 As shown, it includes:

[0058] Processor 1 is used to execute any of the above-described methods for detecting surface defects in objects;

[0059] The processor can be an industrial computer, which is responsible for implementing the surface defect detection method. The image acquisition device, light source, and rotatable structure are connected to the industrial computer for communication. The image acquisition device is used to acquire images from multiple light sources.

[0060] The defect detection device 2 is located above the object 3. The defect detection device 2 includes a rotatable structure 21, a light source 22, and an image acquisition device 23. The light source 22 is mounted on the rotatable structure 21, and the image acquisition device 23 is used to acquire the surface image of the object 3.

[0061] The image acquisition device is a camera, which is installed directly above the object;

[0062] By integrating a processor and a defect detection device, an automated surface defect detection system was constructed. The processor executes the defect detection algorithm, while the defect detection device provides image acquisition and light source control functions, ensuring the system's efficient operation. In terms of effectiveness, the technology in this embodiment can construct a complete automated surface defect detection system, achieving efficient and accurate detection of surface defects. Furthermore, only one light source is installed on the rotatable structure; the rotation allows for defect detection under different light sources, reducing waste of light source assets, improving image acquisition efficiency, increasing the time required for the pre-processing image acquisition steps of the photometric stereo algorithm, and reducing costs.

[0063] Specifically, such as Figure 4 As shown, the defect detection device 2 also includes an infrared sensor 24, which is mounted on the rotatable structure 21 and is used to determine when the light source 22 rotates to a preset position.

[0064] Among them, such as Figure 4 As shown, the preset positions set in this embodiment include a first position 41, a second position 42, a third position 43, and a fourth position 44.

[0065] The infrared sensor in this system is used for position detection of a movable bar light source. When the bar light source moves to a designated position (preset position), it sends a signal to the industrial control computer. The movable bar light source is used to illuminate an image of a defect on the surface of an object at a certain angle, which facilitates the search for defect feature information after image fusion.

[0066] By using an infrared sensor to obtain the position of the light source and trigger the camera to take pictures, the problem of time-consuming and error-prone manual image acquisition is solved, realizing automated image acquisition under multi-directional light source illumination. In terms of effect, the technology in this embodiment can improve the accuracy of light source position detection and reduce the error of light source position control, thereby improving the accuracy and efficiency of surface defect detection.

[0067] To enable those skilled in the art to better understand the technical solution of this application, the implementation process of the object surface defect detection method of this application will be described in detail below with reference to specific embodiments.

[0068] While existing deep learning-based solutions can achieve high accuracy in detecting surface defects and detect most surface defects, deep learning models are affected by the dataset and require consistent sampling of surface defects. Meanwhile, traditional image processing algorithms have limitations in handling surface defects, failing to perform adequate post-processing for all defects and prone to missed detections. Traditional photometric stereo algorithms require three or more light sources to illuminate and photograph from different directions, and the short-lived use of multiple light sources largely results in resource waste.

[0069] To address the issue of using multiple light sources for multi-directional lighting, a structure with a multi-directionally movable light source is adopted. By using a combination of timing and sensors to obtain the desired position of the light source, images of the object's surface are acquired under different light sources. Compared to manually changing light sources at different angles and then taking pictures, this embodiment can control the on / off state of different light sources through sensors, saving time. This embodiment can improve shooting efficiency by achieving angle image acquisition and precise position calculation for multiple light sources, while also reducing the number of light sources used and lowering costs.

[0070] To address the limitations of traditional image processing in effectively highlighting defect features and the reliance of deep learning on high-quality datasets, this embodiment proposes an improved photometric stereo algorithm. This algorithm generates a reflective image through the fusion of multiple images, performs contrast adjustment, and incorporates multi-angle weighted filtering to highlight defects at specific angles. This results in enhanced defect feature highlighting, improving the accuracy of defect detection and the robustness of the algorithm.

[0071] This embodiment relates to a specific method for detecting surface defects. By using a movable light source structure combined with sensors for automated multi-directional light source image acquisition, it reduces waste of light source assets and achieves efficient image acquisition, improving the time required for the pre-acquisition steps of the photometric stereo algorithm and reducing costs. Based on the traditional photometric stereo algorithm, a post-processing step of adjusting the contrast of the generated fused image and a multi-angle weighted filtering technique are added. This allows for highlighting defect features in different areas or from different angles as needed, increasing the accuracy and efficiency of defect detection. Figure 5 As shown, it includes the following:

[0072] (1) Using a movable ring mechanism (rotatable structure), after communicating with an industrial control computer (processor) by moving the strip light source and infrared sensor fixed on the mechanism, a camera is used to continuously take pictures of the surface of the object under light sources from different directions.

[0073] (2) Calculate the incident angle for the multiple saved images, based on... Figure 2 and Figure 3 The schematic diagram shown illustrates the calculation of a photometric stereo light source, which calculates the illumination angles Slant and Tilt from multiple images, thereby realizing the incident light vector I. L The calculation of (vx, vy, vz);

[0074] vx = sin(Slant) * cos(Tilt);

[0075] vy = Sin(Slant) * sin(Slant);

[0076] vz = cos(Slant).

[0077] (3) The relationship between the incident angle and the image gray value is calculated based on the Lambert reflection model: I0=ρI L cosθ;

[0078] Where ρ is the surface reflectance constant of the object, I LLet be the incident light vector (including intensity and direction), θ (Slant) be the angle between the incident angle and the object surface normal vector, and I0 be the grayscale value after imaging. When the three-dimensional coordinate function of the object surface is known as z = f(x,y), then the surface normal vector... The calculation results are as follows:

[0079] (4) Based on the formula derived from the Lambertian reflection model, assuming the gradient of the object's surface in the x-direction is p, the gradient in the y-direction is q, the illumination vector is L(lx, ly, lz), and N is the surface normal vector, the following formula is given:

[0080]

[0081] Where ρ′ is the generalized reflectivity, L′ is the unit direction vector of the light source, and N′ is the unit normal vector of the object surface. Solve the system of equations for the three unknowns p, q, and L:

[0082] The generalized reflectance of the object is calculated as: ρ′=||L -1 The generalized reflectivity of an object is obtained by taking the L2 norm of the product of the inverse matrix of the illumination vector L and the gray value matrix I.

[0083] The reflectance of each pixel on the object's surface is calculated based on the generalized reflectance obtained from the solution, which is the reflectance map of the photometric stereo.

[0084] (5) Based on the reflectance map calculated by photometric stereo, the contrast of the reflectance map is adaptively adjusted to obtain a suitable defect highlighting result;

[0085] (6) Generate the filter kernel according to the Gaussian filtering method, and then rotate it every 30° from 0° to 180° to generate filter kernels with different rotation directions. Different weights are assigned to filter kernels in different directions, and the defect highlighting weights at different angles are adjusted based on the weight results. i The final filtered response result F is obtained.

[0086] in, δ is the standard deviation of the Gaussian filter kernel, μ is the average value of the Gaussian filter kernel, and x represents the position of a pixel in the reflection image relative to the center point of the image in the x-direction.

[0087] n represents the number of times the filter kernel rotates between 0° and 180°, i.e., n = 6.

[0088] (7) Defect detection is performed on the final response result image F.

[0089] This embodiment combines an improved photometric stereo algorithm to acquire images of the object surface from multiple angles, performs image fusion, and then applies post-processing such as contrast adjustment and surface defect filtering to highlight surface defects. This solves the problem that existing object surface detection schemes cannot effectively highlight defect features and are prone to missing defects.

[0090] This application also provides a surface defect detection device. It should be noted that the surface defect detection device of this application can be used to execute the surface defect detection method provided in this application. This device is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0091] The following describes the object surface defect detection device provided in the embodiments of this application.

[0092] Figure 6 This is a schematic diagram of a surface defect detection device according to an embodiment of this application. Figure 6 As shown, the device includes:

[0093] The first determining unit 61 is used to acquire multiple surface images of an object under light sources in different directions through an image acquisition device, and to determine the illumination vectors corresponding to the multiple surface images, wherein the illumination vectors are obtained based on the positional relationship between the light source, the image acquisition device and the object.

[0094] The second determining unit 62 is used to determine the gray value of the surface image by using the Lambertian reflection model through the illumination vector, and to determine the reflection pattern of the object based at least on the gray value corresponding to each of the surface images.

[0095] The detection unit 63 is used to perform Gaussian filtering on the above reflection image to obtain a response result image, and to detect defects in the above object based on the above response result image.

[0096] In this embodiment, the first determining unit is used to acquire multiple surface images of an object under light sources from different directions using an image acquisition device, and determine the illumination vectors corresponding to the multiple surface images. The illumination vectors are obtained based on the positional relationship between the light source, the image acquisition device, and the object. The second determining unit is used to determine the grayscale values ​​of the surface images using the illumination vectors and a Lambertian reflection model, and to determine the reflection map of the object based at least on the grayscale values ​​corresponding to each surface image. The detection unit is used to perform Gaussian filtering on the reflection map to obtain a response result image, and to detect defects in the object based on the response result image. By using the Lambertian reflection model to determine the relationship between the illumination vector and the image grayscale values ​​based on the object surface images acquired under different light sources, and then determining the reflection characteristics of the object surface to obtain the reflection map, this scheme increases the accuracy and robustness of surface defect detection by fusing image algorithms from multiple light sources. By performing Gaussian filtering on the reflection map, the purpose of highlighting surface defects in the image is achieved. This solves the problem that existing object surface detection schemes cannot effectively highlight defect features and are prone to missing defects.

[0097] As an optional scheme, the detection unit includes a rotation processing module and a filtering processing module; the rotation processing module is used to generate a filter kernel based on Gaussian filtering, and rotate the filter kernel according to a preset rotation rule to obtain multiple target filter kernels with different rotation directions; the filtering processing module is used to filter the reflection image with each of the target filter kernels to obtain multiple sub-response result images, and weighted summation of the multiple sub-response result images to obtain the response result image.

[0098] In one optional scheme, the first determining unit includes a first determining module and a second determining module; the first determining module is used to determine the illumination angle when the image acquisition device acquires the surface image, wherein the illumination angle includes a first illumination angle and a second illumination angle, the first illumination angle is the angle between a first line and a second line, the first line represents the line connecting the center point of the light source and the center point of the object, the second line represents the line connecting the center point of the camera in the image acquisition device and the center point of the object, and the second illumination angle represents the angle between the first line and the coordinate axis; the second determining module is used to determine the illumination vector corresponding to the surface image based on the first illumination angle and the second illumination angle.

[0099] In one optional scheme, the second determining unit includes a third determining module and a fourth determining module; the third determining module is used to determine the surface normal vector of the object, and to determine the generalized reflectivity of the object based on the illumination vector, the gray value and the surface normal vector corresponding to the surface image; the fourth determining module is used to determine the reflectivity result of each pixel on the surface of the object using the generalized reflectivity, and to obtain the reflection map.

[0100] In one optional scheme, the fourth determining module includes a fusion processing submodule and a determining submodule; the fusion processing submodule is used to perform fusion processing on each of the above surface images using an image fusion algorithm to obtain a surface fusion image; the determining submodule is used to determine the above reflectance result of the above object based on the above surface fusion image and the above generalized reflectance to obtain the above reflectance map.

[0101] In one alternative embodiment, the apparatus further includes an adjustment unit for adjusting the contrast of the reflection image of the object using an adaptive algorithm after the reflection image of the object has been determined; the detection unit includes an input module for inputting the response result image into the defect detection model to obtain the defect detection result of the object.

[0102] In one alternative, the first determining unit further includes an acquisition module for controlling the rotation of the rotatable structure, causing a light source mounted on the rotatable structure to rotate along a preset direction, and acquiring multiple surface images of the object under the light source in different directions through the image acquisition device.

[0103] The aforementioned surface defect detection device includes a processor and a memory. The first determining unit, the second determining unit, and the detection unit are all stored as program units in the memory, and the processor executes these program units to achieve their respective functions. All of the above modules are located in the same processor; alternatively, the modules may be located in different processors in any combination.

[0104] The processor contains a kernel, which retrieves the corresponding program unit from memory. One or more kernels can be configured. By adjusting kernel parameters, the problem of existing object surface detection schemes failing to effectively highlight defect features and easily resulting in missed defects can be addressed.

[0105] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0106] This invention provides a computer-readable storage medium including a stored program, wherein, when the program is executed, it controls the device containing the computer-readable storage medium to perform the object surface defect detection method.

[0107] This invention provides a processor for running a program, wherein the program executes the object surface defect detection method.

[0108] This invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it implements at least the steps of the above-described object surface defect detection method.

[0109] The devices mentioned in this article can be servers, PCs, tablets, mobile phones, etc.

[0110] This application also provides a computer program product that, when executed on a data processing device, is adapted to execute a program that initializes at least the steps of the above-described object surface defect detection method.

[0111] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0112] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0113] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. 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 apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

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

[0115] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable 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.

[0116] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0117] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0118] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0119] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0120] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0121] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A method for detecting defects on the surface of an object, characterized in that, include: Multiple surface images of an object are acquired by an image acquisition device under light sources from different directions, and the illumination vectors corresponding to the multiple surface images are determined. The illumination vectors are obtained based on the positional relationship between the light source, the image acquisition device, and the object. Using the illumination vector, the grayscale value of the surface image is determined using the Lambertian reflection model, and the reflection map of the object is determined based at least on the grayscale value corresponding to each of the surface images; The reflection image is subjected to Gaussian filtering to obtain a response result image, and defects of the object are detected based on the response result image.

2. The method according to claim 1, characterized in that, The reflection image is subjected to Gaussian filtering to obtain a response result image, including: Generate a filter kernel based on Gaussian filtering, and rotate the filter kernel according to a preset rotation rule to obtain multiple target filter kernels with different rotation directions; The reflection image is filtered by each of the target filters to obtain multiple sub-response result images, and the multiple sub-response result images are weighted and summed to obtain the response result image.

3. The method according to claim 1, characterized in that, Determining the illumination vectors corresponding to multiple surface images includes: The illumination angle when the image acquisition device acquires the surface image is determined, wherein the illumination angle includes a first illumination angle and a second illumination angle, the first illumination angle is the angle between a first line and a second line, the first line represents the line connecting the center point of the light source and the center point of the object, the second line represents the line connecting the center point of the camera in the image acquisition device and the center point of the object, and the second illumination angle represents the angle between the first line and the coordinate axis. The illumination vector corresponding to the surface image is determined based on the first illumination angle and the second illumination angle.

4. The method according to claim 1, characterized in that, Determining the reflection map of the object based at least on the grayscale values ​​corresponding to each of the surface images includes: Determine the surface normal vector of the object, and determine the generalized reflectivity of the object based on the illumination vector corresponding to the surface image, the gray value, and the surface normal vector; The reflectance of each pixel on the surface of the object is determined using the generalized reflectance to obtain the reflectance map.

5. The method according to claim 4, characterized in that, The reflectance map is obtained by determining the reflectance of each pixel on the surface of the object using the generalized reflectance, including: An image fusion algorithm is used to fuse the surface images to obtain a fused surface image; The reflectance result of the object is determined based on the surface fusion image and the generalized reflectance to obtain the reflectance map.

6. The method according to claim 1, characterized in that, After determining the reflection map of the object, the method further includes: adjusting the contrast of the reflection map using an adaptive algorithm; Detecting defects in an object based on the response result image includes: inputting the response result image into a defect detection model to obtain the defect detection result of the object.

7. The method according to any one of claims 1 to 6, characterized in that, Multiple surface images of an object under light sources from different directions are acquired using an image acquisition device, including: The rotatable structure is controlled to rotate, causing a light source mounted on the rotatable structure to rotate in a preset direction, and the image acquisition device acquires multiple surface images of the object under the light source in different directions.

8. A surface defect detection system for an object, characterized in that, include: A processor for executing the object surface defect detection method according to any one of claims 1 to 7; A defect detection device, wherein the defect detection device is located above an object, the defect detection device includes a rotatable structure, a light source and an image acquisition device, the light source is mounted on the rotatable structure, and the image acquisition device is used to acquire the surface image of the object.

9. The object surface defect detection system according to claim 8, characterized in that, The defect detection device also includes an infrared sensor, which is mounted on the rotatable structure to determine when the light source rotates to a preset position.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device containing the computer-readable storage medium to perform the object surface defect detection method according to any one of claims 1 to 7.