The invention is described referring to the attached drawings, wherein:
The noise level of an image depends on the characteristics of the sensor and on the light condition.
It may be reasonably assumed that the image cannot contain an arbitrarily high noise level. For this reason, according to an embodiment of a method of this invention the image is subdivided in blocks and it is assumed for the first block that the standard deviation of the differences between pixels due to noise could not exceed a maximum value σmax.
This value can be established a priori or may be estimated in a preliminary phase in which the characteristics of the sensor are estimated in different lightening conditions.
Because of the wide diffusion of Bayer image sensors, solely by way of an example, hereinafter reference will be made to this type of images only, but what will be stated may be applied also for gray scale images or for color images with a different basic color pixel organization.
A Color Filter Array (CFA) of a Bayer image provides three images: green, red and blue. According to an embodiment of a method of this invention, these three images are subdivided in blocks and for each pixel to be filtered a working window centered thereon is used.
In the example of
The absolute values of the differences δ0, δ1, . . . , δ7 between the central pixel PC and the neighboring pixels of the same color are calculated:
δ1=|Pc−Pi|,i=0, . . . , 7
If δ1ε[0,3σmax] for any i=0, . . . 7, then according to an embodiment of the method of this invention, it is assumed that the pixels of the working window belong to a homogeneous portion of the image.
The upper bound of δi is determined in function of σmax and may also differ from 3σmax.
The absolute values of the calculated differences σi are stored in various registers, such to form a noise histogram. Let γj be the absolute value of the jth difference δj, being jε[0, . . . , 7]: if the absolute value of the jth difference is smaller than three times the maximum standard deviation, then the register T that stores the corresponding value is incremented by one:
Ψ(γj)=Ψ(γj)+1.
Once all pixels of the considered block have been processed, the histogram of the absolute values of the differences stored in the registers will have a Gaussian distribution. The histogram has only positive values, but this does not complicate calculations of the standard deviation for a normal distribution because it is symmetrical on its mean value, that has been supposed null because it has been assumed that additive Gaussian noise has a zero mean. Then the standard deviation is calculated in function of the stored absolute values.
A simple way of doing it comes from the fact that in a Gaussian distribution about 68% of the samples is comprised in the range [μ−σ, μ−σ]. According to an embodiment, the standard deviation of the noise of the considered block is the value larger than 68% of the values of the previously obtained histogram. This embodiment is depicted in the scheme of
This solution depends on the chosen maximum value for the standard deviation σmax: this value should be carefully chosen, for example by testing the characteristics of the image sensor for different lightening conditions and by determining the situations for which the maximum noise is generated. With this technique it is possible to estimate an upper bound for the standard deviation σmax.
Nevertheless, the probability that noise corrupting the image to be filtered is larger than the initially estimated level is not null. This problem can be addressed by fixing a sufficiently large expected maximum value for the standard deviation σmax.
The above illustrated method can be further improved in an embodiment by modifying iteratively the maximum value of the standard deviation σmax from a block to the next of the image or sequence of images to be processed. With this expedient, the expected maximum value of the standard deviation σmax can be reduced for the next block if it is overestimated for the current block. This allows to reduce the number of absolute values of the differences to be stored and would make simpler and faster the algorithm.
To this end, the following steps are carried out:
Preferably, the blocks belonging to a same image are processed by using a same value σmax. As a consequence, if an image sequence is being processed, the value of σmax could be updated only when the current image has been processed and a next image is considered.
With this technique, it is not necessary to determine preliminarily the characteristics of the image sensor.
The value of σmax that fixes the maximum admissible noise level depends also on the “bit dept” of the input noisy image: if the input data are in a 8 bpp (bit per pixel) format, then the intensity of each pixel is in the interval from 0 to 255; if the data format is 10 bpp, then the intensity of each pixel is in the interval from 0 to 1023 and soon.
It is supposed that small variations of the pixel intensity are due to noise, but the attribute “small” is tied to the number of bit per pixel. When data are processed in a 8 bpp format, it may be reasonable to assume for example that in a very noisy image σmax=10. Therefore, in this example the histogram of the absolute values of the differences would contain 3σmax=30 registers. If the data format is 10 bpp, multiply by four the number of registers (30), thus the noise histogram may be realized with 120 registers.
A sample table of the maximum values of the standard deviation is given hereinbelow:
The size of the histogram of the absolute values of the differences increases with the number of bits per pixels of the input image.
The value of the comparison threshold 3·σmax, or of any other threshold value determined in function of the maximum value of the standard deviation of noise, establishes the number of levels of absolute values of the differences to be stored and thus of the hardware registers used for counting the number of occurrences of each absolute value. Of course, the number of registers may be relatively large if the image to be processed is defined with a large number of bits per pixel.
According to an embodiment of the method of this invention, it is possible to calculate the standard deviation of noise by using a reduced number of registers, independently from the number of bits per pixels of the image to be processed.
To this end, a lower threshold σ0 and an upper threshold σ1 are established and the absolute values of the differences are compared with these two thresholds. Then in a first register the number Σ0 of absolute values of the differences smaller than the lower threshold σ0 is stored in a first register, the number Σ1 of absolute values smaller than the upper threshold σ1 is stored in a second register and the number Σ2 of absolute values smaller than the threshold σmax is stored in a third register. By choosing the lower threshold σ0 and the upper threshold σ1 such that they are respectively smaller and larger of the standard deviation of the absolute values of the differences between pixels due to noise that corrupts the image to be processed, the number of absolute values of the differences smaller than the lower threshold σ0 will be smaller than 68% and the number of absolute values of the differences smaller than the upper threshold σ1 will be larger than 68% of the total number of absolute values smaller than σmax. As a consequence, as schematically depicted in
In an embodiment, the value of the upper threshold σ1 is equal to the value of the maximum standard deviation σmax.
According to a further embodiment of this invention, four threshold are established: σz, σ0, σ1, σmax.
Differently from the previous case, in this case there an additional threshold σz smaller than the threshold σ0. The number Σz of absolute values smaller than or equal to the threshold σz may be used for improving the estimation of the standard deviation of the absolute values of the differences.
In an embodiment it is σz=0.
An example of how the thresholds σ0, σ1 and σmax can be chosen is shown in the following table (supposing σz=0):
Being N=68% of the total number of absolute values of calculated differences. Four different cases are possible:
0<N≦Σz
ΣZ<N≦Σ0
Σ0<N≦Σ1
Σ1<N≦Σ2
The thresholds σ0, σ1, σmax may be determined in a dynamic fashion, that is their values may be updated for a block to be processed in function of the estimated standard deviation of the just processed block. These thresholds may be fixed such that the estimated value σest of the standard deviation of the absolute values of the differences is the mean between the thresholds σ0 and σ1, and the value σmax is a multiple of σ1, that is:
wherein δεN is used for expanding the interval centered in σest and influences the convergence speed of the method of this invention. Typical values that mat be used in the above equations are:
δ=2;Ω=3
By adjusting the factor δ the convergence speed is modified. This is particularly useful when the number of bits per pixels is relatively large (that is larger than 8) and it is noticed an intolerable delay in the convergence of the method. Clearly, different values of δ will produce different delays.
Typically, for images defined with 8 bits per pixel, the value of σest may be 5.
The new values for σ0 and σ1 will be used for estimating the noise level relative to the next block, that may be a block of the same image or a block of a successive image in a image sequence.
As already said, the standard deviation may be estimated by using a linear interpolator:
Dividing the calculated value σest by the square root of 2, the noise level estimated for the current block is obtained:
As already said, the value of Φσ may be conveniently used for estimating the noise level of the next image block.
It is to be noted that the value σest is divided by √{square root over (2)}. Being Pi the current pixel, its value is given by the following equation:
P
i
=S
i+ηi
wherein:
Pi: current pixel;
Si: value of the current pixel non corrupted by noise (ideal);
ηi: noise value in the point Pi (it is a noise N(0, σ2)).
By calculating the difference between the pixel Pi and the central pixel Pc,
P
i
−P
c=Si+ηi−(Sc+ηc)=Si−Sc+ηi−ηc
If the pixels Pi and Pc belong to a homogeneous area, then Si=Sc, thus:
P
i
−P
c=ηi−ηc
Given two normally distributed stochastic variable X and Y, their sum has a probability density function given by:
wherein the mean value is μX+Y=μX+μY and the variance is σX+Y2=σX2+σY2.
In case of zero mean AWGN, σX+Y2=σX2+σY2 and thus μη
Supposing that the pixels Pi and Pc are corrupted by the same type of noise, then ση
By hypothesis, the stochastic variables ηi and ηc are independent, then their covariance is null and the variance of their difference is the sum of the variances of the stochastic variables, thus:
Var(ηi−ηc)=2σ2.
The estimated value σest is √{square root over (2)} times larger than the noise standard deviation, thus the output of the linear interpolator is multiplied by 0.7071.
It is to be noticed that the hypothesis of zero mean noise is not essential: any skilled person would immediately recognize that even if the stochastic variables ηi and ηc had zero mean, the noise standard deviation could be estimated as illustrated above because μη
Another important consideration when the noise standard deviation is to be calculated consists in preventing overflows.
More particularly, there are five main parameters that play an important role to this objective:
i) the values of σ0, σ1, σmax;
ii) the number of bits per pixel (bpp);
iii) the size of the image (width×height).
The values of σ0, σ1, σmax, are multiplied by four for each two more bits for defining each pixel, as shown in the two previous tables. When the number of bits per pixels is relatively large (that is bpp>8), it is possible to have an overflow in any of the following multiplications:
σN,(σ1−σ0)(N−Σ0),(σ2−σ1)(N−Σ1).
Therefore, also the registers dedicated for storing countings should be managed for preventing overflows.
According to an embodiment, variables used for carrying out the above multiplications are limited up to 216: with this expedient, the above multiplications will not produce overflows. Depending on the size of the available registers, it is possible to have a different precision, as schematically shown in the following equations:
if (ΣZ>2Precision)ΣZ=2Precision
if (Σ2>2Precision)Σ2=2Precision
if (Σ0>2Precision)Σ0=2Precision
if (Σ1>2Precision)Σ1=2Precision
wherein Precision may be 16, but can even be a different value.
i) a portion that works at a pixel level N
ii) a portion that works at block or image level I
For each pixel, the set of absolute values of the differences is calculated by using the A
A clipping operation that consists in preventing overflows, as explained above, can be carried out if the content of registers exceeds a maximum established value.
After having processed the whole block or also the whole image by using the above described technique, the content of registers is analyzed. They may be provided to the circuit I
Substantially, the embodiment depicted in
1) σ0, σ1, σmax;
2) the values of the pixels Pi provided by the sensor 502 (in case of a Bayer image, they will be the pixel values output by a filter mask 504);
3) EOF: signal that flags the end of the block (or of the image);
4) RESET: it is a resetting signal;
5) CLOCK: it is a timing signal.
The output signal represents the value Φσ, that represents the estimated noise level (standard deviation) associated to the current block (or image).
The system 600 analyzes data acquired by the sensor 602 in “live preview” mode, a N
The function of each circuit or module and the meaning of the signals mentioned in
Another possible embodiment is depicted in
The advantages of embodiments of the methods described herein may include:
Embodiments of the systems and methods described herein may be implemented in a variety of ways, including as a combined system or as separate subsystems. Embodiments may be implemented as discrete circuitry, one or more microprocessors, digital signal processors (DSP), application-specific integrated circuits (ASIC), or the like, or as a series of instructions stored in a memory and executed by a controller, or various combinations of the above. In some embodiments, separately described sub-modules may be combined.
The various embodiments described above can be combined to provide further embodiments. All of the U.S. patents, U.S. patent application publications, U.S. patent applications, foreign patents, foreign patent applications and non-patent publications referred to in this specification and/or listed in the Application Data Sheet, are incorporated herein by reference, in their entirety. Aspects of the embodiments can be modified, if necessary to employ concepts of the various patents, applications and publications to provide yet further embodiments.
These and other changes can be made to the embodiments in light of the above-detailed description. In general, in the following claims, the terms used should not be construed to limit the claims to the specific embodiments disclosed in the specification and the claims, but should be construed to include all possible embodiments along with the full scope of equivalents to which such claims are entitled. Accordingly, the claims are not limited by the disclosure.
Number | Date | Country | Kind |
---|---|---|---|
VA2006A000060 | Oct 2006 | IT | national |