Surface defect enhancement method and device, electronic equipment and readable storage medium

Through guided filtering and normal distribution dynamic enhancement technology, the surface defects of electronic products are enhanced, which solves the problems of limited applicability and image distortion in the prior art, and achieves defect detection with high accuracy and efficiency.

CN119904380APending Publication Date: 2025-04-29BEIJING LUSTER LIGHTTECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411995442.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-29

AI Technical Summary

Technical Problem

The existing defect detection technology has limited applicability and severe image distortion after enhancement, making it difficult to meet the market's high requirements for the appearance quality inspection of electronic products.

Method used

The original surface image is smoothed by guiding filtering, the difference between the original surface image and the guiding smooth image is calculated, the difference image is dynamically enhanced based on the normal distribution, and the enhanced difference image is superimposed with the original surface image to obtain a defect-enhanced image.

Benefits of technology

Effective enhancement of surface defects is achieved, and the defect enhancement image is visually natural and is suitable for defect detection of target objects in multiple scenarios, improving the accuracy and efficiency of defect detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119904380A_ABST
    Figure CN119904380A_ABST
Patent Text Reader

Abstract

The invention discloses a surface defect enhancement method and device, electronic equipment and a readable storage medium, and belongs to the technical field of image enhancement processing. The surface defect enhancement method comprises the following steps: acquiring an original surface image of a target object; smoothing the original surface image through guided filtering to obtain a guided smooth image; calculating a difference value between the original surface image and the guide smooth image to obtain a difference value image; performing dynamic enhancement on the difference image based on normal distribution to obtain an enhanced difference image; and superposing the enhanced difference image and the original surface image to obtain a defect enhanced image which enhances the surface defect in the original surface image of the target object. According to the method and the device, the surface defects in the original surface image are effectively enhanced, the defect enhanced image is visually natural, the method and the device can be applied to defect detection of the target object in multiple scenes, and the accuracy and efficiency of defect detection are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of image enhancement processing technology, and in particular, relates to a surface defect enhancement method, device, electronic device and readable storage medium. Background Art

[0002] With the improvement of living standards and the progress of the electronic products industry, consumers have put forward higher requirements for the appearance quality of electronic products, making appearance defect detection a key link in product quality control. Traditional defect detection technology has been unable to meet the needs of the market. Although there are some defect enhancement methods that can improve the detection effect in specific scenarios, they generally have limited applicability and serious distortion of the enhanced image. Therefore, it is crucial to propose a defect enhancement technology with wide applicability, which can enhance both light and dark defects and has a natural enhancement effect, to improve the appearance quality inspection level of electronic products. Summary of the invention

[0003] The present application aims to solve at least one of the technical problems existing in the related art. To this end, the present application proposes a surface defect enhancement method, device, electronic device and readable storage medium, which realizes the effective enhancement of surface defects in the original surface image. The defect enhanced image is visually natural and can be applied to defect detection of target objects in multiple scenarios, thereby improving the accuracy and efficiency of defect detection.

[0004] In a first aspect, the present application provides a surface defect enhancement method, the method comprising:

[0005] Acquire the original surface image of the target object;

[0006] Smoothing the original surface image by guided filtering to obtain a guided smoothed image;

[0007] Calculating the difference between the original surface image and the guided smoothed image to obtain a difference image;

[0008] Dynamically enhancing the difference image based on normal distribution to obtain an enhanced difference image;

[0009] The enhanced difference image is superimposed on the original surface image to obtain a defect-enhanced image, wherein the defect-enhanced image enhances the surface defects in the original surface image of the target object.

[0010] In the above technical scheme, an original surface image of the target object is obtained, the original surface image is smoothed by guided filtering to obtain a guided smoothed image, the difference between the original surface image and the guided smoothed image is calculated to obtain a difference image, the difference image is dynamically enhanced based on a normal distribution to obtain an enhanced difference image, the enhanced difference image is superimposed on the original surface image to obtain a defect enhanced image, the defect enhanced image enhances the surface defects in the original surface image of the target object, and achieves effective enhancement of the surface defects in the original surface image. The defect enhanced image is visually natural and can be used for defect detection of target objects in multiple scenarios, thereby improving the accuracy and efficiency of defect detection.

[0011] According to an embodiment of the present application, dynamically enhancing the difference image based on the normal distribution to obtain the enhanced difference image includes:

[0012] According to the value of each pixel point of the difference image, determining the enhancement coefficient of each pixel point of the difference image based on normal distribution;

[0013] The value of each pixel point of the difference image is adjusted according to the enhancement coefficient of each pixel point of the difference image to obtain the enhanced difference image.

[0014] In the above technical scheme, according to the value of each pixel point of the difference image, the enhancement coefficient of each pixel point of the difference image is determined based on the normal distribution, and the value of each pixel point of the difference image is adjusted according to the enhancement coefficient of each pixel point of the difference image to obtain an enhanced difference image, which enhances the difference between the original surface image and the guided smoothing image reflected by the difference image at each pixel point. The enhanced difference image can be used to superimpose with the original surface image to obtain a defect enhanced image, thereby enhancing surface defects.

[0015] According to an embodiment of the present application, the step of adjusting the value of each pixel of the difference image according to the enhancement coefficient of each pixel of the difference image to obtain the enhanced difference image includes:

[0016] The enhancement coefficient of each pixel point of the difference image is multiplied by the value of each pixel point of the difference image to obtain the value of each pixel point of the enhanced difference image.

[0017] In the above technical solution, the enhancement coefficient of each pixel point of the difference image is multiplied by the value of each pixel point of the difference image to obtain the value of each pixel point of the enhanced difference image, thereby realizing dynamic enhancement of the difference image.

[0018] According to an embodiment of the present application, the value of each pixel point of the difference image is obtained by subtracting the value of each pixel point of the original surface image from the value of each pixel point of the guided smoothing image.

[0019] In the above technical solution, the value of each pixel of the difference image is obtained by subtracting the value of the corresponding pixel of the guided smoothed image from the value of the corresponding pixel of the original surface image. The pixel-by-pixel difference calculation enables the difference image to reflect the difference between the original surface image and the guided smoothed image at each pixel, which helps to determine the surface defects in the original surface image and further enhance the surface defects.

[0020] According to an embodiment of the present application, the step of smoothing the original surface image by guided filtering to obtain a guided smoothed image includes:

[0021] Acquire a guided image of the guided filtering, and use the original surface image as an input image of the guided filtering;

[0022] Determine a neighborhood window for each pixel of the guide image;

[0023] In each of the neighborhood windows, calculating the local statistical characteristics of the values ​​of each pixel point of the guide image;

[0024] According to the local statistical characteristics, determining the guiding weight of each pixel point in each of the neighborhood windows by the least squares method;

[0025] According to the guided weights, weighted averaging is performed on the values ​​of each pixel point of the input image in each of the neighborhood windows to obtain the guided smoothed image.

[0026] In the above technical scheme, a guiding image of guided filtering is obtained, the original surface image is used as the input image of guided filtering, the neighborhood window of each pixel point of the guiding image is determined, and the local statistical characteristics of the values ​​of each pixel point of the input image are calculated in each neighborhood window. According to the local statistical characteristics, the guiding weight of each pixel point in each neighborhood window is determined by the least squares method. According to the guiding weight, the value of each pixel point of the input image in each neighborhood window is weighted averaged to obtain a guided smoothed image, thereby realizing smoothing of the original surface image. The guided smoothed image can be used to perform a difference with the original surface image to obtain a difference image, which is helpful to determine the surface defects in the original surface image, thereby realizing the enhancement of the surface defects.

[0027] According to an embodiment of the present application, obtaining the guided image of the guided filtering includes:

[0028] The original surface image is used as a guide image for the guided filtering.

[0029] In the above technical solution, the original surface image is used as the guiding image of the guided filtering. In the process of smoothing through the guided filtering, the surface information loss of the target object caused by image transformation or processing is reduced, so that the guided smoothed image output by the guided filtering is more visually natural, and the consistency and coherence between the original surface image and the guided smoothed image are improved.

[0030] In a second aspect, the present application provides a surface defect enhancement device, the device comprising:

[0031] An acquisition unit, used for acquiring an original surface image of a target object;

[0032] A smoothing processing unit, used for smoothing the original surface image by guided filtering to obtain a guided smoothed image;

[0033] A difference calculation unit, used for calculating the difference between the original surface image and the guided smoothed image to obtain a difference image;

[0034] A difference enhancement unit, used for dynamically enhancing the difference image based on normal distribution to obtain an enhanced difference image;

[0035] The image superposition unit is used to superimpose the enhanced difference image with the original surface image to obtain a defect-enhanced image, wherein the defect-enhanced image enhances the surface defects in the original surface image of the target object.

[0036] In the above technical scheme, a surface defect enhancement device is used to obtain an original surface image of a target object, smooth the original surface image by guided filtering to obtain a guided smoothed image, calculate the difference between the original surface image and the guided smoothed image to obtain a difference image, dynamically enhance the difference image based on a normal distribution to obtain an enhanced difference image, and superimpose the enhanced difference image with the original surface image to obtain a defect enhanced image. The defect enhanced image enhances the surface defects in the original surface image of the target object, thereby achieving effective enhancement of the surface defects in the original surface image. The defect enhanced image is visually natural and can be used to perform defect detection on target objects in multiple scenarios, thereby improving the accuracy and efficiency of defect detection.

[0037] In a third aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the surface defect enhancement method as described in the first aspect above is implemented.

[0038] In a fourth aspect, the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the surface defect enhancement method as described in the first aspect above.

[0039] In a fifth aspect, the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the surface defect enhancement method as described in the first aspect.

[0040] In a sixth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the surface defect enhancement method as described in the first aspect above.

[0041] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:

[0043] Figure 1 is a schematic flow chart of a surface defect enhancement method provided in some embodiments of the present application;

[0044] Figure 2 This is one of the defect enhancement effect comparison schematic diagrams provided in some embodiments of the present application;

[0045] Figure 3 This is the second schematic diagram comparing defect enhancement effects provided by some embodiments of the present application;

[0046] Figure 4 is a probability density function diagram of a normal distribution provided by some embodiments of the present application;

[0047] Figure 5 is a schematic diagram of guided filtering provided by some embodiments of the present application;

[0048] Figure 6 is a schematic structural diagram of a surface defect enhancement device provided in some embodiments of the present application;

[0049] Figure 7 It is a schematic diagram of the structure of an electronic device provided in some embodiments of the present application.

[0050] Description of reference numerals:

[0051] 600: surface defect enhancement device; 601: acquisition unit; 602: smoothing processing unit;

[0052] 603: difference calculation unit; 604: difference enhancement unit; 605: image superposition unit;

[0053] 700: electronic device; 701: processor; 702: memory. DETAILED DESCRIPTION

[0054] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0055] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0056] The surface defect enhancement method, device, electronic device and readable storage medium provided in the embodiments of the present application are described in detail below in conjunction with the accompanying drawings through specific embodiments and their application scenarios.

[0057] The surface defect enhancement method provided in the embodiment of the present application can be executed by an electronic device or a functional module or functional entity in the electronic device that can implement the surface defect enhancement method. The electronic devices mentioned in the embodiment of the present application include but are not limited to mobile phones, tablet computers, computers, cameras and wearable devices, etc. The surface defect enhancement method provided in the embodiment of the present application is described below using the electronic device as an example of the execution subject.

[0058] Figure 1 is a schematic diagram of the process of surface defect enhancement method provided by some embodiments of the present application. Figure 1 As shown, the surface defect enhancement method includes: step 110, step 120, step 130, step 140 and step 150.

[0059] Step 110: Acquire an original surface image of the target object.

[0060] In some embodiments, when the original surface image is not a grayscale image, the original surface image needs to be converted into a grayscale image for subsequent processing.

[0061] Step 120: Smoothing the original surface image by guided filtering to obtain a guided smoothed image.

[0062] It should be noted that guided filtering is an image processing technology that maintains image edges while smoothing images through linear transformation. During the guided filtering process, surface defects, which are areas on the surface of the target object that do not meet the design requirements or standards, are effectively removed through smoothing. At the same time, the main structure and edge information of the image are retained, which has good edge preservation effects and performance advantages.

[0063] Step 130: Calculate the difference between the original surface image and the guided smoothed image to obtain a difference image.

[0064] In some embodiments, the value of each pixel point of the difference image is obtained by subtracting the value of each pixel point of the original surface image from the value of each pixel point of the guided smoothing image.

[0065] It can be understood that the value of a pixel is the pixel value, which is used to indicate the grayscale level of the pixel in a grayscale image. The value of each pixel in the difference image is obtained by subtracting the value of the corresponding pixel in the guided smoothing image from the value of the corresponding pixel in the original surface image. The pixel-by-pixel difference calculation enables the difference image to reflect the difference between the original surface image and the guided smoothing image at each pixel, which helps to determine the surface defects in the original surface image, and then enhance the surface defects.

[0066] It can be understood that when the value of the corresponding pixel point in the difference image is positive, it means that the surface defect in the area appears brighter in the original surface image than in the guided smoothed image, which usually corresponds to a protrusion or reflective point on the surface of the target object, and can be called a bright defect;

[0067] When the value of the corresponding pixel in the difference image is negative, it means that the surface defect in the area appears darker in the original surface image than in the guided smoothed image, which usually corresponds to scratches or depressions on the surface of the target object and can be called a dark defect;

[0068] The purpose of enhancing surface defects in the original surface image is to make bright defects brighter and dark defects darker, that is, to improve the visual visibility of defects.

[0069] Furthermore, the visibility of the surface defects in the original surface image can be evaluated according to the absolute value of the pixel value in the difference image. For example, a pixel value threshold is preset.

[0070] If the absolute value of the corresponding pixel value in the difference image is greater than or equal to the threshold, the surface defect in the area is considered to be visually prominent and highly visible, and is classified as a strong defect;

[0071] If the absolute value of the corresponding pixel value in the difference image is less than the threshold, it is considered that the surface defect in the area is not visually prominent enough and has weak visibility, and is classified as a weak defect.

[0072] Step 140: Dynamically enhance the difference image based on normal distribution to obtain an enhanced difference image.

[0073] It can be understood that the normal distribution is also called Gaussian distribution. The difference image is dynamically enhanced based on the normal distribution, that is, the normal distribution is used to perform targeted enhancement processing on the difference image according to the value of each pixel point of the difference image, so as to obtain an enhanced difference image.

[0074] Optionally, the enhancement coefficient of each pixel is determined according to the absolute value of the pixel in the difference image:

[0075] For the pixels representing weak defects in the difference image (the absolute value of the pixel value is small), a larger enhancement coefficient is assigned to make the weak defects more prominent in the defect enhancement image;

[0076] For the pixels representing strong defects in the difference image (the absolute value of the pixel value is large), a smaller enhancement coefficient is assigned to avoid excessive enhancement resulting in the pixel value being too large or too small, thereby avoiding the strong defects being overexposed or too dark in the defect enhanced image, making the enhancement effect more natural, and thus making the defect enhanced image suitable for more scenes, improving the compatibility of the surface defect enhancement method.

[0077] Step 150: superimpose the enhanced difference image and the original surface image to obtain a defect-enhanced image, wherein the defect-enhanced image enhances the surface defects in the original surface image of the target object.

[0078] It can be understood that by superimposing the enhanced difference image with the original surface image, the surface defects in the original image can be significantly mapped. The superimposed defect enhanced image can intuitively display the position and characteristics of the surface defects in the original surface image. The bright defects in the original surface image are brighter in the defect enhanced image, and the dark defects in the original surface image are darker in the defect enhanced image, thereby achieving enhancement of surface defects, which can be used to improve the accuracy and speed of defect recognition.

[0079] Figure 2 This is one of the defect enhancement effect comparison schematic diagrams provided in some embodiments of the present application. Figure 2 a in the figure is the original surface image. Figure 2 The middle b is the effect diagram of defect enhancement achieved by related technologies. Figure 2 Figure c is a diagram showing the effect of defect enhancement achieved by the surface defect enhancement method provided in an embodiment of the present application.

[0080] Figure 3 This is the second schematic diagram comparing defect enhancement effects provided in some embodiments of the present application. Figure 3 a in the figure is the original surface image. Figure 3 The middle b is the effect diagram of defect enhancement achieved by related technologies. Figure 3 Figure c is a diagram showing the effect of defect enhancement achieved by the surface defect enhancement method provided in an embodiment of the present application.

[0081] In the above technical scheme, an original surface image of the target object is obtained, the original surface image is smoothed by guided filtering to obtain a guided smoothed image, the difference between the original surface image and the guided smoothed image is calculated to obtain a difference image, the difference image is dynamically enhanced based on a normal distribution to obtain an enhanced difference image, the enhanced difference image is superimposed on the original surface image to obtain a defect enhanced image, the defect enhanced image enhances the surface defects in the original surface image of the target object, and achieves effective enhancement of the surface defects in the original surface image. The defect enhanced image is visually natural and can be used for defect detection of target objects in multiple scenarios, thereby improving the accuracy and efficiency of defect detection.

[0082] In some embodiments of the present application, dynamically enhancing the difference image based on the normal distribution to obtain the enhanced difference image includes:

[0083] According to the value of each pixel point of the difference image, determining the enhancement coefficient of each pixel point of the difference image based on normal distribution;

[0084] The value of each pixel point of the difference image is adjusted according to the enhancement coefficient of each pixel point of the difference image to obtain the enhanced difference image.

[0085] It can be understood that in the process of dynamically enhancing the difference image, the value of each pixel point of the difference image is regarded as a sample point of the normal distribution, the probability density corresponding to these sample points is calculated using the normal distribution formula, and the probability density corresponding to the value of each pixel point is used as the enhancement coefficient of each pixel point, so that the distribution of the enhancement coefficient conforms to the normal distribution.

[0086] Figure 4 It is a probability density function diagram of the normal distribution provided by some embodiments of the present application. Figure 4 The X-axis corresponds to the value of each pixel in the difference image, and the Y-axis f(x) corresponds to the probability density of the value of each pixel, such as Figure 4 As shown, the normal distribution is a standard normal distribution, and the probability density function (PDF) of the normal distribution is a symmetrical bell-shaped curve, which is symmetrical about the Y axis and can be expressed as:

[0087]

[0088] Among them, e is the base of natural logarithm, π is the ratio of pi, and x represents the value of each pixel of the difference image.

[0089] Optionally, before substituting the value of each pixel into the normal distribution formula, the value of each pixel is also regularized:

[0090]

[0091] Wherein, x represents the value of each pixel of the difference image, and μ and σ are the mean and standard deviation determined based on the value of each pixel of the difference image.

[0092] By substituting the value of each pixel into the normal distribution formula, the probability density corresponding to the value of each pixel can be obtained, and then the enhancement coefficient of each pixel can be determined according to the probability density corresponding to the value of each pixel.

[0093] It can be understood that in the probability density function of the normal distribution, the distance between the value (x) of each pixel point in the difference image and the Y-axis can be used as an indicator to measure the strength of the defect in the original surface image. Specifically, the farther the value of the pixel point in the difference image is from the Y-axis, the stronger the corresponding defect in the original surface image; the closer the value of the pixel point is to the Y-axis, the weaker the corresponding defect in the original surface image.

[0094] The enhancement coefficient of each pixel in the difference image is determined based on the probability density function of the normal distribution. For pixels representing weak defects, that is, pixels whose values ​​are close to the Y axis, a larger enhancement coefficient is assigned to improve the visibility of these defects in the enhanced difference image. For pixels representing strong defects, that is, pixels whose values ​​are far from the Y axis, a smaller enhancement coefficient is assigned. Optionally, setting an upper limit for the enhancement coefficient can further avoid excessive enhancement resulting in excessively large or small pixel values, thereby avoiding overexposure or overdarkness of defects in the defect enhanced image, so as to make the enhancement effect more natural and improve the compatibility of the surface defect enhancement method.

[0095] In some embodiments, the step of adjusting the value of each pixel of the difference image according to the enhancement coefficient of each pixel of the difference image to obtain the enhanced difference image includes:

[0096] The enhancement coefficient of each pixel point of the difference image is multiplied by the value of each pixel point of the difference image to obtain the value of each pixel point of the enhanced difference image.

[0097] It can be understood that the difference image is dynamically enhanced by multiplying the value of each pixel in the difference image by its corresponding enhancement coefficient. The enhancement coefficient determines the adjustment range of the value of each pixel, and is applied one by one to all pixels in the difference image to obtain an enhanced difference image.

[0098] It can be understood that by determining the enhancement coefficient of each pixel point in the above manner, it is possible to simultaneously enhance bright defects (the value of the corresponding pixel point in the difference image is a positive value) and dark defects (the value of the corresponding pixel point in the difference image is a negative value).

[0099] In the above technical scheme, according to the value of each pixel point of the difference image, the enhancement coefficient of each pixel point of the difference image is determined based on the normal distribution, and the value of each pixel point of the difference image is adjusted according to the enhancement coefficient of each pixel point of the difference image to obtain an enhanced difference image, which enhances the difference between the original surface image and the guided smoothing image reflected by the difference image at each pixel point. The enhanced difference image can be used to superimpose with the original surface image to obtain a defect enhanced image, thereby enhancing surface defects.

[0100] In some embodiments of the present application, the smoothing of the original surface image by guided filtering to obtain a guided smoothed image includes:

[0101] Acquire a guided image of the guided filtering, and use the original surface image as an input image of the guided filtering;

[0102] Determine a neighborhood window for each pixel of the guide image;

[0103] In each of the neighborhood windows, calculating the local statistical characteristics of the values ​​of each pixel point of the guide image;

[0104] According to the local statistical characteristics, determining the guiding weight of each pixel point in each of the neighborhood windows by the least squares method;

[0105] According to the guided weights, weighted averaging is performed on the values ​​of each pixel point of the input image in each of the neighborhood windows to obtain the guided smoothed image.

[0106] Figure 5 Schematic diagram of guided filtering provided by some embodiments of the present application. Figure 5 As shown, the original surface image is taken as the input image p, and after smoothing by guided filtering, a guided smoothed image is obtained as the output image q.

[0107] For each pixel i in the guidance image I, determine a neighborhood window ω centered on i i ;

[0108] In the neighborhood window ω i Calculate the local statistical characteristics of the values ​​of each pixel of the guidance image, including the mean and variance;

[0109] In each neighborhood window ω k In the above example, it is assumed that there is a linear relationship between the output image q and the guidance image I, which can be expressed as:

[0110]

[0111] Among them, k is the center position of the window, i is the pixel index of the window, and a k and b k is the constant coefficient of the window to be determined, I i is the pixel value of the guidance image I at position i, q i is the pixel value of the output image q at position i.

[0112] Assume that the output image q has the following relationship with the input image p:

[0113] q i =p i -n i

[0114] Among them, n i is the noise part that needs to be removed at position i.

[0115] In order to seek a k and b k The optimal solution of ij (I) Optimize the following objective function by the least squares method to minimize the output of this function:

[0116]

[0117] Among them, ε is the regularization parameter used to control a k size to prevent overfitting.

[0118] According to the least squares method, we can get a k and b k The calculation formula

[0119]

[0120] Among them, μ k It is a window k The mean value of each pixel in the inner guidance image, It is a window k The variance of the values ​​of each pixel in the inner guidance image, M represents the window ω k The number of pixels in is the input image in window ω k The mean gray value within .

[0121] Each pixel value q of the output image q i Calculated by the following formula:

[0122]

[0123] Among them, q iis the pixel value of the output image q at position i, p j is the pixel value of the input image p at position j, W ij (I) is the weight determined by the guidance image I, ω i is the neighborhood window centered at i.

[0124] During the calculation process, a pixel may be included in multiple windows, and the value calculated by each window is different, so the output image needs to take the average value of the window superposition. Therefore, the output image can be expressed as

[0125] q i =∑ i,k∈ω (a k I i +b k ).

[0126] In some embodiments, the original surface image is used as a guiding image for the guided filtering.

[0127] The original surface image contains the surface information of the target object, including texture, edges and details. Using the original surface image as a guide image can retain the surface information of the target object as much as possible during the smoothing process through guided filtering, thereby reducing the loss of target object surface information caused by image transformation or processing.

[0128] Since guided filtering generates a filtered output image according to the content of the guided image, using the original surface image as the guided image can make the output guided smoothed image more visually natural and improve the consistency and coherence between the original surface image and the guided smoothed image.

[0129] In some embodiments, the guiding image for guiding filtering is not limited to the original surface image, but can also be a transformed version of the original surface image, such as an image after edge detection, a gradient image, or a texture image, so as to achieve more targeted smoothing processing. For example, using an image after edge detection as a guiding image can make the filtering process pay more attention to the edge information of the image, thereby better retaining the edge details.

[0130] In the above technical scheme, a guiding image of guided filtering is obtained, the original surface image is used as the input image of guided filtering, the neighborhood window of each pixel point of the guiding image is determined, and the local statistical characteristics of the values ​​of each pixel point of the input image are calculated in each neighborhood window. According to the local statistical characteristics, the guiding weight of each pixel point in each neighborhood window is determined by the least squares method. According to the guiding weight, the value of each pixel point of the input image in each neighborhood window is weighted averaged to obtain a guided smoothed image, thereby realizing smoothing of the original surface image. The guided smoothed image can be used to perform a difference with the original surface image to obtain a difference image, which is helpful to determine the surface defects in the original surface image, thereby realizing the enhancement of the surface defects.

[0131] The surface defect enhancement method provided in the embodiment of the present application can be performed by a surface defect enhancement device. In the embodiment of the present application, the surface defect enhancement method performed by the surface defect enhancement device is taken as an example to illustrate the surface defect enhancement device provided in the embodiment of the present application.

[0132] Figure 6 Schematic diagram of the structure of the surface defect enhancement device provided by some embodiments of the present application. Figure 6 As shown, the surface defect enhancement device 600 includes:

[0133] An acquisition unit 601 is used to acquire an original surface image of a target object;

[0134] A smoothing processing unit 602 is used to perform smoothing processing on the original surface image by guided filtering to obtain a guided smoothed image;

[0135] A difference calculation unit 603 is used to calculate the difference between the original surface image and the guided smoothed image to obtain a difference image;

[0136] A difference enhancement unit 604 is used to dynamically enhance the difference image based on normal distribution to obtain an enhanced difference image;

[0137] The image superposition unit 605 is used to superimpose the enhanced difference image with the original surface image to obtain a defect-enhanced image, wherein the defect-enhanced image enhances the surface defects in the original surface image of the target object.

[0138] Optionally, the difference enhancement unit 604 is used to:

[0139] According to the value of each pixel point of the difference image, determining the enhancement coefficient of each pixel point of the difference image based on normal distribution;

[0140] The value of each pixel point of the difference image is adjusted according to the enhancement coefficient of each pixel point of the difference image to obtain the enhanced difference image.

[0141] Optionally, the difference enhancement unit 604 is used to:

[0142] The enhancement coefficient of each pixel point of the difference image is multiplied by the value of each pixel point of the difference image to obtain the value of each pixel point of the enhanced difference image.

[0143] Optionally, the value of each pixel point of the difference image is obtained by subtracting the value of each pixel point of the original surface image from the value of each pixel point of the guided smoothing image.

[0144] Optionally, the smoothing processing unit 602 is used for:

[0145] Acquire a guided image of the guided filtering, and use the original surface image as an input image of the guided filtering;

[0146] Determine a neighborhood window for each pixel of the guide image;

[0147] In each of the neighborhood windows, calculating the local statistical characteristics of the values ​​of each pixel point of the guide image;

[0148] According to the local statistical characteristics, determining the guiding weight of each pixel point in each of the neighborhood windows by the least squares method;

[0149] According to the guided weights, weighted averaging is performed on the values ​​of each pixel point of the input image in each of the neighborhood windows to obtain the guided smoothed image.

[0150] Optionally, the smoothing processing unit 602 is used for:

[0151] The original surface image is used as a guide image for the guided filtering.

[0152] In the above technical scheme, a surface defect enhancement device is used to obtain an original surface image of a target object, smooth the original surface image by guided filtering to obtain a guided smoothed image, calculate the difference between the original surface image and the guided smoothed image to obtain a difference image, dynamically enhance the difference image based on a normal distribution to obtain an enhanced difference image, and superimpose the enhanced difference image with the original surface image to obtain a defect enhanced image. The defect enhanced image enhances the surface defects in the original surface image of the target object, thereby achieving effective enhancement of the surface defects in the original surface image. The defect enhanced image is visually natural and can be used to perform defect detection on target objects in multiple scenarios, thereby improving the accuracy and efficiency of defect detection.

[0153] The surface defect enhancement device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than the terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., and the embodiment of the present application is not specifically limited.

[0154] The surface defect enhancement device in the embodiment of the present application may be a device having an operating system. The operating system may be a Microsoft (Windows) operating system, an Android (Android) operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0155] The surface defect enhancement device provided in the embodiment of the present application can implement each process implemented in the embodiment of the surface defect enhancement method. To avoid repetition, it will not be described here.

[0156] In some embodiments, Figure 7 As shown, an embodiment of the present application also provides an electronic device 700, including a processor 701, a memory 702, and a computer program stored in the memory 702 and executable on the processor 701. When the program is executed by the processor 701, each process of the above-mentioned surface defect enhancement method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.

[0157] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0158] An embodiment of the present application also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned surface defect enhancement method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0159] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0160] An embodiment of the present application also provides a computer program product, including a computer program, which implements the above-mentioned surface defect enhancement method when executed by a processor.

[0161] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0162] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned surface defect enhancement method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0163] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0164] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0165] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the relevant technology, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0166] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

[0167] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0168] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present application, and that the scope of the present application is defined by the claims and their equivalents.

Claims

1. A surface defect enhancement method, characterized in that: include: Acquire the original surface image of the target object; Smoothing the original surface image by guided filtering to obtain a guided smoothed image; Calculating the difference between the original surface image and the guided smoothed image to obtain a difference image; Dynamically enhancing the difference image based on normal distribution to obtain an enhanced difference image; The enhanced difference image is superimposed on the original surface image to obtain a defect-enhanced image, wherein the defect-enhanced image enhances the surface defects in the original surface image of the target object.

2. The surface defect enhancement method according to claim 1, characterized in that: The dynamically enhancing the difference image based on the normal distribution to obtain the enhanced difference image includes: According to the value of each pixel point of the difference image, determining the enhancement coefficient of each pixel point of the difference image based on normal distribution; The value of each pixel point of the difference image is adjusted according to the enhancement coefficient of each pixel point of the difference image to obtain the enhanced difference image.

3. The surface defect enhancement method according to claim 2, characterized in that: The step of adjusting the value of each pixel point of the difference image according to the enhancement coefficient of each pixel point of the difference image to obtain the enhanced difference image includes: The enhancement coefficient of each pixel point of the difference image is multiplied by the value of each pixel point of the difference image to obtain the value of each pixel point of the enhanced difference image.

4. The surface defect enhancement method according to claim 2 or 3, characterized in that: The value of each pixel point of the difference image is obtained by subtracting the value of each pixel point of the original surface image from the value of each pixel point of the guided smoothing image.

5. The surface defect enhancement method according to claim 1, characterized in that: The step of smoothing the original surface image by guided filtering to obtain a guided smoothed image comprises: Acquire a guided image of the guided filtering, and use the original surface image as an input image of the guided filtering; Determine a neighborhood window for each pixel of the guide image; In each of the neighborhood windows, calculating the local statistical characteristics of the values ​​of each pixel point of the guide image; According to the local statistical characteristics, determining the guiding weight of each pixel point in each of the neighborhood windows by the least squares method; According to the guided weights, weighted averaging is performed on the values ​​of each pixel point of the input image in each of the neighborhood windows to obtain the guided smoothed image.

6. The surface defect enhancement method according to claim 5, characterized in that: The step of obtaining the guided filtering guided image comprises: The original surface image is used as a guide image for the guided filtering.

7. A surface defect enhancement device, characterized in that: include: An acquisition unit, used for acquiring an original surface image of a target object; A smoothing processing unit, used for smoothing the original surface image by guided filtering to obtain a guided smoothed image; A difference calculation unit, used for calculating the difference between the original surface image and the guided smoothed image to obtain a difference image; A difference enhancement unit, used for dynamically enhancing the difference image based on normal distribution to obtain an enhanced difference image; The image superposition unit is used to superimpose the enhanced difference image with the original surface image to obtain a defect-enhanced image, wherein the defect-enhanced image enhances the surface defects in the original surface image of the target object.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the surface defect enhancement method as described in any one of claims 1 to 6 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the surface defect enhancement method as described in any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the surface defect enhancement method according to any one of claims 1 to 6 is implemented.