An industrial metal surface defect image denoising and enhancement method

Through combined median filtering and wavelet threshold denoising, DeBlurGAN V2 defuzzing and UACE algorithm, noise and blur problems in industrial metal surface defect detection are solved, image quality and contrast are improved, and detection accuracy is improved.

CN115829967BActive Publication Date: 2025-07-18SICHUAN UNIVERSITY OF SCIENCE AND ENGINEERING
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211529412.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-30
Publication Date
2025-07-18
Estimated Expiration
2042-11-30

AI Technical Summary

Technical Problem

In the detection of industrial metal surface defects, image acquisition environment and equipment factors lead to a lot of noise, low contrast, and blurred details, affecting the detection accuracy.

Method used

Combined median filtering denoising and optimized wavelet threshold denoising, combined with DeBlurGAN V2 defuzzing, and finally image contrast enhancement is performed through the UACE algorithm.

Benefits of technology

Effectively eliminate noise, improve image contrast and detailed information, improve image quality, and enhance detection accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115829967B_ABST
    Figure CN115829967B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for denoising and enhancing industrial metal surface defect images, which includes denoising the original image by using combined median filtering denoising and optimized wavelet threshold denoising; deblurring the denoised image by using the DeBlurGAN V2 method; and enhancing the contrast of the deblurred image by using the UACE algorithm to obtain the final image. The peak signal-to-noise ratio, contrast, and information entropy of the enhanced image of the present invention are all improved, proving that the method of the present invention can not only eliminate the noise in the image, but also effectively improve the contrast of the image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and particularly relates to a method for denoising and enhancing industrial metal surface defect images. Background Art

[0002] Defect detection on the surface of industrial metals plays a very important role in industrial production. Traditional detection methods rely on manual operation with the aid of external equipment. Due to inconsistent detection standards, problems such as false detection, missed detection, and low efficiency exist. With the research and development of machine vision, excellent results have been achieved in many fields, providing a new direction for the detection of surface defects of electronic commutators. During the process of industrial metal surface defect detection, due to the influence of the image acquisition environment, photographing equipment, and external light sources, the obtained images often have problems such as a large amount of noise, low contrast, and blurred details, which are not conducive to subsequent defect detection (Ge Wankai, Zhao Shihai, Fan Yujia. Fabric surface defect image enhancement algorithm based on contrast-limited histogram equalization and unsharp masking [J]. Wool Textile Journal, 2021, 49(12): 68-74.). In order to improve the accuracy of industrial metal surface defect detection, it is necessary to denoise and enhance the pictures captured by the camera, highlight the detailed edge information of the pictures, enhance the contrast of the pictures, reduce the influence of noise on the pictures, and improve the quality of the images.

[0003] Denoising and enhancing the images of industrial metal surface defects requires eliminating the noise in the industrial metal surface images and highlighting the defective parts of the electronic commutator to enhance the accuracy of subsequent defect detection. Image enhancement methods include image denoising, image deblurring, and image contrast enhancement, etc. Image denoising includes traditional algorithms such as median filtering denoising, Gaussian filtering denoising, and wavelet threshold denoising. Tang Chao et al. (Tang Chao, Zuo Wentao, Li Xiaofei. An Image Denoising Algorithm Combining Trimmed Mean and Gaussian Weighted Median Filtering [J]. Computer Engineering, 2021, 47(09): 210-216.) used the method of trimmed mean and Gaussian weighted median filtering to better retain the edge details of the image on the premise of removing noise, but did not remove random value impulse noise and Gaussian noise. Chen Shun et al. (Chen Shun, Li Dengfeng. Color Image Edge Detection Based on Multilayer Wavelet Threshold Function [J]. Journal of Computer Applications) proposed a color image edge detection method based on a multilayer wavelet threshold denoising function, effectively improving the continuity and noise resistance of edges in edge detection, but it is only limited to the removal of white noise and Gaussian noise. Image contrast enhancement includes traditional algorithms such as histogram-based contrast enhancement, pixel-based contrast enhancement, and Retinex-based contrast enhancement. The dynamic histogram equalization algorithm based on adaptive correction proposed by Yang Jianeng et al. (Yang Jianeng, Li Hua, Tian Chenwei, etc. Dynamic Histogram Equalization Algorithm Based on Adaptive Correction [J]. Computer Engineering and Design, 2021, 42(05): 1264-1270) not only prevents the merging of gray levels but also achieves a good enhancement effect in low-light images. However, this algorithm has poor effects under strong light or high brightness conditions. Chen Wenyi et al. (Chen Wenyi, Yang Chengxun, Yang Hui. Multi-scale Retinex Infrared Image Enhancement by Fusing Guided Filter and Logarithmic Transformation [J]. Infrared Technology, 2022, 44(04): 397-403) introduced the guided filter and logarithmic transformation into the MSR algorithm through the method of multi-scale Retinex infrared image enhancement by fusing guided filter and logarithmic transformation, effectively improving the quality of infrared images. However, this algorithm has poor effects in other image datasets. Summary of the Invention

[0004] Based on the deficiencies in the existing technology, the present invention provides a method for denoising and enhancing industrial metal surface defect images. The specific technical solutions are as follows:

[0005] A method for denoising and enhancing industrial metal surface defect images includes the following steps:

[0006] Step 1: Denoise the original image by using combined median filtering denoising and optimized wavelet threshold denoising;

[0007] Step 2: Deblur the denoised image by using the DeBlurGAN V2 method;

[0008] Step 3: Use the UACE algorithm to perform contrast enhancement on the deblurred image to obtain the final image.

[0009] Specifically, the calculation formula for median filtering denoising described in Step 1 is:

[0010] g(x,y) = med{f(x - i),(y - j)}; (i,j) ∈ S m,n

[0011] where f(x,y) is the original gray value of the target pixel point, f(x - i,y - j) is the gray value of each pixel point in the neighborhood of the target pixel point, g(x,y) is the gray value output after median filtering, and S m,n is the filter.

[0012] Specifically, the optimized wavelet threshold denoising described in Step 1 includes the following sub - steps:

[0013] Step 101: Convert the RGB image to a YUV image;

[0014] Step 102: Use wavelet decomposition to divide the Y - space domain of the YUV image into a low - frequency space and a high - frequency space;

[0015] Step 103: Remove background noise in the high - frequency space and remove salt - and - pepper noise in the low - frequency space;

[0016] Step 104: Perform wavelet fusion on the high - frequency space and the low - frequency space to form a new Y - space domain;

[0017] Step 105: Convert the YUV space domain back to the RGB space domain to obtain the denoised RGB image.

[0018] Specifically, the DeBlurGAN V2 method described in Step 2 replaces normal convolution with depth - separable convolution to reduce the complexity of the network, includes feature outputs at 5 scales, the features are upsampled to 1 / 4 of the original image and re - stitched into a new whole, and then two upsampling modules are connected to restore to the original image size and reduce artifacts;

[0019] The output also adds a tanh activation function to ensure the dynamic range of the generated image.

[0020] Specifically, the DeBlurGAN V2 method also includes the step of normalizing the input image to [-1,1].

[0021] Specifically, the DeBlurGAN V2 method also includes a loss function, and the loss function uses a mixed three - term loss to train the network. The calculation formula is:

[0022] L G = 0.5 * L p + 0.006 * L x + 0.01L adv

[0023] where L adv includes the global and local discriminator losses, L p is the mean squared error loss, and L x is the perceptual distance loss.

[0024] Specifically, the UACE algorithm described in step 3 includes an unsharp masking method and a local adaptive contrast enhancement method. The calculation formula of the UACE algorithm is:

[0025] f(x, y) = m x (i, j) + G(i, j)[x(i, j) - m x (i, j)]

[0026] where f(i, j) is the pixel value of the pixel point (i, j) in the enhanced image; m(i, j) is the local mean centered on the pixel point (i, j); G(i, j) is the gain coefficient; and x(i, j) is the pixel value of the pixel point (i, j) in the original image.

[0027] Specifically, the calculation formula of G(i, j) is:

[0028]

[0029] D is the global mean square deviation of the image, which is a constant; σ x (i, j) is the local standard deviation centered on the pixel point (i, j)

[0030] where

[0031] D also includes the function of controlling the high-frequency enhancement degree again through the Amount parameter.

[0032] Specifically, the unsharp masking method optimizes the high-pass filter in the traditional unsharp masking, combines Gaussian filtering and mean filtering to replace the original high-pass filter. The optimized unsharp masking method can not only effectively suppress the over-enhancement phenomenon of the image, but also protect the edge information of the picture;

[0033] The calculation formula of the unsharp masking method is:

[0034] y(i, j) = x(i, j) + λz(i, j)

[0035] Among them, x(i,j) is the input image; y(i,j) is the output image; λ is the enhancement coefficient; z(i,j) is the result obtained by performing Gaussian filtering on the input image x(i,j).

[0036] The present invention can achieve the following beneficial effects:

[0037] 1) The peak signal-to-noise ratio, contrast, and information entropy of the image enhanced by the present invention are all improved, proving that the method of the present invention can not only eliminate the noise in the image, but also effectively improve the contrast of the image. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 is the flowchart of the method of the present invention;

[0039] Figure 2 is the flowchart of the denoising algorithm of the present invention;

[0040] Figure 3 is the architecture diagram of DeBlurGAN V2 of the present invention;

[0041] Figure 4 is the flowchart of the image contrast enhancement algorithm UACE of the present invention;

[0042] Figure 5 is the enhanced result diagram of the original image 1 of the present invention;

[0043] Figure 6 is the enhanced result diagram of the original image 2 of the present invention;

[0044] Figure 7 is the enhanced result diagram of the original image 3 of the present invention. DETAILED DESCRIPTION OF THE INVENTION

[0045] In order to have a clearer understanding of the technical features, objectives, and effects of the present invention, the specific implementation manners of the present invention will now be described with reference to the accompanying drawings.

[0046] Example 1

[0047] The method of the present invention is as Figures 1-4 shown. The research objects of the experiments of the present invention are industrial metal surface defect pictures, which are from the public dataset KolektorSDD2. The experimental pictures are as Figures 5-7 shown. It can be seen from the original pictures that the original images have low contrast and large noise interference. To meet the needs of subsequent defect detection, the improved image enhancement algorithm of the present invention is used to process the images in the dataset. All the experiments of the present invention are carried out under the operating system Windows10; the software configuration is Anaconda, Pycharm; and the programming language is python.

[0048] Subjective Image Quality Metrics

[0049] The three groups of experiments in the experiment are to perform image enhancement on the original image 1, the original image 2, and the original image 3 respectively to verify the enhancement effect of the algorithm of the present invention on pictures. In the three groups of experiments, (a) is the original image, (b) is the image obtained after the three images are denoised by joint median filtering and the improved wavelet threshold denoising method, (c) is the image obtained after the denoised image is deblurred by DeBlurGAN V2, and (d) is the finally enhanced image obtained after the deblurred image passes through the UACE algorithm. It can be seen from the results that although the denoising algorithm of the present invention shown in (b) can effectively eliminate the white noise points in the original image, the denoised image becomes blurred, which is not conducive to subsequent contrast enhancement; the deblurred image shown in (c) is clearer than before deblurring; after the deblurred image shown in (d) is enhanced by the improved contrast enhancement algorithm of the present invention, not only the contrast of the original image is improved, but also the edge detail information of the image is improved.

[0050] Objective image quality evaluation

[0051] In order to more objectively evaluate the enhancement effect, the present invention introduces five objective image quality indicators, namely MSE, PSNR, SSIM, information entropy, and image contrast, to evaluate the experimental results of the test images.

[0052] MSE represents the mean square error of the image and is one of the most commonly used algorithms for judging image quality. MSE is used to evaluate the difference degree at the pixel level between the restored image I and the original image K. The smaller the value of MSE, the better the quality of the restored image. The calculation formula of MSE is as follows:

[0053]

[0054] In the formula, M represents the total number of pixels of the restored image I, and N is the total number of pixels of the original image K.

[0055] PSNR represents the peak signal-to-noise ratio of the image and is one of the commonly used parameters for measuring image quality. PSNR is an objective indicator used to evaluate the noise level or the integrity degree of the image information structure. The larger the value of PSNR, the less noise and distortion the picture suffers, and the higher the quality of the generated image. The calculation formula of PSNR is as follows:

[0056]

[0057] SSIM represents the structural similarity between two images and is an index for measuring the similarity between two images. When the two images are exactly the same, the value of SSIM is 1. The larger the value of SSIM, the more similar the enhanced image is to the original image. The calculation formula of SSIM is as follows:

[0058]

[0059] In the formula, μ x is the average value of x, and μ y is the average value of y, is the variance of x, is the variance of y, and c1 and c2 are constants used to maintain stability.

[0060] The information entropy represents the amount of information contained in an image. The more information an image contains, the greater the information entropy. Its calculation formula is as follows:

[0061]

[0062] In the formula, i represents the gray value of the pixels in the image, and P i represents the probability that the pixels with gray value i appear in the whole image.

[0063] The image contrast represents the ratio or logarithmic difference between the brightest and darkest parts of the image, and is generally represented by EME. The higher the contrast of the image, the greater the EME, and the more obvious the image enhancement effect.

[0064] Table 1 shows the results of different denoising algorithms for different pictures after denoising. It can be seen from Table 1 that the PSNR values of the pictures processed by the denoising method of the present invention for three different pictures are all greater than those of other denoising methods, indicating that the noise and distortion of the pictures after denoising by the denoising method of the present invention are less, and the quality of the pictures is higher.

[0065]

[0066] Table 1 Peak signal-to-noise ratio of different denoising algorithms for different images

[0067] Table 2 shows the sizes of various indexes of three different images before and after being processed by the DeBlurGAN V2 deblurring algorithm. It can be seen from Table 2 that the MSE of the pictures after being processed by the DeBlurGAN V2 deblurring algorithm is less than that before deblurring, indicating that the quality of the pictures after deblurring is better; the PSNR and SSIM are both greater than those before deblurring, indicating that the pictures after deblurring are not only more similar to the original images, but also the quality of the images is improved.

[0068]

[0069]

[0070] Table 2 Objective evaluation results of the image before and after deblurring

[0071] Table 3 shows the sizes of various indicators of three different images before and after the ACE algorithm and the UACE algorithm of the present invention. It can be seen from Table 3 that although the value of the information entropy of the image enhanced by the ACE algorithm has increased, the value of the contrast has decreased, indicating that the information of the image enhanced by the ACE algorithm has increased, but the image enhancement effect has deteriorated. The values of the information entropy and contrast of the image enhanced by the UACE algorithm of the present invention are both greater than those before enhancement, indicating that the image enhanced by the algorithm of the present invention not only has an increase in information volume, but also the image enhancement effect is more obvious.

[0072]

[0073] Table 3 Objective evaluation results of different images with different contrast enhancement treatments

[0074] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited by the above embodiments. The above embodiments and the descriptions in the specification only illustrate the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention will have various changes and improvements, and these changes and improvements all fall within the scope of the present invention claimed.

Claims

1. An industrial metal surface defect image denoising and enhancement method, characterized in that, It includes the following steps: Step 1: Denoise the original image by using combined median filtering denoising and optimized wavelet threshold denoising; Step 2: Deblur the denoised image by using the DeBlurGAN V2 method; Step 3: Use the UACE algorithm to enhance the contrast of the deblurred image to obtain the final image; The optimized wavelet threshold denoising described in Step 1 includes the following sub-steps: Step 101: Convert the RGB image to a YUV image; Step 102: Use wavelet decomposition to divide the Y space domain of the YUV image into a low-frequency space and a high-frequency space; Step 103: Remove background noise in the high-frequency space and remove salt-and-pepper noise in the low-frequency space; Step 104: Perform wavelet fusion on the high-frequency space and the low-frequency space to form a new Y space domain; Step 105: Convert the YUV space domain back to the RGB space domain to obtain the denoised RGB image; The UACE algorithm described in Step 3 includes an unsharp masking method and a local adaptive contrast enhancement method. The calculation formula of the UACE algorithm is: f(x,y) = m x (i,j) + G(i,j)[x(i,j) - m x (i,j)] Where, f(i,j) is the pixel value of the pixel point (i,j) in the enhanced image; m(i,j) is the local mean centered on the pixel point (i,j); G(i,j) is the gain coefficient; x(i,j) is the pixel value of the pixel point (i,j) in the original image; The unsharp masking method optimizes the high-pass filter in the traditional unsharp masking, and combines Gaussian filtering and mean filtering to replace the original high-pass filter; The calculation formula of the unsharp masking method is: y(i,j) = x(i,j) + λz(i,j) Where, x(i,j) is the input image; t(i,j) is the output image; λ is the enhancement coefficient; z(i,j) is the result obtained by performing Gaussian filtering on the input image x(i,j).

2. The industrial metal surface defect image denoising and enhancement method according to claim 1, characterized in that, The calculation formula of the median filtering denoising described in Step 1 is: g(x,y) = med{f(x - i),(y - j)}; (i,j) ∈ S m,n Among them, f(i, j) is the original gray value of the target pixel point, f(x - i, y - j) is the gray value of each pixel point in the neighborhood of the target pixel point, g(x, y) is the gray value output after median filtering, and S m,n is the filter.

3. A method for denoising and enhancing industrial metal surface defect images according to claim 1, characterized in that, The DeBlurGAN V2 method described in Step 2 replaces normal convolution with depthwise separable convolution to reduce the complexity of the network. It includes feature outputs at 5 scales. The features are upsampled to 1 / 4 of the original image and re-spliced into a new whole, and then two upsampling modules are connected to restore to the original image size and reduce artifacts; A tanh activation function is also added to the output to ensure the dynamic range of the generated image.

4. A method for denoising and enhancing industrial metal surface defect images according to claim 3, characterized in that The DeBlurGAN V2 method also includes the step of normalizing the input image to [-1,1].

5. The industrial metal surface defect image denoising and enhancement method according to claim 3, characterized in that, The DeBlurGAN V2 method also includes a loss function. The loss function uses a mixed three-term loss to train the network. The calculation formula is: L G = 0.5 * L p + 0.006 * L x + 0.01L adv Among them, L adv includes the global and local discriminator losses, and L p is the mean squared error loss, and L x is the perceptual distance loss.

6. A method for denoising and enhancing industrial metal surface defect images according to claim 1, characterized in that, The calculation formula of the G(i,j) is: where D is the global mean square error of the image, which is a constant; σ x (i, j) is the local standard deviation centered on the pixel point (i, j); The D also includes the function of controlling the high-frequency enhancement degree again through the Amount parameter.