Image noise adding method and device, computer equipment and storage medium

By using random number generation and noise model selection methods in image processing, the problem of large differences between noise graphs and real images is solved, and more realistic noise addition and better denoising performance are achieved.

CN119904371AActive Publication Date: 2025-04-29CAMBRICON TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202311412128.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-27
Publication Date
2025-04-29
Estimated Expiration
2043-10-27

AI Technical Summary

Technical Problem

The difference between the noise band graph constructed in the prior art and the real noise band graph is large, which affects the denoising performance of the neural network model.

Method used

By obtaining the image of read noise to be added, a random number satisfies the preset uniform distribution is generated for each pixel point, and different noise models are selected according to the range of random numbers to update the pixel values, using the probability of normal points and bad points in the black frame image as a measurement factor.

Benefits of technology

This realizes the addition of more realistic read noise to the image, making the built noise-band image closer to the real image, thereby improving the denoising performance of the neural network model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119904371A_ABST
    Figure CN119904371A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, and discloses an image noise adding method and device, computer equipment and a storage medium. The computer equipment comprises a memory and a processor, the memory and the processor are in communication connection with each other, computer instructions are stored in the memory, and the processor executes the image noise adding method by executing the computer instructions. According to the method, the difference between the constructed noisy graph and the real noisy graph can be reduced, so that the noisy graph is more real.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to an image noise adding method, device, computer equipment and storage medium. Background Art

[0002] At present, in the solution of image or video denoising based on artificial intelligence, a noisy image can be generated by adding noise to a clean image, and then the noisy image is used as the input of the neural network model and the clean image is used as the label to train the neural network model to obtain a trained neural network model, which has the image denoising function; in the above process, a large number of noisy images are used to construct the training set of the neural network model. However, due to the technical limitations of the relevant technology, the difference between the constructed noisy image and the real noisy image obtained by shooting is large, which leads to a serious impact on the denoising performance of the trained neural network model. Therefore, it is crucial to construct a noisy image that is closer to the real noisy image. Summary of the invention

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

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

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

[0006] For each pixel point on the first image, a first random number satisfying a first preset uniform distribution is correspondingly generated, where 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, 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 point that appears normal 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, 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 a normal point in the first black frame image and a bad point of the first preset category, and the bad point is an abnormal pixel 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, the pixel value of the current pixel is updated based on the third noise model.

[0010] The image noise adding method provided by the present invention, in the process of adding read noise to a first image, updates the pixel value of the current pixel point through the first noise model, the second noise model or the third noise model according to the range of the first random number generated corresponding to each pixel point on the first image, so as to realize the addition of read noise to the first image, and in the process of selecting the first noise model, the second noise model and the third noise model, uses 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 in the first black frame image and bad points of the first preset category as weighing factors, so that the updated pixel value of the pixel point on the first image is closer to the overall distribution of the pixel value of the pixel point on the real noisy image, so as to reduce the difference between the constructed noisy image and the real noisy image, so that the noisy image after adding noise by the present invention is more real, and then the training set can be constructed by the noisy image constructed by the present invention, so as to help improve the denoising performance of the trained neural network model.

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

[0012] An image acquisition module, used for acquiring a first image to which readout noise is to be added, wherein the image noise includes readout noise;

[0013] A random number generation module, used to generate a first random number satisfying a first preset uniform distribution for each pixel point on the first image, wherein 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] A first updating 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 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 point that performs normally in the black frame image;

[0015] A second updating 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 a normal point in the black frame image and a bad point of the first preset category, and the bad point is a pixel point that exhibits abnormality in the black frame image;

[0016] The third updating 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] In a third aspect, 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 image noise adding method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0018] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the image noise adding method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0020] Figure 1 is a schematic flow chart of a method for adding image noise according to an embodiment of the present invention;

[0021] Figure 2 is a flow chart of another method for adding image noise according to an embodiment of the present invention;

[0022] Figure 3 is a flow chart of another method for adding image noise according to an embodiment of the present invention;

[0023] Figure 4 is a flow chart of yet another method for adding image noise according to an embodiment of the present invention;

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

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

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

[0027] Figure 8 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0028] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0029] In the related art, a neural network model (e.g., a denoising network) with image denoising function can be trained by using a clean image as a label and a noisy image as the input of the neural network model; wherein 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 is close to the real image noise. For example, random numbers that satisfy the Poisson distribution can be generated to simulate the shot noise of photons and random numbers that satisfy the Gaussian distribution can be generated to simulate the readout noise that is unrelated to the light signal. However, due to the technical limitations of the related art, how to reasonably add readout noise and shot noise to the image has become a technical pain point in this field.

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

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

[0032] Step S101 , acquiring a first image to which readout noise is to be added, where the image noise includes readout noise.

[0033] The readout noise is a noise that satisfies Gaussian distribution and is unrelated to the light signal. In this embodiment, the readout noise can be added to the first image through the process of processing the first image described later.

[0034] In some optional implementations, before the above step S101, the image noise adding method may further include:

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

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

[0037] In theory, the pixel value of each pixel on the first black frame image should be near the black level. It can be understood that a normal point represents a pixel whose difference between the pixel value on the black frame image and the black level is less than the set value, and the black level is approximately equal to the average of the pixel values ​​of all the pixels on the first black frame image; however, in reality, there will be a small number of pixel values ​​that are too large or too small, and such pixel values ​​are called bad pixels; according to whether the pixel value of the bad pixel changes over time on multiple consecutive black frame images in the video, the bad pixel is divided into dynamic bad pixels and static bad pixels. Generally, the characteristic of a static bad pixel is that the pixel value of the bad pixel is the maximum or minimum, corresponding to the brightest or darkest, and its statistical characteristics are simple, and the static bad pixel is easy to remove. The bad pixel in this embodiment refers to a dynamic bad pixel, which is composed of the bad pixels of the first preset category and the bad pixels of the second preset category in this embodiment.

[0038] In this embodiment, assuming that the probability of bad pixels of the first preset category is r1, and the probability of bad pixels of the second preset category is r2, taking the first black frame image taken by a camera with an image sensor of model imx485 as an example, r1≈1%, r2≈0.02%.

[0039] Step a2, determining the probability of normal points in the first black frame image according to 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] In combination with the above examples, the probability of normal points in this embodiment = 100% - the probability of bad points of the first preset category - the probability of bad points of the second preset category, for example, the probability of normal points ≈ 100% - 1% - 0.02%.

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

[0042] In some optional implementations, before the above step a1, the image noise adding method further includes:

[0043] Step b1, obtaining a plurality of second black frame images, wherein the first black frame image is any one of the plurality of second black frame images.

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

[0045] Taking the second black frame image as an example of an image in a video, this embodiment shoots a 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: determining a first mean and a first variance corresponding to each pixel point on the first black frame image according to the pixel value of each pixel point on the plurality of second black frame images.

[0047] In combination with the foregoing example, for 100 second black frame images, the first mean corresponding to each pixel point on the first black frame image is the mean of the 100 pixel values, and the first variance corresponding to each pixel point on the first black frame image is the variance of the 100 pixel values.

[0048] Step b3, determining normal pixels, bad pixels of a first preset category, and bad pixels of a second preset category in the first black frame image according to the first mean value and the first variance corresponding to each pixel.

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

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

[0051] Step c1, constructing a scatter plot according to the first mean and the first variance corresponding to each pixel point, wherein the horizontal coordinate of the scatter point on the scatter plot is the first mean, and the vertical coordinate of the scatter point on the scatter plot is the first variance.

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

[0053] Step c2, on the scatter plot, the pixel points corresponding to the points outside the preset ellipse are judged as bad points, and the pixel points corresponding to the points not outside the preset ellipse are judged as normal points; the horizontal coordinate of the center coordinate of the preset ellipse is the second mean, the vertical 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 point, 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 point; the second mean is the mean of the first mean corresponding to each pixel point, and the third mean is the mean of the first variance corresponding to each pixel point.

[0054] Combined with the above example, the mean is calculated for all (mean, variance) pairs (m, v) and standard deviation (σ m ,σ v ), in this embodiment represents the second mean, represents the third mean, σ m represents the standard deviation of the first mean, σ v represents the standard deviation of the first variance.

[0055] In this embodiment, the expression of the preset ellipse is specifically:

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

[0057] Step c3, forming a preset straight line on the scatter plot, taking the bad pixels on the left side of the preset straight line as bad pixels of the first preset category, and taking the bad pixels on the right side of the preset straight line as bad pixels of the second preset category.

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

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

[0060] The present embodiment can also create a scatter plot according to the first mean and the first variance corresponding to each pixel point, analyze the characteristics of the mean and variance of the pixel value of each pixel point that changes with time based on the scatter plot, and include taking the pixel points circled by a preset ellipse as normal points, taking the pixel points outside the preset ellipse as bad points, and dividing the bad points of the first preset category and the bad points of the second preset category by a preset straight line, so as to more accurately distinguish between normal points, bad points of the first preset category and bad points of the second preset category.

[0061] In some optional implementations, before the above step S101, the image noise adding method may further include:

[0062] Step d1, obtaining a second image to which shot noise is to be added, where the second image is a clean original image.

[0063] In this embodiment, the clean original image is a clean image (raw image).

[0064] Step d2, adding shot noise to the second image to obtain the first image.

[0065] The shot noise is a kind of noise that satisfies the Poisson distribution and is related to the light signal. In this embodiment, the shot noise can be added to the second image by processing the clean original image.

[0066] Specifically, the following operation is performed on each pixel on a clean raw image: the pixel value of each pixel is subtracted from the black level, and then divided by αg A , take the obtained value as the mean of Poisson distribution, then generate Poisson distribution random numbers based on the mean, and multiply the generated Poisson distribution random numbers by αg A , plus the black level, the pixel value after adding Poisson noise can be obtained. Among them, the method of generating Poisson distribution random numbers can be generated by, for example, the library function random.poisson(lambda) in numpy (an open source scientific computing library); where α represents a coefficient related to the photoelectric conversion efficiency, g A Indicates the preset analog signal gain (known parameter).

[0067] This embodiment calibrates the above-mentioned α in the following manner: collect a set of static photos, such as several frames of images, and record (simulate) gain g. In this embodiment, a set of static photos can include 100 frames of images, so as to more accurately calculate the pixel mean and variance. For the scene of photo collection, try to ensure the diversity of brightness. You can shoot a standard color card, and ensure the stability of the camera and the brightness of the light source during shooting, that is, ensure that the scene captured is static; calculate the mean and variance of the pixel values ​​of the pixel points on the above 100 frames of images respectively, through The slope can be obtained by fitting, and the slope is divided by g to obtain the parameter α (scaling factor); wherein EX represents the mean, DX represents the variance, δ represents the black level, and σ1 and σ2 represent two readout noise parameters.

[0068] The embodiment of the present invention can be used to implement the function of adding shot noise and readout noise to a clean original image, thereby improving the degree of closeness between the constructed noisy image and the real noisy image.

[0069] Step S102: for each pixel point on the first image, a first random number satisfying a first preset uniform distribution is correspondingly generated, 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 judge the range of the first random number, and perform the following steps according to the result of the judgment. Among them, the range of the first random number includes: 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, the first random number corresponding to the current pixel is less than the second threshold and greater than or equal to the first threshold, and 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. Among them, the random numbers involved in various embodiments of the present invention are all random variables.

[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 may be 0, and the second preset value may be 1; in this embodiment, a first random number between 0 and 1 may be generated when using a noise model, and the first random number may be represented by P, and the value of P determines which noise model is specifically used by the current pixel point to update the pixel value.

[0072] Specifically, this embodiment may compare the first random number with the first preset value, the first threshold, the second threshold, and the second preset value, and execute step S103 or step S104 or step S105 described later according to 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, 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 point that appears normal in the first black frame image.

[0074] Specifically, the probability of a normal point in the first black frame image can be represented by p1. Combined with the foregoing embodiment, the probability of a normal point is p1=1-r1-r2=100%-1%-0.02%=98.98%, which is of course 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 manner:

[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 the 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 indicates 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 manner:

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

[0085] Wherein, X A represents the updated pixel value, g A represents a preset analog signal gain, α represents a coefficient related to the photoelectric conversion efficiency, U represents a random number with a mean of (EX A - b) / g A α that follows a Poisson distribution, b represents the black level, B1 represents the fourth random number that follows the third preset normal distribution or the fifth random number that follows the fourth preset normal distribution or the sixth random number that follows 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 indicates that the current pixel is a bad pixel of the first preset category, then the pixel value of the current pixel is updated using the above second noise model.

[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 the pixel value of the current pixel is updated based on the third noise model.

[0088] Wherein, 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] Wherein, X A represents the updated pixel value, g A represents a preset analog signal gain, α represents a coefficient related to the photoelectric conversion efficiency, U represents a random number with a mean of (EX A - b) / g A α that follows a Poisson distribution, b represents the black level, B2 represents the eighth random number that follows 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 indicates that the current pixel is a bad pixel of the second preset category, then the pixel value of the current pixel is updated using the above third noise model.

[0093] The p1 and p2 in this embodiment are calculated based on the bad pixel rate. The purpose of the above operation is to achieve the result that most of the pixels use the normal point noise model (first noise model), and the proportion of pixels using the bad pixel noise model (second noise model and third noise model) is the corresponding bad pixel rate.

[0094] In the process of adding read noise to the first image, according to the range of the first random number generated corresponding to each pixel on the first image, the pixel value of the current pixel is updated by the first noise model, the second noise model or the third noise model to achieve the addition of read noise to the first image. In addition, in the selection process of the first noise model, the second noise model and the third noise model, the upper limit and lower limit 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 in the first black frame image and bad points of the first preset category are used as measurement factors, so that the updated pixel value of the pixel on the first image is closer to the overall distribution of the pixel value of the pixel on the real noisy image, thereby reducing the difference between the constructed noisy image and the real noisy image, so that the noisy image after adding noise by the present invention is more realistic, and then a training set can be constructed by the noisy image constructed by the present invention, so as to help improve the denoising performance of the trained neural network model.

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

[0096] Step S201, obtaining a first image to which readout noise is to be added, wherein the image noise includes readout noise. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0097] Step S202: For each pixel point on the first image, a first random number satisfying a first preset uniform distribution is generated respectively, wherein 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. Figure 1 Step S102 of the illustrated embodiment will not be described in detail 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, 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 point that appears normal in the first black frame image.

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

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

[0101] In combination with the above-mentioned embodiment, the noise model of the black frame is the noise model after the illumination is removed from the first noise model: X A =g A N1+N2. The goal of calibrating the noise is to calibrate the variance or standard deviation of the two normal distributions in the formula. The variance of the above formula is: Variance and g A The relationship between is a quadratic function relationship. A Under the condition of A The corresponding black frame is calculated to get the variance, that is, DX A , then fit the variance and g A The relationship between σ A and σ B Two parameters.

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

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

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

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

[0106] In this embodiment, when it is determined that the current pixel is a normal point, the pixel value of the current pixel is updated based on the product of the second random number, the preset analog signal gain and the third random number, thereby specifically achieving the purpose of updating the pixel value of the current pixel by using a normal point noise model representing a black frame image.

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

[0108] Step S301, obtaining a first image to which readout noise is to be added, wherein the image noise includes readout noise. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0109] Step S302: For each pixel point on the first image, a first random number satisfying a first preset uniform distribution is generated respectively, wherein 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. Figure 1 Step S102 of the illustrated embodiment will not be described in detail 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, 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 in the first black frame image and bad points of the first preset category, and the bad points are abnormal pixels in the first black frame image.

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

[0112] Step S3031, generate a fourth random number that satisfies the third preset normal distribution, a fifth random number that satisfies the fourth preset normal distribution, and a sixth random number that satisfies the fifth preset normal distribution, and generate a seventh random number that satisfies the 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 combination with the above-mentioned embodiments, this embodiment specifically expresses B1 in the following manner:

[0114]

[0115] in, represents a fourth random number that satisfies the third preset normal distribution, μ1 represents the mean of the third preset normal distribution, σ1 represents the standard deviation of the third preset normal distribution, represents a fifth random number that satisfies the fourth preset normal distribution, μ2 represents the mean of the fourth preset normal distribution, σ2 represents the standard deviation of the fourth preset normal distribution, 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, and the seventh random number can be represented by Q, and the value of Q determines which normal distribution random number is used.

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

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

[0119] Wherein, f(x) represents the result of weighted summation of the above three probability density functions, q1 is the weight of the probability density function of the third preset normal distribution, and g(x; μ1, σ1) represents the probability density function of the third preset normal distribution (for example, ), q2-q1 is used as 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 used as 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 bad pixels of the first preset category is fitted for noise calibration. Specifically, a statistical histogram of the pixel values 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 curve graph of Figure 6. 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. Then, the histogram data is input, and the estimated values of parameters such as q1, q2, μ1, μ2, μ3, σ1, σ2, and σ3 can be automatically fitted and returned.

[0121] In this embodiment, first, a black frame with a relatively large analog gain is collected. Let g A = g A0 , the statistical histogram is obtained, and the parameters q1, q2, μ1, μ2, μ3, σ1, σ2, and σ3 are calibrated according to the aforementioned 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 size 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, in this embodiment, the range where the seventh random number is located can be judged, and the subsequent steps are executed according to the judgment result.

[0123] Among them, the ranges where the seventh random number is located include: 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 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 and.

[0130] In this embodiment, when it is determined that the current pixel point is a bad point 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, specifically achieving the purpose of updating the pixel value of the current pixel point through the noise model representing the bad points of the first preset category of 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 which readout noise is to be added. The image noise includes readout noise. For details, please refer to Figure 3 Step S301 of the embodiment shown, 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 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 3 Step S302 of the embodiment shown, 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, generating an eighth random number that satisfies a third preset uniform distribution, wherein 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] In combination with the foregoing embodiments, this embodiment can specifically express B2 in the following manner, and its probability density function is close to an exponential function.

[0138] B2=U(b,a)

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

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

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

[0142] When this embodiment determines that the current pixel is a bad pixel of the second preset category, the pixel value of the current pixel is updated based on the eighth random number, which specifically achieves the purpose of updating the pixel value of the current pixel by using a noise model representing the bad pixels of the second preset category of the black frame image.

[0143] In the above-mentioned multiple embodiments of the present invention, the pixel point simulation signal noise model considering the bad pixel is summarized as follows:

[0144]

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

[0146] In this embodiment, an image noise adding device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0147] This embodiment provides an image noise adding device, such as Figure 7 As shown, including:

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

[0149] The random number generation module 702 is used to generate a first random number satisfying a first preset uniform distribution for each pixel point on the first image, wherein 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 the normal point is a pixel point that behaves normally in the black frame image.

[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 in the black frame image and bad points of the first preset category, and the bad points are pixels that exhibit abnormalities in the black frame image.

[0152] The third updating 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 optional implementations, the first updating 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 a second preset normal distribution.

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

[0156] In some optional implementations, the second updating module 704 includes:

[0157] The second processing unit is used to generate a fourth random number that satisfies the third preset normal distribution, a fifth random number that satisfies the fourth preset normal distribution, and a sixth random number that satisfies the fifth preset normal distribution, and is used to generate a seventh random number that satisfies the 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 updating unit is used to use the sum of the fourth random number and the pixel value of the current pixel before updating as the pixel value of the current pixel after updating according to the seventh random number being less than the third threshold and greater than or equal to the third preset value.

[0159] The third updating unit is used to use the sum of the fifth random number and the pixel value of the current pixel before updating as the pixel value of the current pixel after updating according to the seventh random number being less than the fourth threshold and greater than or equal to the third threshold.

[0160] The fourth updating unit is used to use the sum of the sixth random number and the pixel value of the current pixel before updating as the pixel value of the current pixel after updating according to the seventh random number being less than the fourth preset value and greater than or equal to the fourth threshold.

[0161] In some optional implementations, the third updating module 705 includes:

[0162] The third processing unit is used to generate an eighth random number that satisfies a third preset uniform distribution, where 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 updating unit is used to use the sum of the eighth random number and the pixel value of the current pixel before updating as the pixel value of the current pixel after updating.

[0164] In some optional implementations, the image noise adding 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 number of all 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 number of all 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 according to 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 optional implementations, the image noise adding device further includes:

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

[0169] The feature statistics module is used to determine a first mean and a first variance corresponding to each pixel point on the first black frame image according to the pixel value of each pixel point on the plurality of second black frame images.

[0170] The pixel distinguishing module is used to 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 according to the first mean value and the first variance corresponding to each pixel point.

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

[0172] The scatter plot construction unit is used to construct a scatter plot according to 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.

[0173] The pixel point distinguishing unit is used to judge the pixel points corresponding to the points outside the preset ellipse as bad points and the pixel points corresponding to the points not outside the preset ellipse as normal points on the scatter plot; the horizontal coordinate of the central coordinate of the preset ellipse is the second mean, the vertical coordinate of the central 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 point, 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 point. The second mean is the mean of the first mean corresponding to each pixel point, and the third mean is the mean of the first variance corresponding to each pixel point.

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

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

[0176] An original image acquisition module is used to acquire a second image to which shot noise is to be added, where the second image is a clean original image;

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

[0178] The further functional description of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

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

[0180] The embodiment of the present invention also provides a computer device having the above Figure 7 The image noise adding device shown.

[0181] See also Figure 8 , Figure 8 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 8 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 8 A processor 10 is taken as an example.

[0182] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0183] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0184] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

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

[0186] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0187] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0188] The foregoing content 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 point on the first image, respectively generate a first random number that satisfies a first preset uniform distribution, where 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, 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 point that appears normal in the first black frame image;

[0193] If the first random number corresponding to the current pixel is less than a second threshold and greater than or equal to the first threshold, 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 a normal point in the first black frame image and a bad point of a first preset category, and the bad point is a pixel point that exhibits abnormality 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, the pixel value of the current pixel is updated based on the third noise model.

[0195] Clause A2. The method according to clause A1, wherein updating the pixel value of the current pixel based on the first noise model comprises:

[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 product, the third random number and the sum of the pixel value of the current pixel before being updated are used as the pixel value of the current pixel after being updated.

[0198] Clause A3. The method according to clause A1 or A2, wherein updating the pixel value of the current pixel based on the second noise model comprises:

[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, wherein 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 value and greater than or equal to the third preset value, using the sum of the fourth random number and the pixel value of the current pixel before being updated as the pixel value of the current pixel after being updated;

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

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

[0203] Clause A4. The method according to clause A1 or A2, wherein updating the pixel value of the current pixel based on the third noise model comprises:

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

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

[0206] Clause A5. The method according to clause A1, before acquiring the first image to which read noise is to be added, the method further comprises:

[0207] 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 number of all 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 number of all pixels in the first black frame image;

[0208] The probability of normal points in the first black frame image is determined according to 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%.

[0209] Clause A6. The method according to clause A5, wherein before determining the probability of bad pixels of the first preset category, the method further comprises:

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

[0211] Determine a first mean and a first variance corresponding to each pixel point on the first black frame image according to a pixel value of each pixel point on the plurality of second black frame images;

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

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

[0214] Constructing a scatter plot according to 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, pixel points corresponding to points outside the preset ellipse are determined as bad points, and pixel points corresponding to points not outside the preset ellipse are determined as normal points; the horizontal coordinate of the central coordinate of the preset ellipse is the second mean, the vertical coordinate of the central 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 point, 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 point; the second mean is the mean of the first mean corresponding to each pixel point, and the third mean is the mean of the first variance corresponding to each pixel point;

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

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

[0218] Acquire a second image to which shot noise is to be added, where the second image is a clean original image;

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

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

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

[0222] A random number generation module, configured to generate, for each pixel point on the first image, a first random number satisfying a first preset uniform distribution, wherein 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] A first updating module, configured to update the pixel value of the current pixel based on a first noise model according to a first random number corresponding to the current pixel being less than a first threshold and greater than or equal to the first preset value; the first threshold being a probability of a normal point in a black frame image, and the normal point being a pixel point that behaves normally in the black frame image;

[0224] A second updating module is configured to update the pixel value of the current pixel based on a second noise model according to the first random number corresponding to the current pixel being less than a second threshold and greater than or equal to the first threshold; the second threshold is the sum of the probabilities of a normal point in the black frame image and a bad point of a first preset category, and the bad point is a pixel point in the black frame image that exhibits abnormality;

[0225] A third updating module is configured to update the pixel value of the current pixel based on a 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, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the image noise adding method described in any one of clauses A1 to A8 by executing the computer instructions.

[0228] Clause A11. A computer-readable storage medium having computer instructions stored thereon, wherein the computer instructions are used to cause a computer to execute the image noise adding method described in any one of clauses A1 to A8.

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

Claims

1. A method for adding image noise, characterized in that: The method comprises: Acquire a first image to which readout noise is to be added, wherein the image noise includes the readout noise; For each pixel point on the first image, respectively generate a first random number that satisfies a first preset uniform distribution, where 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, 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 point that appears normal in the first black frame image; If the first random number corresponding to the current pixel is less than a second threshold and greater than or equal to the first threshold, 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 a normal point in the first black frame image and a bad point of a first preset category, and the bad point is a pixel point that exhibits abnormality 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, the pixel value of the current pixel is updated based on the third noise model.

2. The method according to claim 1, characterized in that The updating the pixel value of the current pixel based on the first noise model includes: 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; The product, the third random number and the sum of the pixel value of the current pixel before being updated are used as the pixel value of the current pixel after being updated.

3. The method according to claim 1 or 2, characterized in that: The updating the pixel value of the current pixel based on the second noise model includes: 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, wherein 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; If the seventh random number is less than the third threshold value and greater than or equal to the third preset value, using the sum of the fourth random number and the pixel value of the current pixel before being updated as the pixel value of the current pixel after being updated; If the seventh random number is less than the fourth threshold value and greater than or equal to the third threshold value, using the sum of the fifth random number and the pixel value of the current pixel before being updated as the pixel value of the current pixel after being updated; If the seventh random number is less than the fourth preset value and greater than or equal to the fourth threshold, the sum of the sixth random number and the pixel value of the current pixel before updating is used as the pixel value of the current pixel after updating.

4. The method according to claim 1 or 2, characterized in that: The 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 a lower limit of the third preset uniform distribution is a black level, and an upper limit of the third preset uniform distribution is a maximum pixel value in the first image; The sum of the eighth random number and the pixel value of the current pixel before being updated is used as the pixel value of the current pixel after being updated.

5. The method according to claim 1, characterized in that Before acquiring the first image to which readout noise is to be added, the method further includes: 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 number of all 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 number of all pixels in the first black frame image; The probability of normal points in the first black frame image is determined according to 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%.

6. The method according to claim 5, characterized in that Before determining the probability of bad pixels of the first preset category, the method further includes: Acquire a plurality of second black frame images, wherein the first black frame image is any one of the plurality of second black frame images; Determine a first mean and a first variance corresponding to each pixel point on the first black frame image according to a pixel value of each pixel point on the plurality of second black frame images; According to the first mean and the first variance corresponding to each pixel point, the normal points in the first black frame image, the bad points of the first preset category, and the bad points of the second preset category are determined.

7. The method according to claim 6, characterized in that The determining, according to the first mean and the first variance corresponding to each pixel point, normal points in the first black frame image, bad points of the first preset category, and bad points of the second preset category, comprises: Constructing a scatter plot according to 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, pixel points corresponding to points outside the preset ellipse are determined as bad points, and pixel points corresponding to points not outside the preset ellipse are determined as normal points; the horizontal coordinate of the central coordinate of the preset ellipse is the second mean, the vertical coordinate of the central 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 point, 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 point; the second mean is the mean of the first mean corresponding to each pixel point, and the third mean is the mean of the first variance corresponding to each pixel point; A preset straight line is formed on the scatter plot, and the bad pixels on the left side of the preset straight line are regarded as bad pixels of a first preset category, and the bad pixels on the right side of the preset straight line are regarded as bad pixels of a second preset category.

8. The method according to any one of claims 1 or 2 or 5 to 7, characterized in that The image noise also includes shot noise; and the step of acquiring a first image to which readout noise is to be added includes: Acquire a second image to which shot noise is to be added, where the second image is a clean original image; Shot noise is added to the second image to obtain the first image.

9. An image noise adding device, characterized in that: The device comprises: An image acquisition module, used for acquiring a first image to which readout noise is to be added, wherein the image noise includes the readout noise; A random number generation module, configured to generate, for each pixel point on the first image, a first random number satisfying a first preset uniform distribution, wherein 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; A first updating module, configured to update the pixel value of the current pixel based on a first noise model according to a first random number corresponding to the current pixel being less than a first threshold and greater than or equal to the first preset value; the first threshold being a probability of a normal point in a black frame image, and the normal point being a pixel point that behaves normally in the black frame image; A second updating module is configured to update the pixel value of the current pixel based on a second noise model according to the first random number corresponding to the current pixel being less than a second threshold and greater than or equal to the first threshold; the second threshold is the sum of the probabilities of a normal point in the black frame image and a bad point of a first preset category, and the bad point is a pixel point in the black frame image that exhibits abnormality; A third updating module is configured to update the pixel value of the current pixel based on a 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.

10. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the image noise adding method according to any one of claims 1 to 8 by executing the computer instructions.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the image noise adding method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Image noise adding method and device

    CN102324091A

  • Noise addition processing method and device

    CN106130675A

  • Image processing method, image processing apparatus, learnt model manufacturing method, and image processing system

    CN111667416A

  • Noise reduction model training method and device and storage medium

    CN114049882A

  • Noise information generation method and device

    CN115293956A