CN115829967A - Industrial metal surface defect image denoising and enhancing method - Google Patents
Industrial metal surface defect image denoising and enhancing method Download PDFInfo
- Publication number
- CN115829967A CN115829967A CN202211529412.5A CN202211529412A CN115829967A CN 115829967 A CN115829967 A CN 115829967A CN 202211529412 A CN202211529412 A CN 202211529412A CN 115829967 A CN115829967 A CN 115829967A
- Authority
- CN
- China
- Prior art keywords
- image
- denoising
- pixel point
- algorithm
- enhancement
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Image Processing (AREA)
Abstract
The invention discloses a denoising and enhancing method for an industrial metal surface defect image, which comprises the steps of denoising an original image by adopting combined median filtering denoising and optimized wavelet threshold denoising; carrying out deblurring processing on the denoised picture by adopting a DeBlurGAN V2 method; and comparing and enhancing the deblurred image by adopting a UACE algorithm to obtain a final image. The peak signal-to-noise ratio, the contrast and the information entropy of the enhanced image are improved, and the method provided by the invention is proved to be capable of eliminating the noise in the image and effectively improving the contrast of the image.
Description
Technical Field
The invention relates to the technical field of image processing, in particular to a method for denoising and enhancing an industrial metal surface defect image.
Background
The defect detection of the industrial metal surface plays an important role in industrial production, the detection is completed manually by means of external equipment in the traditional detection method, and the problems of false detection, missing detection, low efficiency and the like are caused due to different detection standards. With the research and development of machine vision, the method has excellent effects in many fields, and provides a new direction for detecting the surface defects of the electronic commutator. In the process of detecting defects on the surface of industrial metal, due to the influences of the acquisition environment of an image, photographing equipment, an external light source and the like, the obtained image often has the problems of high noise, low contrast, blurred details and the like, and is not beneficial to the detection of subsequent defects (Ge Wan Kai, zhao Shi Hai, van Yu Jia, fabric surface defect image enhancement algorithm based on contrast-limited histogram equalization and unsharp mask [ J ] wool spinning technology, 2021,49 (12): 68-74.). In order to improve the precision of industrial metal surface defect detection, the image acquired by the camera needs to be denoised and enhanced, the detail edge information of the image is highlighted, the contrast of the image is enhanced, the influence of noise on the image is reduced, and the quality of the image is improved.
The industrial metal surface defect image is denoised and enhanced, and the noise of the industrial metal surface image is eliminated and the defect part of the electronic commutator is highlighted so as to enhance the accuracy of subsequent defect detection. The image enhancement method comprises image denoising, image deblurring, image contrast enhancement and the like. The image denoising comprises traditional algorithms such as median filtering denoising, gaussian filtering denoising, wavelet threshold denoising and the like. Tang super et al (Tang super, left billow, li Xiaofei.) combine the image denoising algorithm [ J ] of the trimmed mean value and the Gaussian weighted median filter computer engineering, 2021,47 (09): 210-216.) through the method of the trimmed mean value and the Gaussian weighted median filter, on the premise of removing noise, the edge details of the image are well preserved, but the random value impulse noise and the Gaussian noise are not removed. Chen shun et al (Chenshun, lideng, color image edge detection based on multilayer wavelet threshold function [ J ] computer application) effectively improve the continuity and noise immunity of the edge in edge detection by providing a color image edge detection method of multilayer wavelet threshold denoising function, but only limited to the removal of white noise and Gaussian noise. The contrast enhancement of the image includes traditional algorithms such as histogram-based contrast enhancement, pixel-based contrast enhancement and Retinex-based contrast enhancement. The adaptive correction-based dynamic histogram equalization algorithm proposed by yankee et al (yankee, lihua, tian chen, 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 better enhancement effect in low-profile images, but the algorithm has a poor effect under strong light or high brightness conditions. Chen literature art et al (Chen literature, yan Chen, yanghe, guide filtering and logarithm transformation algorithm fused multi-scale Retinex infrared image enhancement [ J ] infrared technology, 2022,44 (04): 397-403) introduce guide filtering and logarithm transformation into MSR algorithm by guide filtering and logarithm transformation fused multi-scale Retinex infrared image enhancement method, effectively improving the quality of infrared image, but the algorithm has poor effect in other image data concentration.
Disclosure of Invention
Based on the defects in the prior art, the invention provides a method for denoising and enhancing an industrial metal surface defect image, which has the following specific technical scheme:
a denoising and enhancing method for industrial metal surface defect images comprises the following steps:
step 1: denoising an original image by adopting combined median filtering denoising and optimized wavelet threshold denoising;
step 2: carrying out deblurring processing on the denoised picture by adopting a DeBlurGAN V2 method;
and step 3: and (5) comparing and enhancing the deblurred image by adopting a UACE algorithm to obtain a final image.
Specifically, the calculation formula of median filtering denoising in step 1 is:
g(x,y)=med{f(x-i),(y-i)};(i,j)∈S m,n
wherein 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 field of the target pixel point, g (x, y) is the gray value output after median filtering, S m,n Is a filter.
Specifically, the wavelet threshold denoising optimized in step 1 includes the following substeps:
step 101: converting the RGB image into a YUV image;
step 102: dividing a Y space domain of the YUV image into a low-frequency space and a high-frequency space by using wavelet decomposition;
step 103: removing background noise in a high-frequency space and removing salt and pepper noise in a low-frequency space;
step 104: performing wavelet fusion on the high-frequency space and the low-frequency space to form a new Y space domain;
step 105: and converting the YUV spatial domain back to the RGB spatial domain to obtain the denoised RGB image.
Specifically, the method for DeBlurGAN V2 in step 2 replaces normal convolution with deep separable convolution to reduce the complexity of the network, including feature output of 5 scales, wherein the features are up-sampled to 1/4 of the original image and re-spliced to form a new whole, and two up-sampling modules are connected to restore the original image size and reduce artifacts;
the output also adds a tanh activation function to ensure the dynamic range of the generated image.
Specifically, the DeBlurGAN V2 method further includes the step of normalizing the input image to [ -1,1 ].
Specifically, the DeBlurGAN V2 method further includes a loss function, where the loss function uses a mixed three-term loss to train the network, and the calculation formula is:
L G =0.5*L p +0.006*L x +0.01L adv
wherein L is adv Involving global and local discriminator losses, L p Is a loss of mean square error, L x To perceive a loss of distance.
Specifically, the UACE algorithm described in step 3 includes a unsharp mask method and a local adaptive contrast enhancement method, and 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)]
wherein f (i, j) is the pixel value of the pixel point (i, j) in the enhanced image; m (i, j) is a local mean value with the pixel point (i, j) as the center; g (i, j) is a gain coefficient; and x (i, j) is the pixel value of the pixel point (i, j) in the original image.
Specifically, the formula for G (i, j) is:
d is the global mean square error of the image and is a constant; sigma x (i, j) is centered on the pixel point (i, j)
Wherein, local standard deviation;
said D also comprises the function of controlling again the degree of high frequency enhancement by means of the Amount parameter.
Specifically, the unsharp masking method optimizes a high-pass filter in a traditional unsharp masking, combines Gaussian filtering and mean filtering to replace the original high-pass filter, and can effectively inhibit the over-enhancement phenomenon of an image and protect the edge information of the image;
the calculation formula of the unsharp mask method is as follows:
y(i,j)=x(i,j)+λz(i,j)
wherein x (i, j) is an input image; y (i, j) is the output image; λ is the enhancement coefficient; z (i, j) is the result of gaussian filtering the input image x (i, j).
The invention can achieve the following beneficial effects:
1) The peak signal-to-noise ratio, the contrast and the information entropy of the enhanced image are improved, and the method provided by the invention is proved to be capable of eliminating the noise in the image and effectively improving the contrast of the image.
Drawings
FIG. 1 is a flow chart of a method of the present invention;
FIG. 2 is a flow chart of the denoising algorithm of the present invention;
FIG. 3 is an architectural diagram of the DeBlurGAN V2 of the present invention;
FIG. 4 is a flow chart of the image contrast enhancement algorithm UACE of the present invention;
FIG. 5 is a diagram of the enhancement result of the present invention on the original image 1;
FIG. 6 is a diagram of the enhancement result of the present invention on the original image 2;
fig. 7 is a diagram of the enhancement result of the present invention on the original image 3.
Detailed Description
In order to more clearly understand the technical features, objects, and effects of the present invention, embodiments of the present invention will now be described with reference to the accompanying drawings.
Example 1
The method is shown in figures 1-4, the research objects of the experiment of the invention are industrial metal surface defect pictures which are derived from a public data set Kolektor SDD2, the experiment pictures are shown in figures 5-7, and the original image has low contrast and large noise interference, so that the image in the data set is processed by adopting the improved image enhancement algorithm of the invention to meet the requirement of subsequent defect detection. The invention has the advantages that the operation system is Windows10; the software configuration is Anaconda, pycharm; the programming language is python.
Subjective image quality index
Three groups of experiments in the experiment respectively perform image enhancement on the original image 1, the original image 2 and the original image 3 so as to verify the enhancement effect of the algorithm on the picture. In the three groups of experiments, (a) is an original image, (b) is an image obtained by three images after being subjected to combined median filtering denoising and an improved wavelet threshold denoising method, (c) is an image obtained by the denoised image after being subjected to deblurring by a DeBlurGAN V2, and (d) is a final enhanced image obtained by the deblurred image through a UACE algorithm. The result shows that (b) the denoising algorithm of the invention can effectively eliminate white noise points in the original image, but the denoised image becomes fuzzy, which is not beneficial to the subsequent contrast enhancement; (c) The illustrated deblurred image is sharper than before deblurring; (d) After the deblurred image is enhanced by the improved contrast enhancement algorithm, the contrast of the original image is improved, and the edge detail information of the image is also improved.
Objective image quality evaluation
In order to objectively evaluate the enhancement effect, five image quality objective indexes of MSE, PSNR, SSIM, information entropy and image contrast are introduced to evaluate the experimental result of the test chart
MSE represents the mean square error of an image and is one of the most common algorithms for determining image quality. MSE is used to evaluate the degree of difference at the pixel level between the restored image I and the original image K. A smaller value of MSE indicates better image quality after restoration. The calculation formula of MSE is as follows:
where M represents the total number of pixels in the restored image I and N is the sum of pixels in the original image K.
PSNR represents the peak signal-to-noise ratio of an image and is one of the commonly used parameters for measuring image quality. PSNR is an objective index used to evaluate the noise level or the structural integrity of image information. The larger the value of PSNR, the less noise and distortion the picture is subjected to, and the higher the quality of the generated image. The PSNR calculation formula is as follows:
SSIM represents the structural similarity of two images, and is an index for measuring the similarity of two images. When the two images are identical, the value of SSIM is 1. The larger the value of SSIM, the more similar the enhanced image is to the original image. The formula for SSIM is as follows:
in the formula, mu x Is the average value of x, μ y Is the average value of y and is,is the variance of x and is,is the variance of y, c 1 And c 2 Is a constant used to maintain stability.
The information entropy represents the amount of information contained in one image, and the larger the information amount of the image is, the larger the information entropy is. Its calculation formula is as follows:
where i represents the gray scale value of a pixel in the image, P i Indicating the probability of a pixel with a gray value i appearing in the entire image.
Image contrast represents the proportional or logarithmic difference between the brightest and darkest portions of an image, and is typically expressed as EME. The higher the contrast of the image, the larger the EME, and the more obvious the image enhancement effect.
Table 1 shows the results of different denoising algorithms after denoising different pictures. As can be seen from Table 1, the PSNR values of three different processed images by the denoising method are all larger than those of other denoising methods, which shows that the noise and distortion of the images denoised by the denoising method are less, and the quality of the images is higher.
TABLE 1 Peak SNR for different image processing with different denoising algorithms
Table 2 shows the index sizes of three different images before and after the deblurring algorithm by the DeBlurGAN V2. As can be seen from Table 2, the MSE of the image processed by the DeBlurGAN V2 deblurring algorithm is smaller than that before deblurring, which indicates that the deblurred image has better quality; PSNR and SSIM are larger than those before deblurring, which shows that the deblurred picture is more similar to the original picture and the quality of the picture is improved.
TABLE 2 Objective evaluation results before and after deblurring of the image
Table 3 shows the index size of three different images before and after the ACE algorithm and the UACE algorithm of the present invention. As can be seen from table 3, although the value of the entropy of the image information enhanced by the ACE algorithm is increased, the value of the contrast is decreased, which shows that the information of the image enhanced by the ACE algorithm is increased, but the effect of the image enhancement is deteriorated. The values of the information entropy and the contrast of the picture enhanced by the UACE algorithm are larger than the values before enhancement, which shows that the picture enhanced by the UACE algorithm not only has increased information quantity, but also has more obvious image enhancement effect.
TABLE 3 Objective evaluation results of different contrast enhancement processing images
The foregoing shows and describes the general principles and broad features of the present invention and advantages thereof. It will be understood by those skilled in the art that the present invention is not limited to the embodiments described above, which are described in the specification and illustrated only to illustrate the principle of the present invention, but that various changes and modifications may be made therein without departing from the spirit and scope of the present invention, which fall within the scope of the invention as claimed.
Claims (9)
1. A denoising and enhancing method for industrial metal surface defect images is characterized by comprising the following steps:
step 1: denoising an original image by adopting combined median filtering denoising and optimized wavelet threshold denoising;
step 2: carrying out deblurring processing on the denoised picture by adopting a DeBlurGAN V2 method;
and step 3: and comparing and enhancing the deblurred image by adopting a UACE algorithm to obtain a final image.
2. The method as claimed in claim 1, wherein the median filtering denoising in step 1 is calculated by:
g(x,y)=med{f(x-i),(y-i)};(i,j)∈S m,n
wherein 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 field of the target pixel point, g (x, y) is the gray value output after median filtering, S m,n Is a filter.
3. The method for denoising and enhancing the image of the defect on the surface of the industrial metal according to claim 1, wherein the optimized wavelet threshold denoising in step 1 comprises the following sub-steps:
step 101: converting the RGB image into a YUV image;
step 102: dividing a Y space domain of the YUV image into a low-frequency space and a high-frequency space by using wavelet decomposition;
step 103: removing background noise in a high-frequency space and removing salt and pepper noise in a low-frequency space;
step 104: performing wavelet fusion on the high-frequency space and the low-frequency space to form a new Y space domain;
step 105: and converting the YUV spatial domain back to the RGB spatial domain to obtain the denoised RGB image.
4. The method as claimed in claim 1, wherein the DeBlurGAN V2 method replaces the normal convolution with a deep separable convolution to reduce the complexity of the network, and comprises outputting 5-scale features, which are up-sampled to 1/4 of the original image and re-spliced to a new whole, and connecting two up-sampling modules to restore the original image size and reduce artifacts;
the output also adds a tanh activation function to ensure the dynamic range of the generated image.
5. The method of claim 4, wherein the DeBlurGAN V2 method further comprises normalizing the input image to [ -1,1 ].
6. The method of claim 4, wherein the DeBlurGAN V2 method further comprises a loss function, the loss function is trained on a network using mixed trinomial losses, and the calculation formula is as follows:
L G =0.5*L p +0.006*L x +0.01L adv
wherein L is adv Involving global and local discriminator losses, L p Is a loss of mean square error, L x To perceive a loss of distance.
7. The method as claimed in claim 1, wherein the UACE algorithm in step 3 includes unsharp masking method and local adaptive contrast enhancement method, and 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)]
wherein f (i, j) is the pixel value of the pixel point (i, j) in the enhanced image; m (i, j) is a local mean value with the pixel point (i, j) as the center; g (i, j) is a gain coefficient; and x (i, j) is the pixel value of the pixel point (i, j) in the original image.
8. The method as claimed in claim 7, wherein the formula of G (i, j) is calculated as:
d isThe global mean square error of the image is a constant; sigma x (i, j) is the local standard deviation centered on the pixel point (i, j);
the D also includes the function of controlling again the degree of high frequency enhancement by means of the Amount parameter.
9. The method for denoising and enhancing the image of the industrial metal surface defect according to claim 7, wherein the unsharp masking method optimizes a high-pass filter in a traditional unsharp masking, combines Gaussian filtering and mean filtering to replace the original high-pass filter, and the optimized unsharp masking method not only can effectively inhibit the phenomenon of the image over-enhancement, but also can protect the edge information of the image;
the calculation formula of the unsharp mask method is as follows:
y(i,j)=x(i,j)+λz(i,j)
wherein x (i, j) is an input image; y (i, j) is the output image; λ is the enhancement coefficient; z (i, j) is the result of gaussian filtering the input image x (i, j).
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211529412.5A CN115829967A (en) | 2022-11-30 | 2022-11-30 | Industrial metal surface defect image denoising and enhancing method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211529412.5A CN115829967A (en) | 2022-11-30 | 2022-11-30 | Industrial metal surface defect image denoising and enhancing method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115829967A true CN115829967A (en) | 2023-03-21 |
Family
ID=85533520
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211529412.5A Pending CN115829967A (en) | 2022-11-30 | 2022-11-30 | Industrial metal surface defect image denoising and enhancing method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115829967A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117635616A (en) * | 2024-01-26 | 2024-03-01 | 江西科技学院 | Image diagnosis system for mutual recognition of medical examination results |
-
2022
- 2022-11-30 CN CN202211529412.5A patent/CN115829967A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117635616A (en) * | 2024-01-26 | 2024-03-01 | 江西科技学院 | Image diagnosis system for mutual recognition of medical examination results |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111986120A (en) | Low-illumination image enhancement optimization method based on frame accumulation and multi-scale Retinex | |
CN110889812B (en) | Underwater image enhancement method for multi-scale fusion of image characteristic information | |
CN108090886B (en) | High dynamic range infrared image display and detail enhancement method | |
CN109377450B (en) | Edge protection denoising method | |
CN112561804A (en) | Low-illumination underwater image enhancement method based on multi-scale detail enhancement | |
CN110232670B (en) | Method for enhancing visual effect of image based on high-low frequency separation | |
Al-Hatmi et al. | A review of Image Enhancement Systems and a case study of Salt &pepper noise removing | |
Wang et al. | An improved image blind deblurring based on dark channel prior | |
KR20140109801A (en) | Method and apparatus for enhancing quality of 3D image | |
CN115829967A (en) | Industrial metal surface defect image denoising and enhancing method | |
CN110675332A (en) | Method for enhancing quality of metal corrosion image | |
Charmouti et al. | Extended median filter for salt and pepper noise in image | |
CN110717869A (en) | Underwater turbid image sharpening method | |
GUAN et al. | A dual-tree complex wavelet transform-based model for low-illumination image enhancement | |
El Abbadi et al. | Improve image de-blurring | |
CN114529518A (en) | Image pyramid and NLM-based image enhancement method for cryoelectron microscope | |
Kansal et al. | Effect of non uniform illumination compensation on dehazing/de-fogging techniques | |
Pan et al. | Underwater image visibility improving algorithm based on HWD and DehazeNet | |
Yang et al. | Brightening and denoising lowlight images | |
Kusnik et al. | On the Application of Robust Mean Shift Procedure for the Enhancement of Noisy Color Images | |
Agrawal | Analyzing the Performance of Image Denoising Techniques | |
CN116681629B (en) | Visible light image self-adaptive contrast enhancement method and system for main transformer of transformer substation | |
Dhar et al. | A novel method for underwater image segmentation based on M-band wavelet transform and human psychovisual phenomenon (HVS) | |
CN113313670B (en) | Underwater illumination non-uniform image enhancement method based on alternate direction multiplier method | |
Deng et al. | Shearlet-based image denoising using adaptive thresholding and non-local means filter |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |