A method for adding noise to a color image

By segmenting the bright areas in low-light images and adding noise of different sizes, the problem of loss of dark area details caused by noise in existing technologies is solved, thereby improving image quality and visibility.

CN117291820BActive Publication Date: 2026-01-02HEFEI JUNZHENG TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210687703.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-16
Publication Date
2026-01-02
Estimated Expiration
2042-06-16

AI Technical Summary

Technical Problem

In the process of low-light image enhancement, existing methods add fixed or random Gaussian noise to the entire image, which leads to the loss of details in dark areas, and the noise level is unknown, affecting image quality.

Method used

By segmenting the image into different brightness regions, adding noise with different mean and variance (larger noise for brighter regions and smaller noise for darker regions), and then smoothing the image using Gaussian, a noisy image that more closely resembles the real noise distribution is generated.

Benefits of technology

It effectively avoids the loss of detail information in dark areas during network training, improves image quality, and enhances image visibility and detail preservation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117291820B_ABST
    Figure CN117291820B_ABST
Patent Text Reader

Abstract

The present application provides a method for adding noise to a color image, which divides different brightness regions of the image, and gives an interval for generating noise with random size. In addition, in the dark region, Gaussian noise obeying different standard deviation distribution can be generated; the generated noise is Gaussian blurred, so that the generated noise is closer to the real distribution, and finally the noise and the image are fused according to a certain proportion. The method can add different size noises in different brightness intervals, and in the dark region, a small amount of noise can be generated by selecting a smaller variance. By separating the light and dark regions and adding different size or different distribution noises, during network training, the loss of detail information and blurring caused by excessive smoothing of some structures in the network in the dark region are avoided.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of low-illumination image enhancement, and particularly relates to a method for adding noise to a color image. BACKGROUND

[0002] Due to a large number of camera devices, the images captured under insufficient light or shielding conditions are often dark, especially the images captured at night, and the target objects are basically invisible, and the images contain a large amount of noise, which is not conducive to face recognition or detection tasks.

[0003] At present, in the process of low-illumination images, various image acquisition devices are affected by the environment and the hardware itself when acquiring images, resulting in that the acquired images are affected by noise. In order to remove these noises and improve the quality of images, most of the existing methods are to directly add fixed Gaussian noise to the training images, or to randomly generate noise by setting different means and variances.

[0004] However, in the process of low-illumination image enhancement, randomly generating noise on the whole image will cause the details of the extremely dark region of the image to be covered by noise, and with multiple iterations of the network, the details of the dark region will be blurred, resulting in information loss. In addition, the size of the noise in different regions of the real image is unknown, and therefore, how to select a suitable noise becomes a problem to be solved.

[0005] Common terms in the prior art include:

[0006] Iteration: indicates that in the model training process, multiple images are input into the network each time, and when all the data are taken, it means that one iteration is performed.

[0007] Noise: some disordered information affecting the vision of an image, such as horizontal and vertical lines and disordered dots distributed on the image.

[0008] Gaussian distribution: in mathematics, it is called normal distribution, which indicates that the generated random data conforms to a certain rule.

[0009] Binary segmentation: setting a value to divide an image into two parts, one part of which has a pixel value less than the set value, and the other part has a pixel value greater than the set value. SUMMARY

[0010] In order to solve the problems in the prior art, the purpose of the present application is to generate noise with different means and variances and different sizes in different brightness regions, because the brightness distribution of dark images is different, and if Gaussian distribution noise with the same mean and variance is applied to the whole image or a larger noise is applied, the predicted image of the model will be excessively smooth and a large amount of detail information in the dark region will be lost.

[0011] In particular, the present application provides a method for adding noise to a color image, the method comprising the following steps:

[0012] S1, obtaining an image collected by a device, denoted as img;

[0013] S2, determining whether to perform binarization, i.e., binary segmentation, if yes, performing step S3; if no, performing step S7;

[0014] S3, selecting a threshold k, performing binarization, and dividing into a brightness region and a darkness region, wherein the brightness region performs step S4 operation, and the darkness region performs step S5 operation;

[0015] The step S3 further comprises:

[0016] Setting the threshold k for performing binary segmentation on the brightness and darkness regions, as formula (1):

[0017] th = threshold (img, k, max, method) / 255 (1)

[0018] Wherein, max represents that the pixel value corresponding to the threshold k is set to 255, and method represents the selected binarization method;

[0019] S4, adding noise noise_1 to the brightness region, and performing Gaussian smoothing;

[0020] S5, adding noise noise_2 to the darkness region, and performing Gaussian smoothing;

[0021] S6, combining the results of steps S1, S4 and S5, i.e., combining the image and the noise in proportion, the proportion being the same as that in S7, the data range being in [0, 1]; then performing step S8;

[0022] S7, combining the image and the noise in proportion, the proportion range being in [0, 1], as shown in formula: Wherein, is the generated noise, i.e., the noise added to the brightness region;

[0023] S8, according to the result of step S6, generating corresponding noise on the whole image to form a final noise image denoted as img_noise: the noise adding formula is shown as formula (5), and formula (5) represents generating corresponding noise on the whole image: (5)

[0024] Wherein, is the final generated noise image, and are respectively​​ 、 smoothed noise map, 、 Different noises are combined in a certain ratio.

[0025] The binarization method includes binarization threshold processing, that is, when the pixel value is greater than the threshold k, the value is set to 255, and if the pixel value is less than the threshold k, the value is set to 0.

[0026] The step S4 further includes:

[0027] Different sizes of noise are added to the bright area of the image. The noise added to the bright area is as formula (2),

[0028] noise_1=randn(mean=0, std=1)×random(min,max) (2)

[0029] Wherein, the region with greater brightness is given a random number in a certain interval, and the region with greater brightness is determined by the set threshold k, and the maximum value does not exceed 255, and the 、 respectively represent the mean and variance. The random number given in a certain interval is a value randomly generated in [min, max] and a standard normal distribution noise.

[0030] The step S5 further includes:

[0031] The size of the noise added to the dark area is as formula (3):

[0032] noise_2=randn(mean=1,std=std1) (3)

[0033] In the dark area, different std1 standard deviations are set to generate different distributions of small noise, and the size of the small noise is determined by setting the mean and variance The obtained does not have a specific data range.

[0034] In the steps S4 and S5, the two kinds of generated noise are respectively subjected to Gaussian smoothing processing to conform to the noise distribution in the real image, as shown in formula (4):

[0035] (4)

[0036] Wherein, represents a Gaussian smoothing function, is the generated noise, represents the smoothed noise, and respectively represent the window size of smoothing and the corresponding standard deviation.

[0037] In the step S7, the noise generation mode is as formula (2).

[0038] In the step S8, the noise generation mode is as formula (3). 、 The range of the noise is [0, 1].

[0039] Therefore, the advantages of the present application are as follows:

[0040] (1) Since noise is added to the whole image, the relatively dark area of the image is treated the same as the bright area, which leads to the generation of similar noise in the dark area as in the bright area. However, in fact, the noise on the image is unknown and subject to different mean or variance distributions. The method can add different sizes of noise in different brightness intervals, and a small amount of noise can be generated in the dark area by selecting a smaller variance.

[0041] (2) By separating the bright and dark areas and adding different sizes or different distributions of noise, during network training, the loss of detail information and blurring caused by excessive smoothing of some structures in the network in the dark area are avoided. BRIEF DESCRIPTION OF DRAWINGS

[0042] The accompanying drawings, which are included to provide a further understanding of the application and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application.

[0043] Figure 1 is a flow chart of the method of the present application. DETAILED DESCRIPTION

[0044] In order to more clearly understand the technical content and advantages of the present application, the present application will be further described in detail in conjunction with the drawings.

[0045] The present application belongs to the field of low-illumination image enhancement, and uses a deep learning method to convert a very dark image containing noise into a real image with a certain brightness and contrast, saturation, etc.

[0046] Specifically, a method for adding noise to different brightness regions of a color image is proposed, as shown in Figure 1 .

[0047] S1, obtaining an image collected by a device, denoted as img;

[0048] S2, determining whether to perform binarization, i.e., binary segmentation, if yes, then performing step S3; if no, then performing step S7;

[0049] S3, selecting a threshold k, performing binarization, and dividing into a brightness region and a darkness region, wherein the brightness region is subjected to step S4 operation, and the darkness region is subjected to step S5 operation; step S3: if binarization is performed, then a threshold k is set , for the light and dark area to be binary segmentation processing, such as formula (1):

[0050] th = threshold (img, k, max, method) / 255 (1)

[0051] Wherein, indicates the threshold k, set the corresponding pixel value for 255, indicates the selected binary method, such as binary threshold processing, that is, the value is set to 255 when the pixel value is greater than the threshold k, if the pixel value is less than the threshold k, then the value is 0;

[0052] S4, for the light area to add noise noise_1, Gaussian smoothing;

[0053] S5, for the dark area to add noise noise_2, Gaussian smoothing;

[0054] S6, the results of step S1, S4 and S5 are combined, that is, the image and noise are combined and added in proportion, the data range is in [0, 1]; Then step S8 is carried out;

[0055] S7, the image and noise are combined and added in proportion, the proportion range is in [0, 1], as shown in formula: Wherein, is the generated noise, and the noise generation method is as formula (2);

[0056] S8, according to the results of step S6, the corresponding noise is generated on the whole image to form the final noise image, which is denoted as img_noise: the noise adding formula is shown in formula (5), and formula (5) represents that the corresponding noise is generated on the whole image: (5)

[0057] Wherein, is the final generated noise image, and respectively, , smoothed noise image, , indicate that different noises are combined in a certain proportion.

[0058] Further, part of the steps further include the following:

[0059] Step S4, S5: add different size noise to the bright area of the image, the noise added in the bright area is as formula (2), and the noise added in the dark area is as formula (3):

[0060] ​noise_1=randn(mean=0, std=1) x random(min, max) (2)

[0061] noise_2=randn(mean=1, std=std1) (3)

[0062] Wherein, the region of greater brightness, given a certain interval of random number. Brightness of the region is determined by setting the threshold k, the maximum value does not exceed 255; in the formula , respectively represent the mean and variance. As in [min, max] random number and produce standard normal distribution noise, and in the dark area, set different std1 standard deviation of different distribution of smaller noise, smaller noise size is obtained by setting the mean and variance, there is no a specific data range;

[0063] The two kinds of noise generated are respectively Gaussian smoothing processing, to meet the noise distribution in real image, as shown in equation (4):

[0064] (4)

[0065] Wherein, indicates the Gaussian smoothing function, is the generated noise, indicates the noise after smoothing, and respectively represent the window size and the corresponding standard deviation of smoothing.

[0066] Step S8: according to the following formula (5) in the whole picture to produce the corresponding noise:

[0067] (5)

[0068] Wherein, is the final generated noise image, and respectively are , smoothed noise map, , indicate that different noise is combined according to a certain ratio. The range of , in [0, 1].

[0069] To sum up, the method of the application carries out segmentation on different brightness areas of an image, and gives an interval for generating random size noise. In addition, in the dark area, Gaussian noise obeying different standard deviation distribution can be generated; Gaussian blur is performed on the generated noise, so that the generated noise is closer to the real distribution, and finally the noise and the image are fused according to a certain proportion.

[0070] The above only describes the preferred embodiments of the present application and is not used to limit the present application. The embodiments of the present application can be variously changed and altered for those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for adding noise to a color image, characterized in that, The method includes the following steps: S1, the image acquired by the device is denoted as img; S2, determine whether to perform binarization, i.e., binary segmentation. If yes, proceed to step S3; otherwise, proceed to step S7. S3, Select a threshold k, perform binarization, and divide it into a bright region and a dark region. The bright region is processed by step S4, and the dark region is processed by step S5. Step S3 further includes: A threshold k is set to perform binary segmentation of the bright and dark areas, as shown in formula (1): th=threshold(img,k,max,method) / 255 (1) Where max indicates that the value exceeds the threshold k, and the corresponding pixel value is set to 255; method indicates the selected binarization method. S4, add noise_1 to the bright area and perform Gaussian smoothing; S5, add noise_2 to the dark areas and perform Gaussian smoothing; S6, combine the results of steps S1, S4 and S5, that is, combine the image and noise proportionally and add them together, with the value range in [0,1]; then proceed to step S8. S7, Image and noise scaled. When combined, the ratio ranges from [0, 1], as shown in the formula: ,in, For generated noise; S8. Based on the result of step S6, corresponding noise is generated on the entire image to form the final noise image denoted as img_noise. The noise addition formula is shown in formula (5), which means that corresponding noise is generated on the entire image. (5) Wherein, img_noise is the final generated noisy image, and noise_blur_1 and noise_blur_2 are the smoothed noise images of noise_1 and noise_2, respectively. , This indicates that different noises are combined in a certain ratio.

2. The method for adding noise to a color image according to claim 1, characterized in that, The binarization method includes binarization threshold processing, that is, when the pixel value is greater than the threshold k, the value is set to 255, and when the pixel value is less than the threshold k, the value is set to 0.

3. The method for adding noise to a color image according to claim 1, characterized in that, Step S4 further includes: Add noise of different sizes to the bright areas of the image. The noise added to the bright areas is as shown in formula (2). noise_1=randn(mean=0, std=1)×random(min,max) (2) In this context, the region with higher brightness is given a random number within a certain range, and the region with higher brightness is determined by a set threshold k, with a maximum value not exceeding 255; in the formula... , These represent the mean and variance, respectively.

4. A method for adding noise to a color image according to claim 3, characterized in that, The random number given a certain interval is generated randomly in [min, max] and produces standard normal distribution noise.

5. A method for adding noise to a color image according to claim 1, characterized in that, Step S5 further includes: The noise added to the dark area is as shown in equation (3): noise_2=randn(mean=1,std=std1) (3) In the dark area, setting different std1 standard deviations produces smaller noise with different distributions. The magnitude of the smaller noise is obtained by setting the mean and variance.

6. A method for adding noise to a color image according to claim 2 or 4, characterized in that, In steps S4 and S5, the two types of noise generated are Gaussian smoothed to conform to the noise distribution in the real image, as shown in equation (4): (4) in, Represents the Gaussian smoothing function. For the noise generated, This represents the smoothed noise. and These represent the smoothed window size and the corresponding standard deviation, respectively.

7. A method for adding noise to a color image according to claim 3, characterized in that, In step S7, the noise is generated in the manner described in equation (2).

8. A method for adding noise to a color image according to claim 1, characterized in that, In step S8, the following are included: , The range is [0,1].

Citation Information

Patent Citations

  • Bayer domain image noise reduction system and method based on non-local mean filtering

    CN110246089A

  • Medical video reading method based on ultrasound

    CN112446889A