Image noise addition method, apparatus, computer equipment and storage medium

By generating random numbers to select an appropriate noise model to update image pixel values, the problem of large differences between noisy images and real noisy images is solved, thus improving the denoising performance of neural network models.

CN119904371BActive Publication Date: 2026-04-03CAMBRICON TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-27
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

The noisy images constructed in the existing technology differ significantly from the real noisy images, which affects the denoising performance of neural network models.

Method used

By generating random numbers that satisfy a first preset uniform distribution, the image pixel values ​​are updated using a first noise model, a second noise model, and a third noise model. An appropriate noise model is selected based on the range of random numbers for each pixel, and readout noise and shot noise are added to ensure that the pixel values ​​are closer to the real noisy image.

Benefits of technology

This reduces the difference between the constructed noisy image and the real noisy image, making the training set more realistic and thus improving the denoising performance of the neural network model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119904371B_ABST
    Figure CN119904371B_ABST
Patent Text Reader

Abstract

This invention relates to the field of image processing technology, and discloses a method, apparatus, computer device, and storage medium for adding image noise. The computer device includes a memory and a processor, which are communicatively connected. The memory stores computer instructions, and the processor executes these instructions to perform the image noise addition method. This invention can reduce the difference between the constructed noisy image and the real noisy image, making the noisy image more realistic.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and more specifically to methods, apparatus, computer devices, and storage media for adding noise to images. Background Technology

[0002] Currently, AI-based image or video denoising solutions can generate noisy images by adding noise to clean images. These noisy images are then used as input to a neural network model, with the clean image serving as the label, to train the model and obtain a trained neural network capable of image denoising. However, this process uses a large number of noisy images to construct the training set for the neural network model. Due to technological limitations, the constructed noisy images differ significantly from real noisy images obtained through photography, severely impacting the denoising performance of the trained neural network model. Therefore, constructing noisy images that more closely resemble real noisy images is crucial. Summary of the Invention

[0003] In view of this, the present invention provides an image noise addition method, apparatus, computer device and storage medium to solve the problem of large differences between the constructed noisy image and the real noisy image in the related art.

[0004] In a first aspect, the present invention provides an image noise addition method, the method comprising:

[0005] Acquire the first image to which readout noise is to be added, the image noise including readout noise;

[0006] For each pixel in the first image, a first random number is generated that satisfies a first preset uniform distribution. The lower limit of the first preset uniform distribution is a first preset value, and the upper limit of the first preset uniform distribution is a second preset value.

[0007] If the first random number corresponding to the current pixel is less than the first threshold and greater than or equal to the first preset value, then the pixel value of the current pixel is updated based on the first noise model; the first threshold is the probability of a normal point in the first black frame image, and a normal point is a pixel that behaves normally in the first black frame image;

[0008] If the first random number corresponding to the current pixel is less than the second threshold and greater than or equal to the first threshold, then the pixel value of the current pixel is updated based on the second noise model; the second threshold is the sum of the probabilities of normal points and bad points of the first preset category in the first black frame image, and bad points are pixels that exhibit abnormal behavior in the first black frame image;

[0009] If the first random number corresponding to the current pixel is less than the second preset value and greater than or equal to the second threshold, then the pixel value of the current pixel is updated based on the third noise model.

[0010] The image noise addition method provided by this invention, in the process of adding readout noise to a first image, updates the pixel value of the current pixel by using a first noise model, a second noise model, or a third noise model according to the range of the first random number generated corresponding to each pixel in the first image, thereby adding readout noise to the first image. Moreover, in the selection process of the first noise model, the first uniform distribution upper and lower limits satisfied by the first random number, the probability of normal points in the first black frame image, and the sum of the probabilities of normal points and bad points of the first preset category in the first black frame image are used as evaluation factors. This makes the updated pixel value of the pixels in the first image closer to the overall distribution of pixel values ​​of the pixels in the real noisy image, thereby reducing the difference between the constructed noisy image and the real noisy image. This makes the noisy image after adding noise by this invention more realistic, and the training set can be constructed using the noisy image constructed by this invention to help improve the denoising performance of the trained neural network model.

[0011] In a second aspect, the present invention provides an image noise addition apparatus, the apparatus comprising:

[0012] The image acquisition module is used to acquire a first image to which readout noise is to be added, the image noise including readout noise;

[0013] The random number generation module is used to generate a first random number that satisfies a first preset uniform distribution for each pixel in the first image. The lower limit of the first preset uniform distribution is a first preset value, and the upper limit of the first preset uniform distribution is a second preset value.

[0014] The first update module is used to update the pixel value of the current pixel based on the first noise model, according to the first random number corresponding to the current pixel being less than the first threshold and greater than or equal to the first preset value; the first threshold is the probability of a normal point in the black frame image, and a normal point is a pixel in the black frame image that behaves normally.

[0015] The second update module is used to update the pixel value of the current pixel based on the second noise model, according to the first random number corresponding to the current pixel being less than the second threshold and greater than or equal to the first threshold; the second threshold is the sum of the probabilities of normal points and bad points of the first preset category in the black frame image, and bad points are pixels that exhibit abnormal behavior in the black frame image;

[0016] The third update module is used to update the pixel value of the current pixel based on the third noise model, according to the first random number corresponding to the current pixel being less than the second preset value and greater than or equal to the second threshold.

[0017] Thirdly, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the image noise addition method described in the first aspect or any corresponding embodiment thereof.

[0018] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to perform the image noise addition method described in the first aspect or any corresponding embodiment thereof. Attached Figure Description

[0019] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0020] Figure 1 This is a flowchart illustrating an image noise addition method according to an embodiment of the present invention;

[0021] Figure 2 This is a flowchart illustrating another image noise addition method according to an embodiment of the present invention;

[0022] Figure 3 This is a flowchart illustrating another image noise addition method according to an embodiment of the present invention;

[0023] Figure 4 This is a flowchart illustrating another image noise addition method according to an embodiment of the present invention;

[0024] Figure 5 This is a schematic diagram of a scatter plot constructed based on the mean and variance according to an embodiment of the present invention;

[0025] Figure 6 This is a schematic diagram of the fitting result of the histogram of the first preset category of defects according to an embodiment of the present invention;

[0026] Figure 7 This is a structural block diagram of an image noise addition device according to an embodiment of the present invention;

[0027] Figure 8 This is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0029] In related technologies, a neural network model with image denoising capabilities (e.g., a denoising network) can be trained by using a clean image as a label and a noisy image as input to the neural network model; the noisy image is obtained by adding noise to the clean image. A key point in adding noise to a clean image is to establish a noise model that approximates the noise in a real image. For example, random numbers that satisfy a Poisson distribution can be generated to simulate shot noise of photons, and random numbers that satisfy a Gaussian distribution can be generated to simulate readout noise independent of the optical signal. However, due to the technical limitations of related technologies, how to reasonably add readout noise and shot noise to an image has become a technical challenge in this field.

[0030] According to an embodiment of the present invention, an embodiment of an image noise addition method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0031] This embodiment provides a method for adding noise to an image, which can be used in computer devices. Figure 1 This is a flowchart of an image noise addition method according to an embodiment of the present invention, such as... Figure 1 As shown, the process includes the following steps:

[0032] Step S101: Obtain the first image to which readout noise is to be added, the image noise including readout noise.

[0033] Among them, readout noise is a type of noise that follows a Gaussian distribution and is independent of the optical signal. In this embodiment, readout noise can be added to the first image through the process of processing the first image described later.

[0034] In some optional implementations, prior to step S101 above, the image noise addition method may further include:

[0035] Step a1: Determine the probability of bad pixels of the first preset category by using the ratio of the number of bad pixels of the first preset category in the first black frame image to the total number of pixels in the first black frame image; and determine the probability of bad pixels of the second preset category by using the ratio of the number of bad pixels of the second preset category in the first black frame image to the total number of pixels in the first black frame image.

[0036] The first black frame image is an image or video taken in a completely dark environment.

[0037] Theoretically, the pixel value of each pixel in the first black frame image should be near the black level. This can be understood as a normal pixel being a pixel whose difference between its pixel value and the black level is less than a set value. The black level is approximately equal to the average pixel value of all pixels in the first black frame image. However, in reality, a small number of pixels will have excessively large or small pixel values; these pixels are called bad pixels. Based on whether the pixel value of a bad pixel changes over time across multiple consecutive black frames in the video, bad pixels are divided into dynamic bad pixels and static bad pixels. Generally, static bad pixels are characterized by their maximum or minimum pixel value, corresponding to the brightest or darkest appearance. Their statistical characteristics are simple, and static bad pixels are easily removed. In this embodiment, the bad pixels refer to dynamic bad pixels, which consist of bad pixels of the first preset category and bad pixels of the second preset category in this embodiment.

[0038] In this embodiment, it is assumed that the probability of bad pixels in the first preset category is r1 and the probability of bad pixels in the second preset category is r2. Taking the first black frame image captured by a camera with an IMX485 image sensor as an example, r1≈1% and r2≈0.02%.

[0039] Step a2: Determine the probability of normal points in the first black frame image based on the probability of bad points in the first preset category and the probability of bad points in the second preset category; the sum of the probability of bad points in the first preset category, the probability of bad points in the second preset category, and the probability of normal points is 100%.

[0040] Based on the foregoing examples, the probability of a normal point in this embodiment is 100% - the probability of a bad point in the first preset category - the probability of a bad point in the second preset category. For example, the probability of a normal point is approximately 100% - 1% - 0.02%.

[0041] In this embodiment, the number of two types of bad pixels was counted, and the probability of bad pixels in the first preset category and the probability of bad pixels in the second preset category were determined based on the number of bad pixels, and the probability of normal pixels was determined accordingly. In this embodiment, all pixels are divided into normal pixels, bad pixels in the first preset category and bad pixels in the second preset category. The probabilities of these three types of pixels are used as the basis for determining which noise model to use. It can be seen that the present invention can provide accurate data support for the selection of noise models.

[0042] In some optional implementations, prior to step a1 above, the image noise addition method further includes:

[0043] Step b1: Obtain multiple second black frame images, where the first black frame image is any one of the multiple second black frame images.

[0044] The second black frame image is an image or video taken in a completely dark environment.

[0045] Taking the second black frame image as an example, this embodiment shoots video in a completely dark environment. Assume that the video consists of N completely black images, where N represents the number of video frames, for example, N = 100.

[0046] Step b2: Based on the pixel values ​​of each pixel in the multiple second black frame images, determine the first mean and the first variance corresponding to each pixel in the first black frame image.

[0047] Based on the previous example, for 100 second black frame images, the first mean corresponding to each pixel in the first black frame image is the mean of the 100 pixel values, and the first variance corresponding to each pixel in the first black frame image is the variance of the 100 pixel values.

[0048] Step b3: Based on the first mean and first variance corresponding to each pixel, determine the normal points, the bad points of the first preset category, and the bad points of the second preset category in the first black frame image.

[0049] In this embodiment, based on the statistical analysis of pixel values ​​of pixels on multiple second black frame images, specifically, the first mean and first variance corresponding to each pixel on the first black frame image are analyzed, thereby distinguishing normal points, bad points of the first preset category and bad points of the second preset category in the first black frame image, so as to achieve the purpose of classifying pixels in the first black frame image, so as to realize the calibration of readout noise through the distinction of pixels.

[0050] In some alternative implementations, step b3 above includes:

[0051] Step c1: Construct a scatter plot based on the first mean and first variance corresponding to each pixel. The horizontal coordinate of the scatter plot is the first mean, and the vertical coordinate of the scatter plot is the first variance.

[0052] like Figure 5As shown, the scatter plot used in this embodiment is illustrated. The scatter plot corresponds one-to-one with the pixel. Each scatter point is distributed in a two-dimensional rectangular coordinate system. The horizontal axis of the two-dimensional rectangular coordinate system is the mean and the vertical axis is the variance. The number of (mean, variance) pairs corresponding to all pixel points is denoted as (m, v), where m represents the mean and v represents the variance.

[0053] Step c2: On the scatter plot, pixels corresponding to points outside the preset ellipse are identified as bad pixels, and pixels corresponding to points not outside the preset ellipse are identified as normal pixels. The x-coordinate of the center coordinate of the preset ellipse is the second mean, the y-coordinate of the center coordinate of the preset ellipse is the third mean, the major axis of the preset ellipse is the first preset multiple of the standard deviation of the first mean corresponding to each pixel, and the minor axis of the preset ellipse is the second preset multiple of the standard deviation of the first variance corresponding to each pixel. The second mean is the mean of the first mean corresponding to each pixel, and the third mean is the mean of the first variance corresponding to each pixel.

[0054] Based on the example above, calculate the mean for all pairs (m, v) of (mean, variance). and standard deviation (σ) m ,σ v In this embodiment This represents the second mean. σ represents the third mean. m σ represents the standard deviation of the first mean. v This represents the standard deviation of the first variance.

[0055] In this embodiment, the expression for the preset ellipse is specifically as follows:

[0056] In this embodiment, both the first preset multiple and the second preset multiple can be 3. This is because in this embodiment, pixels whose pixel values ​​deviate from the mean by more than 3 times the standard deviation are considered to be pixels that conform to abnormal linearity.

[0057] Step c3: Create a preset straight line on the scatter plot, and take the bad points on the left side of the preset line as bad points of the first preset category, and the bad points on the right side of the preset line as bad points of the second preset category.

[0058] Among them, the bad points on the left side of the preset line are scattered points with small mean deviation and relatively large variance deviation, and are regarded as bad points of the first preset category; the bad points on the right side of the preset line are scattered points with large deviations in both mean and variance, and are regarded as bad points of the second preset category.

[0059] The expression for the preset straight line in this embodiment is y = ax + b, where the specific values ​​of a and b can be reasonably set according to the actual distribution of scattered points.

[0060] This embodiment can also create a scatter plot based on the first mean and first variance of each pixel, and analyze the characteristics of the mean and variance of the pixel value of each pixel changing over time based on the scatter plot. It includes taking the pixels circled by the preset ellipse as normal points, taking the pixels outside the preset ellipse as bad points, and dividing the bad points into a first preset category and a second preset category by the preset straight line, so as to more accurately distinguish normal points, bad points of the first preset category and bad points of the second preset category.

[0061] In some optional implementations, prior to step S101 above, the image noise addition method may further include:

[0062] Step d1: Obtain the second image to be added with shot noise. The second image is the clean original image.

[0063] In this embodiment, a clean, raw image is referred to as a clean image (raw image).

[0064] Step d2: Add shot noise to the second image to obtain the first image.

[0065] Shot noise is a type of noise that follows a Poisson distribution and is related to the optical signal. In this embodiment, shot noise can be added to a second image through the process of processing a clean original image.

[0066] Specifically, for each pixel in a clean raw image, perform the following operation: subtract the black level from the pixel value of each pixel, and then divide by αg. A The obtained value is used as the mean of the Poisson distribution. Then, random numbers are generated based on this mean. The generated random numbers are multiplied by αg. A Adding the black level, we can obtain the pixel value after adding Poisson noise. The Poisson distributed random numbers can be generated, for example, using the library function `random.poisson(lambda)` in NumPy (an open-source scientific computing library); where α represents a coefficient related to photoelectric conversion efficiency, and g... A This indicates the preset analog signal gain (a known parameter).

[0067] This embodiment calibrates α as follows: A set of still photographs, such as several frames, is acquired, and the (simulated) gain g is recorded. In this embodiment, a set of still photographs may include 100 frames, thereby more accurately calculating the pixel mean and variance. For the scene of photograph acquisition, brightness diversity is ensured as much as possible; a standard color chart can be photographed, and the stability of the camera and the brightness of the light source during shooting is ensured, i.e., ensuring that the captured scene is static; the mean and variance of the pixel values ​​of the pixels in the aforementioned 100 frames are calculated respectively, through... The fitting method yields the slope, which, when divided by g, gives the parameter α (scaling factor); where EX represents the mean, DX represents the variance, δ represents the black level, and σ1 and σ2 represent two readout noise parameters.

[0068] The embodiments of the present invention can be used to add shot noise and readout noise to a clean original image, thereby improving the approximation of the constructed noisy image to the real noisy image.

[0069] Step S102: For each pixel in the first image, generate a first random number that satisfies a first preset uniform distribution. The lower limit of the first preset uniform distribution is a first preset value, and the upper limit of the first preset uniform distribution is a second preset value.

[0070] Specifically, this embodiment can determine the range of the first random number and execute the following steps based on the determination result. The range of the first random number includes: the first random number corresponding to the current pixel is less than a first threshold and greater than or equal to a first preset value; the first random number corresponding to the current pixel is less than a second threshold and greater than or equal to the first threshold; and the first random number corresponding to the current pixel is less than a second preset value and greater than or equal to the second threshold. In all embodiments of this invention, the random number is a random variable.

[0071] In this embodiment, the first preset value is greater than or equal to 0, and the second preset value is less than or equal to 1. For example, the first preset uniform distribution is specifically a uniform distribution of [0,1], that is, the first preset value can be 0, and the second preset value can be 1; in this embodiment, a first random number between 0 and 1 can be generated when using a noise model. The first random number can be represented by P, and the value of P determines which noise model is used to update the pixel value of the current pixel.

[0072] Specifically, in this embodiment, the first random number can be compared with the first preset value, the first threshold, the second threshold, and the second preset value, and the following steps S103, S104, or S105 can be executed based on the comparison result.

[0073] Step S103: If the first random number corresponding to the current pixel is less than the first threshold and greater than or equal to the first preset value, then update the pixel value of the current pixel based on the first noise model; the first threshold is the probability of a normal point in the first black frame image, and a normal point is a pixel in the first black frame image that behaves normally.

[0074] Specifically, the probability of a normal point in the first black frame image can be represented by p1. In conjunction with the aforementioned embodiments, the probability of a normal point is p1 = 1 - r1 - r2 = 100% - 1% - 0.02% = 98.98%, but it is not limited to this.

[0075] Among them, the current pixel is any pixel on the first image, and the first noise model is a mathematical model for describing readout noise. Specifically, the first noise model is the noise model of normal points.

[0076] In this embodiment, the first noise model can be expressed in the following way:

[0077] X A = g A αU + g\ A N1 + N2 + b, 0 ≤ P < p1

[0078] Among them, X A represents the updated pixel value, g A represents the preset analog signal gain, α represents a coefficient related to the photoelectric conversion efficiency, U represents a random number satisfying a Poisson distribution with a mean of (EX A - b) / g A α, EX A is the mathematical expectation of the pixel value X A , N1 represents the second random number satisfying the first preset normal distribution, N2 represents the third random number satisfying the second preset normal distribution, and b represents the black level; g A αU is used to describe the optical signal of Poisson noise, and g A N1 + N2 is used to represent the normal point noise model of the black frame image.

[0079] If 0 ≤ P < p1, it means that the current pixel is a normal point, and then the pixel value of the current pixel is updated using the above first noise model.

[0080] Step S104, if the first random number corresponding to the current pixel is less than the second threshold and greater than or equal to the first threshold, then update the pixel value of the current pixel based on the second noise model; the second threshold is the sum of the probabilities of normal points and bad points of the first preset category in the first black frame image, and the bad points are the pixels with abnormal performance in the first black frame image.

[0081] Specifically, the sum of the probabilities of normal points and bad points of the first preset category in the first black frame image can be represented by p2. Combining with the foregoing embodiments, the sum of the probabilities of normal points and bad points of the first preset category in the first black frame image, p2 = 1 - r2 = 100% - 0.02% = 99.98%, of course, it is not limited to this.

[0082] Among them, the second noise model is a mathematical model for describing readout noise, and the second noise model is specifically the noise model of bad points of the first preset category.

[0083] In this embodiment, the second noise model can be expressed in the following way:

[0084] X A = g A αU + B1, p1 ≤ P < p2

[0085] Where, X A represents the updated pixel value, g A represents the preset analog signal gain, α represents a coefficient related to the photoelectric conversion efficiency, U represents a random number satisfying a Poisson distribution with a mean of (EX A - b) / g A α, b represents the black level, B1 represents the fourth random number satisfying the third preset normal distribution or the fifth random number satisfying the fourth preset normal distribution or the sixth random number satisfying the fifth preset normal distribution; g A αU is used to describe the optical signal of Poisson noise, and B1 is used to represent the noise model of the bad pixels of the first preset category in the black frame image.

[0086] If p1 ≤ P < p2, it means that the current pixel is a bad pixel of the first preset category, and then use the above second noise model to update the pixel value of the current pixel.

[0087] Step S105, if the first random number corresponding to the current pixel is less than the second preset value and greater than or equal to the second threshold, then update the pixel value of the current pixel based on the third noise model.

[0088] Where, the third noise model is a mathematical model used to describe the readout noise, and the third noise model is specifically the noise model of the bad pixels of the second preset category.

[0089] In this embodiment, the third noise model can be expressed as follows:

[0090] X A = g A αU + B2, p2 ≤ P ≤ 1

[0091] Where, X A represents the updated pixel value, g A represents the preset analog signal gain, α represents a coefficient related to the photoelectric conversion efficiency, U represents a random number satisfying a Poisson distribution with a mean of (EX A - b) / g A α, b represents the black level, B2 represents the eighth random number satisfying the third preset uniform distribution; g A αU is used to describe the optical signal of Poisson noise, and B2 is used to represent the noise model of the bad pixels of the second preset category in the black frame image.

[0092] If p2 ≤ P ≤ 1, it means that the current pixel is a bad pixel of the second preset category, and then use the above third noise model to update the pixel value of the current pixel.

[0093] In this embodiment, p1 and p2 are calculated based on the defective pixel rate. The purpose of the above operation is to achieve the following result: the majority of pixels use the noise model of normal pixels (first noise model), and the proportion of pixels using the noise model of defective pixels (second noise model and third noise model) is the corresponding defective pixel rate.

[0094] In this embodiment, during the process of adding readout noise to the first image, the pixel value of the current pixel is updated according to the range of the first random number generated for each pixel in the first image, using either a first noise model, a second noise model, or a third noise model. This adds readout noise to the first image. Furthermore, in the selection process of the first noise model, the upper and lower limits of the first uniform distribution satisfied by the first random number, the probability of normal points in the first black frame image, and the sum of the probabilities of normal points and bad points of the first preset category in the first black frame image are used as evaluation factors. This makes the updated pixel values ​​of the pixels in the first image closer to the overall distribution of pixel values ​​in the real noisy image, thereby reducing the difference between the constructed noisy image and the real noisy image. This makes the noisy image after adding noise using this invention more realistic, and the training set can be constructed using the noisy image constructed by this invention, which helps to improve the denoising performance of the trained neural network model.

[0095] This embodiment provides a method for adding noise to an image, which can be used in computer devices. Figure 2 This is a flowchart of an image noise addition method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:

[0096] Step S201: Obtain the first image to which readout noise is to be added. The image noise includes readout noise. For details, please refer to [link to relevant documentation]. Figure 1 Step S101 of the illustrated embodiment will not be described again here.

[0097] Step S202: For each pixel in the first image, generate a first random number that satisfies a first preset uniform distribution. The lower limit of the first preset uniform distribution is a first preset value, and the upper limit of the first preset uniform distribution is a second preset value. For details, please refer to [link to details]. Figure 1 Step S102 of the illustrated embodiment will not be described again here.

[0098] Step S203: If the first random number corresponding to the current pixel is less than the first threshold and greater than or equal to the first preset value, then update the pixel value of the current pixel based on the first noise model; the first threshold is the probability of a normal point in the first black frame image, and a normal point is a pixel that behaves normally in the first black frame image.

[0099] Specifically, the above-mentioned updating of the pixel value of the current pixel based on the first noise model includes:

[0100] Step S2031: Generate a second random number that satisfies a first preset normal distribution, and determine the product of the second random number and the preset analog signal gain; and generate a third random number that satisfies a second preset normal distribution.

[0101] In conjunction with the foregoing embodiments, the noise model for the black frame is the noise model obtained by removing illumination from the first noise model: X A =g A N1+N2. The goal of calibrating this noise is to determine the variance or standard deviation of the two normal distributions in the calibration formula. Taking the variance of the above formula yields: Variance and g A The relationship is a quadratic function relationship, in multiple g A Under the condition of [condition], collect several black frames, and for each g A The variance of the corresponding black frame is calculated to obtain the DX. A Then fit the variance and g A The relationship can be used to obtain σ. A and σ B Two parameters.

[0102] Specifically, the second random number satisfying the first preset normal distribution is denoted as N1, the third random number satisfying the second preset normal distribution is denoted as N2, and the product of the second random number and the preset analog signal gain is denoted as g. A N1.

[0103] In this embodiment, the first preset normal distribution is a distribution with a standard deviation of σ. A The first is a normal distribution with a mean of 0, and the second is a normal distribution with a standard deviation of σ. B A normal distribution with a mean of 0.

[0104] Step S2032: Use the product, the third random number, and the sum of the pixel values ​​before the current pixel is updated as the updated pixel value of the current pixel.

[0105] Specifically, this embodiment uses g A N1+N2, the updated pixel value is represented as the pixel value before the update and g. A The sum of N1 and N2.

[0106] In this embodiment, when the current pixel is determined to be a normal pixel, the pixel value of the current pixel is updated based on the product of the second random number and the preset analog signal gain and the third random number. Specifically, this achieves the purpose of updating the pixel value of the current pixel through the normal point noise model representing the black frame image.

[0107] This embodiment provides a method for adding noise to an image, which can be used in computer devices. Figure 3 This is a flowchart of an image noise addition method according to an embodiment of the present invention, such as... Figure 3 As shown, the process includes the following steps:

[0108] Step S301: Obtain the first image to which readout noise is to be added. The image noise includes readout noise. For details, please refer to [link to relevant documentation]. Figure 1 Step S101 of the illustrated embodiment will not be described again here.

[0109] Step S302: For each pixel in the first image, generate a first random number that satisfies a first preset uniform distribution. The lower limit of the first preset uniform distribution is a first preset value, and the upper limit of the first preset uniform distribution is a second preset value. For details, please refer to... Figure 1 Step S102 of the illustrated embodiment will not be described again here.

[0110] Step S303: If the first random number corresponding to the current pixel is less than the second threshold and greater than or equal to the first threshold, then update the pixel value of the current pixel based on the second noise model; the second threshold is the sum of the probabilities of normal points and bad points of the first preset category in the first black frame image, and bad points are pixels that exhibit abnormal behavior in the first black frame image.

[0111] Specifically, the above-mentioned updating of the pixel value of the current pixel based on the second noise model includes:

[0112] Step S3031: Generate a fourth random number that satisfies a third preset normal distribution, a fifth random number that satisfies a fourth preset normal distribution, and a sixth random number that satisfies a fifth preset normal distribution, and generate a seventh random number that satisfies a second preset uniform distribution. The lower limit of the second preset uniform distribution is the third preset value, and the upper limit of the second preset uniform distribution is the fourth preset value.

[0113] In conjunction with the foregoing embodiments, this embodiment specifically represents B1 in the following manner:

[0114]

[0115] in, Let μ1 represent the fourth random number that satisfies the third preset normal distribution, and σ1 represent the standard deviation of the third preset normal distribution. Let μ2 represent the fifth random number that satisfies the fourth preset normal distribution, and let σ2 represent the standard deviation of the fourth preset normal distribution. q1 represents the sixth random number that satisfies the fifth preset normal distribution, μ3 represents the mean of the fifth preset normal distribution, σ3 represents the standard deviation of the fifth preset normal distribution, Q represents the seventh random number that satisfies the second preset uniform distribution, q1 represents the third preset value (parameter in the interval [0,1]), and q2 represents the fourth preset value (parameter in the interval [0,1]).

[0116] In this embodiment, the second preset uniform distribution can be a uniform distribution of [0,1], that is, the third preset value can be 0 and the fourth preset value can be 1; this embodiment can generate a seventh random number between 0 and 1, which can be represented by Q, and the value of Q determines which normal distribution random number is used.

[0117] As can be seen, for the first preset category of defects, this embodiment uses three Gaussian functions to satisfy the different noise statistical characteristics of different sensors. Specifically, B1 can be understood as a random variable, and the probability density function of this random variable is the weighted sum of the probability density functions of the aforementioned third, fourth, and fifth preset normal distributions:

[0118] f(x)=q1g(x;μ1,σ1)+(q2-q1)g(x;μ2,σ2)+(1-q2)g(x;μ3,σ3)

[0119] Where f(x) represents the weighted sum of the three probability density functions, q1 is the weight of the probability density function of the third pre-defined normal distribution, and g(x; μ1, σ1) represents the probability density function of the third pre-defined normal distribution (e.g., ), where q2-q1 is the weight of the probability density function of the fourth preset normal distribution, g(x; μ2,σ2) represents the probability density function of the fourth preset normal distribution, 1-q2 is the weight of the probability density function of the fifth preset normal distribution, and g(x; μ3,σ3) represents the probability density function of the fifth preset normal distribution.

[0120] like Figure 6As shown, in this embodiment, the histogram of the bad pixels of the first preset category is fitted for noise calibration. Specifically, a pixel value statistical histogram of the bad pixels of the first preset category is separately plotted, with the abscissa being the pixel value and the ordinate being the number of pixel points with the corresponding pixel value. The histogram can be drawn as a curve graph. Specifically, the histogram is fitted to the curve shown in the 6th curve graph of the figure. For example, the function scipy.optimize.curve_fit in the scipy library (advanced scientific computing library) can be used for fitting. This library function supports custom functions. A custom function is defined according to f(x) = q1g(x; μ1,σ1)+(q2 - q1)g(x; μ2,σ2)+(1 - q2)g(x; μ3,σ3) and the ranges of each parameter are estimated, and then the histogram data is input, and the estimated values of parameters such as q1, q2, μ1, μ2, μ3, σ1, σ2, σ3 can be automatically fitted and returned.

[0121] In this embodiment, first, a black frame with a relatively large analog gain is collected, and let g A = g A0 , and the histogram is statistically calculated. The parameters q1, q2, μ1, μ2, μ3, σ1, σ2, σ3 are calibrated according to the foregoing method. When adding noise to the image collected under any analog gain g A , three normally distributed random numbers are generated, where the mean parameter is and the standard deviation parameter is . A random number Q uniformly distributed in [0, 1] is generated, and the magnitude relationship between Q and q1, q2 is compared. According to the corresponding relationship in B1, one of the three random numbers is selected and added to the original pixel value.

[0122] Specifically, this embodiment can judge the range where the seventh random number is located and execute the subsequent steps according to the judgment result.

[0123] Among them, the range where the seventh random number is located includes: the seventh random number is less than the third threshold and greater than or equal to the third preset value, the seventh random number is less than the fourth threshold and greater than or equal to the third threshold, and the seventh random number is less than the fourth preset value and greater than or equal to the fourth threshold.

[0124] Step S3032, if the seventh random number is less than the third threshold and greater than or equal to the third preset value, then the sum of the fourth random number and the pixel value of the current pixel point before update is used as the pixel value of the current pixel point after update.

[0125] Specifically, if under the condition of 0 ≤ Q < q1, then the pixel value of the current pixel point after update is the sum of the pixel value of the current pixel point before update and .

[0126] Step S3033, if the seventh random number is less than the fourth threshold and greater than or equal to the third threshold, then use the sum of the fifth random number and the pixel value of the current pixel point before update as the pixel value of the current pixel point after update.

[0127] Specifically, if under the condition of q1 ≤ Q < q2, then the pixel value of the current pixel point after update is the sum of the pixel value of the current pixel point before update and

[0128] Step S3034, if the seventh random number is less than the fourth preset value and greater than or equal to the fourth threshold, then use the sum of the sixth random number and the pixel value of the current pixel point before update as the pixel value of the current pixel point after update.

[0129] Specifically, if under the condition of q2 ≤ Q ≤ 1, then the pixel value of the current pixel point after update is the sum of the pixel value of the current pixel point before update and

[0130] In this embodiment, when it is determined that the current pixel point is a bad pixel of the first preset category, the pixel value of the current pixel point is updated based on the fourth random number or the fifth random number or the sixth random number, which specifically achieves the purpose of updating the pixel value of the current pixel point through the noise model representing the bad pixels of the first preset category in the black frame image.

[0131] In this embodiment, an image noise adding method is provided, which can be used in a computer device. Figure 4 It is a flowchart of the image noise adding method according to an embodiment of the present invention. As Figure 4 shown, this process includes the following steps:

[0132] Step S401, obtain a first image to be added with readout noise, and the image noise includes readout noise. For details, please refer to Figure 3 Step S301 in the shown embodiment, which will not be elaborated here.

[0133] Step S402, for each pixel point on the first image, respectively generate a first random number that satisfies the first preset uniform distribution. The lower limit of the first preset uniform distribution is the first preset value, and the upper limit of the first preset uniform distribution is the second preset value. For details, please refer to Figure 3 Step S302 in the shown embodiment, which will not be elaborated here.

[0134] Step S403, if the first random number corresponding to the current pixel point is less than the second preset value and greater than or equal to the second threshold, then update the pixel value of the current pixel point based on the third noise model.

[0135] Specifically, the above-mentioned updating the pixel value of the current pixel point based on the third noise model includes:

[0136] Step S4031: Generate an eighth random number that satisfies a third preset uniform distribution. The lower limit of the third preset uniform distribution is the black level, and the upper limit of the third preset uniform distribution is the maximum pixel value in the first image.

[0137] Based on the foregoing embodiments, this embodiment can be specifically represented by B2 in the following way, where its probability density function is close to an exponential function.

[0138] B2 = U(b,a)

[0139] Where U(b,a) represents the eighth random number that satisfies the third preset uniform distribution, b represents the black level, and a represents the maximum pixel value in the first image.

[0140] Step S4032: Use the sum of the eighth random number and the pixel value before the current pixel is updated as the pixel value after the current pixel is updated.

[0141] Specifically, the updated pixel value of the current pixel is the sum of the pixel value before the update and B2.

[0142] In this embodiment, when the current pixel is determined to be a bad pixel of the second preset category, the pixel value of the current pixel is updated based on the eighth random number. Specifically, this achieves the purpose of updating the pixel value of the current pixel using a noise model representing bad pixels of the second preset category in a black frame image.

[0143] In the above embodiments of the present invention, the pixel analog signal noise model considering defective pixels is summarized as follows:

[0144]

[0145] In summary, this invention provides a method for establishing a noise model for pixels with abnormal mean and variance in readout noise, achieving a more realistic noise model overall. The noisy image generated using the more realistic noise model is closer to the actual shooting situation of the camera, thereby the denoising network trained has better denoising performance.

[0146] This embodiment also provides an image noise addition device, which is used to implement the above embodiments and preferred embodiments, and will not be repeated as already described. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0147] This embodiment provides an image noise addition device, such as... Figure 7 As shown, it includes:

[0148] Image acquisition module 701 is used to acquire a first image to which readout noise is to be added, the image noise including readout noise.

[0149] The random number generation module 702 is used to generate a first random number that satisfies a first preset uniform distribution for each pixel in the first image. The lower limit of the first preset uniform distribution is a first preset value, and the upper limit of the first preset uniform distribution is a second preset value.

[0150] The first update module 703 is used to update the pixel value of the current pixel based on the first noise model, according to the first random number corresponding to the current pixel being less than the first threshold and greater than or equal to the first preset value; the first threshold is the probability of a normal point in the black frame image, and a normal point is a pixel in the black frame image that behaves normally.

[0151] The second update module 704 is used to update the pixel value of the current pixel based on the second noise model, according to the first random number corresponding to the current pixel being less than the second threshold and greater than or equal to the first threshold; the second threshold is the sum of the probabilities of normal points and bad points of the first preset category in the black frame image, and bad points are pixels that exhibit abnormal behavior in the black frame image.

[0152] The third update module 705 is used to update the pixel value of the current pixel based on the third noise model, according to the first random number corresponding to the current pixel being less than the second preset value and greater than or equal to the second threshold.

[0153] In some alternative implementations, the first update module 703 includes:

[0154] The first processing unit is used to generate a second random number that satisfies a first preset normal distribution, to determine the product of the second random number and a preset analog signal gain, and to generate a third random number that satisfies the second preset normal distribution.

[0155] The first update unit is used to use the product, the third random number, and the sum of the pixel values ​​before the current pixel is updated as the pixel value after the current pixel is updated.

[0156] In some alternative implementations, the second update module 704 includes:

[0157] The second processing unit is used to generate a fourth random number that satisfies a third preset normal distribution, a fifth random number that satisfies a fourth preset normal distribution, and a sixth random number that satisfies a fifth preset normal distribution, and is also used to generate a seventh random number that satisfies a second preset uniform distribution. The lower limit of the second preset uniform distribution is the third preset value, and the upper limit of the second preset uniform distribution is the fourth preset value.

[0158] The second update unit is used to use the sum of the fourth random number and the pixel value before the current pixel is updated as the pixel value after the current pixel is updated, based on the fact that the seventh random number is less than the third threshold and greater than or equal to the third preset value.

[0159] The third update unit is used to use the sum of the fifth random number and the pixel value before the current pixel is updated as the pixel value after the current pixel is updated, based on the fact that the seventh random number is less than the fourth threshold and greater than or equal to the third threshold.

[0160] The fourth update unit is used to use the sum of the sixth random number and the pixel value before the current pixel is updated as the pixel value after the current pixel is updated, based on the fact that the seventh random number is less than the fourth preset value and greater than or equal to the fourth threshold.

[0161] In some alternative implementations, the third update module 705 includes:

[0162] The third processing unit is used to generate an eighth random number that satisfies a third preset uniform distribution. The lower limit of the third preset uniform distribution is the black level, and the upper limit of the third preset uniform distribution is the maximum pixel value in the first image.

[0163] The fifth update unit is used to use the sum of the eighth random number and the pixel value before the update of the current pixel as the pixel value after the update of the current pixel.

[0164] In some alternative implementations, the image noise addition device further includes:

[0165] The first probability determination module is used to determine the probability of bad pixels of the first preset category by using the ratio of the number of bad pixels of the first preset category in the first black frame image to the total number of pixels in the first black frame image; the first probability determination module is also used to determine the probability of bad pixels of the second preset category by using the ratio of the number of bad pixels of the second preset category in the first black frame image to the total number of pixels in the first black frame image.

[0166] The second probability determination module is used to determine the probability of normal points in the first black frame image based on the probability of bad points in the first preset category and the probability of bad points in the second preset category; the sum of the probability of bad points in the first preset category, the probability of bad points in the second preset category, and the probability of normal points is 100%.

[0167] In some alternative implementations, the image noise addition device further includes:

[0168] The black frame acquisition module is used to acquire multiple second black frame images, where the first black frame image is any one of the multiple second black frame images.

[0169] The feature statistics module is used to determine the first mean and the first variance of each pixel in the first black frame image based on the pixel value of each pixel in multiple second black frame images.

[0170] The pixel differentiation module is used to determine normal points, bad points of the first preset category, and bad points of the second preset category in the first black frame image based on the first mean and the first variance corresponding to each pixel.

[0171] In some alternative implementations, the pixel differentiation module includes:

[0172] The scatter plot construction unit is used to construct a scatter plot based on the first mean and the first variance corresponding to each pixel. The horizontal coordinate of the scatter plot is the first mean, and the vertical coordinate of the scatter plot is the first variance.

[0173] The pixel differentiation unit is used to classify pixels outside a preset ellipse as bad pixels and pixels not outside the preset ellipse as normal pixels on a scatter plot. The x-coordinate of the center coordinate of the preset ellipse is the second mean, the y-coordinate of the center coordinate of the preset ellipse is the third mean, the major axis of the preset ellipse is a first preset multiple of the standard deviation of the first mean corresponding to each pixel, and the minor axis of the preset ellipse is a second preset multiple of the standard deviation of the first variance corresponding to each pixel. The second mean is the mean of the first mean corresponding to each pixel, and the third mean is the mean of the first variance corresponding to each pixel.

[0174] The defective pixel differentiation unit is used to form a preset straight line on the scatter plot, and to classify the defective pixels on the left side of the preset line as defective pixels of the first preset category, and the defective pixels on the right side of the preset line as defective pixels of the second preset category.

[0175] In some optional embodiments, the image noise also includes shot noise; the image noise adding device further includes:

[0176] The original image acquisition module is used to acquire a second image to which shot noise is to be added. The second image is a clean original image.

[0177] The shot noise addition module is used to add shot noise to the second image to obtain the first image.

[0178] The further functional descriptions of each module and unit are the same as those in the corresponding embodiments described above, and will not be repeated here.

[0179] In this embodiment, the image noise addition device is presented in the form of a functional unit. Here, a unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.

[0180] This invention also provides a computer device having the above-described features. Figure 7 The image noise addition device shown.

[0181] Please see Figure 8 , Figure 8 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of the present invention, such as... Figure 8 As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 8 Take a processor 10 as an example.

[0182] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GPA), or any combination thereof.

[0183] The memory 20 stores instructions executable by at least one processor 10 to cause at least one processor 10 to perform the method shown in the above embodiments.

[0184] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0185] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.

[0186] The computer device also includes a communication interface 30 for communicating with other devices or communication networks.

[0187] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.

[0188] The foregoing can be better understood in accordance with the following terms:

[0189] Clause A1. A method for adding noise to an image, the method comprising:

[0190] Acquire a first image to which readout noise is to be added, wherein the image noise includes the readout noise;

[0191] For each pixel in the first image, a first random number is generated that satisfies a first preset uniform distribution. The lower limit of the first preset uniform distribution is a first preset value, and the upper limit of the first preset uniform distribution is a second preset value.

[0192] If the first random number corresponding to the current pixel is less than the first threshold and greater than or equal to the first preset value, then the pixel value of the current pixel is updated based on the first noise model; the first threshold is the probability of a normal point in the first black frame image, and the normal point is a pixel that behaves normally in the first black frame image;

[0193] If the first random number corresponding to the current pixel is less than the second threshold and greater than or equal to the first threshold, then the pixel value of the current pixel is updated based on the second noise model; the second threshold is the sum of the probabilities of normal points and bad points of the first preset category in the first black frame image, and the bad points are pixels that exhibit abnormal behavior in the first black frame image;

[0194] If the first random number corresponding to the current pixel is less than the second preset value and greater than or equal to the second threshold, then the pixel value of the current pixel is updated based on the third noise model.

[0195] Clause A2. The method described in Clause A1, wherein updating the pixel value of the current pixel based on the first noise model includes:

[0196] Generate a second random number that satisfies a first preset normal distribution, and determine the product of the second random number and a preset analog signal gain; and generate a third random number that satisfies a second preset normal distribution;

[0197] The updated pixel value of the current pixel is obtained by using the product, the third random number, and the sum of the pixel value before the update of the current pixel.

[0198] Clause A3. The method described in Clause A1 or A2, wherein updating the pixel value of the current pixel based on the second noise model includes:

[0199] Generate a fourth random number that satisfies a third preset normal distribution, a fifth random number that satisfies a fourth preset normal distribution, and a sixth random number that satisfies a fifth preset normal distribution, and generate a seventh random number that satisfies a second preset uniform distribution. The lower limit of the second preset uniform distribution is the third preset value, and the upper limit of the second preset uniform distribution is the fourth preset value.

[0200] If the seventh random number is less than the third threshold and greater than or equal to the third preset value, then the sum of the fourth random number and the pixel value before the current pixel is updated is used as the pixel value after the current pixel is updated.

[0201] If the seventh random number is less than the fourth threshold and greater than or equal to the third threshold, then the sum of the fifth random number and the pixel value before the current pixel is updated is used as the pixel value after the current pixel is updated.

[0202] If the seventh random number is less than the fourth preset value and greater than or equal to the fourth threshold, then the sum of the sixth random number and the pixel value before the current pixel is updated is used as the pixel value after the current pixel is updated.

[0203] Clause A4. The method described in Clause A1 or A2, wherein updating the pixel value of the current pixel based on the third noise model includes:

[0204] Generate an eighth random number that satisfies a third preset uniform distribution, wherein the lower limit of the third preset uniform distribution is black level and the upper limit of the third preset uniform distribution is the maximum pixel value in the first image.

[0205] The sum of the eighth random number and the pixel value before the update of the current pixel is used as the pixel value after the update of the current pixel.

[0206] Clause A5. The method according to Clause A1, prior to acquiring the first image to which readout noise is to be added, the method further includes:

[0207] The probability of a bad pixel of the first preset category is determined by the ratio of the number of bad pixels of the first preset category in the first black frame image to the total number of pixels in the first black frame image; and the probability of a bad pixel of the second preset category is determined by the ratio of the number of bad pixels of the second preset category in the first black frame image to the total number of pixels in the first black frame image.

[0208] The probability of a normal pixel in the first black frame image is determined based on the probability of a bad pixel in the first preset category and the probability of a bad pixel in the second preset category; the sum of the probability of a bad pixel in the first preset category, the probability of a bad pixel in the second preset category, and the probability of a normal pixel is 100%.

[0209] Clause A6. The method according to Clause A5, prior to determining the probability of bad pixels in the first preset category, the method further includes:

[0210] Acquire multiple second black frame images, wherein the first black frame image is any one of the multiple second black frame images;

[0211] Based on the pixel value of each pixel in the plurality of second black frame images, determine the first mean and the first variance corresponding to each pixel in the first black frame image;

[0212] Based on the first mean and first variance corresponding to each pixel, normal pixels, bad pixels of the first preset category, and bad pixels of the second preset category in the first black frame image are determined.

[0213] Clause A7. The method described in Clause A6, wherein determining the normal points, the first preset category of bad points, and the second preset category of bad points in the first black frame image based on the first mean and the first variance corresponding to each pixel point, comprises:

[0214] A scatter plot is constructed based on the first mean and the first variance corresponding to each pixel point, wherein the horizontal coordinate of the scatter points on the scatter plot is the first mean, and the vertical coordinate of the scatter points on the scatter plot is the first variance;

[0215] On the scatter plot, pixels corresponding to points outside the preset ellipse are identified as bad pixels, and pixels corresponding to points not outside the preset ellipse are identified as normal pixels. The x-coordinate of the center coordinate of the preset ellipse is the second mean, the y-coordinate of the center coordinate of the preset ellipse is the third mean, the major axis of the preset ellipse is a first preset multiple of the standard deviation of the first mean corresponding to each pixel, and the minor axis of the preset ellipse is a second preset multiple of the standard deviation of the first variance corresponding to each pixel. The second mean is the mean of the first mean corresponding to each pixel, and the third mean is the mean of the first variance corresponding to each pixel.

[0216] A preset straight line is formed on the scatter plot. The bad points on the left side of the preset straight line are regarded as bad points of the first preset category, and the bad points on the right side of the preset straight line are regarded as bad points of the second preset category.

[0217] Clause A8. The method according to any one of Clauses A1, A2, or A5 to A7, wherein the image noise further includes shot noise; the acquisition of the first image to which readout noise is to be added includes:

[0218] Obtain the second image to which shot noise is to be added; the second image is the clean original image.

[0219] Shot noise is added to the second image to obtain the first image.

[0220] Clause A9. An image noise-adding apparatus, the apparatus comprising:

[0221] The image acquisition module is used to acquire a first image to which readout noise is to be added, wherein the image noise includes the readout noise;

[0222] The random number generation module is used to generate a first random number that satisfies a first preset uniform distribution for each pixel in the first image. The lower limit of the first preset uniform distribution is a first preset value, and the upper limit of the first preset uniform distribution is a second preset value.

[0223] The first update module is used to update the pixel value of the current pixel based on a first noise model, according to the first random number corresponding to the current pixel being less than a first threshold and greater than or equal to a first preset value; the first threshold is the probability of a normal point in the black frame image, and the normal point is a pixel in the black frame image that behaves normally.

[0224] The second update module is used to update the pixel value of the current pixel based on the second noise model, according to the first random number corresponding to the current pixel being less than the second threshold and greater than or equal to the first threshold; the second threshold is the sum of the probabilities of normal points and bad points of the first preset category in the black frame image, and the bad points are pixels that exhibit abnormal behavior in the black frame image;

[0225] The third update module is used to update the pixel value of the current pixel based on the third noise model, according to the first random number corresponding to the current pixel being less than the second preset value and greater than or equal to the second threshold.

[0226] Clause A10. A computer device comprising:

[0227] A memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, the processor executing the computer instructions to perform the image noise addition method as described in any one of clauses A1 to A8.

[0228] Clause A11. A computer-readable storage medium storing computer instructions for causing a computer to perform any one of Clauses A1 to A8.

[0229] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A method for adding noise to an image, characterized in that, The method includes: Acquire a first image to which readout noise is to be added, wherein the image noise includes the readout noise; For each pixel in the first image, a first random number is generated that satisfies a first preset uniform distribution. The lower limit of the first preset uniform distribution is a first preset value, and the upper limit of the first preset uniform distribution is a second preset value. If the first random number corresponding to the current pixel is less than the first threshold and greater than or equal to the first preset value, then the pixel value of the current pixel is updated based on the first noise model; the first threshold is the probability of a normal point in the first black frame image, and the normal point is a pixel that behaves normally in the first black frame image; If the first random number corresponding to the current pixel is less than the second threshold and greater than or equal to the first threshold, then the pixel value of the current pixel is updated based on the second noise model; the second threshold is the sum of the probabilities of normal points and bad points of the first preset category in the first black frame image, and the bad points are pixels that exhibit abnormal behavior in the first black frame image; If the first random number corresponding to the current pixel is less than the second preset value and greater than or equal to the second threshold, then the pixel value of the current pixel is updated based on the third noise model; The step of updating the pixel value of the current pixel based on the first noise model includes: generating a second random number that satisfies a first preset normal distribution, and determining the product of the second random number and a preset analog signal gain; generating a third random number that satisfies a second preset normal distribution; and using the product, the third random number, and the sum of the pixel value of the current pixel before the update as the pixel value of the current pixel after the update. The step of updating the pixel value of the current pixel based on the second noise model includes: generating a fourth random number satisfying a third preset normal distribution, a fifth random number satisfying a fourth preset normal distribution, and a sixth random number satisfying a fifth preset normal distribution; and generating a seventh random number satisfying a second preset uniform distribution, wherein the lower limit of the second preset uniform distribution is a third preset value, and the upper limit of the second preset uniform distribution is a fourth preset value; if the seventh random number is less than a third threshold and greater than or equal to the third preset value, then the sum of the fourth random number and the pixel value of the current pixel before the update is used as the pixel value of the current pixel after the update; if the seventh random number is less than a fourth threshold and greater than or equal to the third threshold, then the sum of the fifth random number and the pixel value of the current pixel before the update is used as the pixel value of the current pixel after the update; if the seventh random number is less than the fourth preset value and greater than or equal to the fourth threshold, then the sum of the sixth random number and the pixel value of the current pixel before the update is used as the pixel value of the current pixel after the update. The step of updating the pixel value of the current pixel based on the third noise model includes: generating an eighth random number that satisfies a third preset uniform distribution, wherein the lower limit of the third preset uniform distribution is black level and the upper limit of the third preset uniform distribution is the maximum pixel value in the first image; and using the sum of the eighth random number and the pixel value of the current pixel before the update as the pixel value of the current pixel after the update.

2. The method according to claim 1, characterized in that, Before acquiring the first image to which readout noise will be added, the method further includes: The probability of a bad pixel of the first preset category is determined by the ratio of the number of bad pixels of the first preset category in the first black frame image to the total number of pixels in the first black frame image; and the probability of a bad pixel of the second preset category is determined by the ratio of the number of bad pixels of the second preset category in the first black frame image to the total number of pixels in the first black frame image. The probability of a normal pixel in the first black frame image is determined based on the probability of a bad pixel in the first preset category and the probability of a bad pixel in the second preset category; the sum of the probability of a bad pixel in the first preset category, the probability of a bad pixel in the second preset category, and the probability of a normal pixel is 100%.

3. The method according to claim 2, characterized in that, Before determining the probability of bad pixels in the first preset category, the method further includes: Acquire multiple second black frame images, wherein the first black frame image is any one of the multiple second black frame images; Based on the pixel value of each pixel in the plurality of second black frame images, determine the first mean and the first variance corresponding to each pixel in the first black frame image; Based on the first mean and first variance corresponding to each pixel, normal pixels, bad pixels of the first preset category, and bad pixels of the second preset category in the first black frame image are determined.

4. The method according to claim 3, characterized in that, The step of determining normal points, bad points of the first preset category, and bad points of the second preset category in the first black frame image based on the first mean and the first variance corresponding to each pixel includes: A scatter plot is constructed based on the first mean and the first variance corresponding to each pixel point, wherein the horizontal coordinate of the scatter points on the scatter plot is the first mean, and the vertical coordinate of the scatter points on the scatter plot is the first variance; On the scatter plot, pixels corresponding to points outside the preset ellipse are identified as bad pixels, and pixels corresponding to points not outside the preset ellipse are identified as normal pixels. The x-coordinate of the center coordinate of the preset ellipse is the second mean, the y-coordinate of the center coordinate of the preset ellipse is the third mean, the major axis of the preset ellipse is a first preset multiple of the standard deviation of the first mean corresponding to each pixel, and the minor axis of the preset ellipse is a second preset multiple of the standard deviation of the first variance corresponding to each pixel. The second mean is the mean of the first mean corresponding to each pixel, and the third mean is the mean of the first variance corresponding to each pixel. A preset straight line is formed on the scatter plot. The bad points on the left side of the preset straight line are regarded as bad points of the first preset category, and the bad points on the right side of the preset straight line are regarded as bad points of the second preset category.

5. The method according to any one of claims 1, 2, or 4, characterized in that, The image noise also includes shot noise; the process of acquiring the first image to which readout noise is to be added includes: Obtain the second image to which shot noise is to be added; the second image is the clean original image. Shot noise is added to the second image to obtain the first image.

6. An image noise-adding device, characterized in that, The device includes: The image acquisition module is used to acquire a first image to which readout noise is to be added, wherein the image noise includes the readout noise; The random number generation module is used to generate a first random number that satisfies a first preset uniform distribution for each pixel in the first image. The lower limit of the first preset uniform distribution is a first preset value, and the upper limit of the first preset uniform distribution is a second preset value. The first update module is used to update the pixel value of the current pixel based on a first noise model, according to the first random number corresponding to the current pixel being less than a first threshold and greater than or equal to a first preset value; the first threshold is the probability of a normal point in the black frame image, and the normal point is a pixel in the black frame image that behaves normally. The second update module is used to update the pixel value of the current pixel based on the second noise model, according to the first random number corresponding to the current pixel being less than the second threshold and greater than or equal to the first threshold; the second threshold is the sum of the probabilities of normal points and bad points of the first preset category in the black frame image, and the bad points are pixels that exhibit abnormal behavior in the black frame image; The third update module is used to update the pixel value of the current pixel based on the third noise model, according to the first random number corresponding to the current pixel being less than the second preset value and greater than or equal to the second threshold. The first update module includes a first processing unit and a first update unit; The first processing unit is used to generate a second random number that satisfies a first preset normal distribution, and to determine the product of the second random number and a preset analog signal gain, and to generate a third random number that satisfies the second preset normal distribution; The first update unit is used to use the product, the third random number, and the sum of the pixel values ​​of the current pixel before the update as the pixel value of the current pixel after the update. The second update module includes a second processing unit, a second update unit, a third update unit, and a fourth update unit; The second processing unit is used to generate a fourth random number that satisfies a third preset normal distribution, a fifth random number that satisfies a fourth preset normal distribution, and a sixth random number that satisfies a fifth preset normal distribution, and is also used to generate a seventh random number that satisfies a second preset uniform distribution, wherein the lower limit of the second preset uniform distribution is a third preset value, and the upper limit of the second preset uniform distribution is a fourth preset value. The second update unit is used to use the sum of the fourth random number and the pixel value before the current pixel is updated as the pixel value after the current pixel is updated, based on the fact that the seventh random number is less than the third threshold and greater than or equal to the third preset value. The third update unit is used to use the sum of the fifth random number and the pixel value before the current pixel is updated as the pixel value after the current pixel is updated, based on the fact that the seventh random number is less than the fourth threshold and greater than or equal to the third threshold. The fourth update unit is used to use the sum of the sixth random number and the pixel value before the update of the current pixel as the pixel value after the update, based on the fact that the seventh random number is less than the fourth preset value and greater than or equal to the fourth threshold. The third update module includes a third processing unit and a fifth update unit; The third processing unit is used to generate an eighth random number that satisfies a third preset uniform distribution, wherein the lower limit of the third preset uniform distribution is black level and the upper limit of the third preset uniform distribution is the maximum pixel value in the first image. The fifth update unit is used to use the sum of the eighth random number and the pixel value of the current pixel before the update as the pixel value of the current pixel after the update.

7. A computer device, characterized in that, include: A memory and a processor are communicatively connected, the memory storing computer instructions, and the processor executing the computer instructions to perform the image noise addition method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to perform the image noise addition method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Noise addition processing method and device

    CN106130675A

  • Noise information generation method and device

    CN115293956A