Skip to content

estimate_noiseestimate_noiseEstimateNoiseEstimateNoiseestimate_noiseestimate_noise๐Ÿ”—

Short description๐Ÿ”—

estimate_noiseestimate_noiseEstimateNoiseEstimateNoiseestimate_noiseestimate_noise โ€” Estimate the image noise from a single image.

Signature๐Ÿ”—

estimate_noise( image Image, string Method, number Percent, out real Sigma )estimate_noise( Image : : Method, Percent : Sigma )void EstimateNoise( const HObject& Image, const HTuple& Method, const HTuple& Percent, HTuple* Sigma )static void HOperatorSet.EstimateNoise( HObject image, HTuple method, HTuple percent, out HTuple sigma )def estimate_noise( image: HObject, method: str, percent: Union[int, float] ) -> Sequence[float]

def estimate_noise_s( image: HObject, method: str, percent: Union[int, float] ) -> floatHerror estimate_noise( const Hobject Image, const char* Method, double Percent, double* Sigma )

Herror T_estimate_noise( const Hobject Image, const Htuple Method, const Htuple Percent, Htuple* Sigma )

HTuple HImage::EstimateNoise( const HString& Method, const HTuple& Percent ) const

double HImage::EstimateNoise( const HString& Method, double Percent ) const

double HImage::EstimateNoise( const char* Method, double Percent ) const

double HImage::EstimateNoise( const wchar_t* Method, double Percent ) const (Windows only)

HTuple HImage.EstimateNoise( string method, HTuple percent )

double HImage.EstimateNoise( string method, double percent )

Description๐Ÿ”—

The operator estimate_noiseEstimateNoise estimates the standard deviation of additive noise within the domain of the image that is passed in Imageimageimage. The standard deviation is returned in Sigmasigmasigma.

To estimate the noise, one of the following four methods can be selected in Methodmethodmethod:

  • 'foerstner'"foerstner": If Methodmethodmethod is set to 'foerstner'"foerstner", first for each pixel a homogeneity measure is computed based on the first derivatives of the gray values of Imageimageimage. By thresholding the homogeneity measure one obtains the homogeneous regions in the image. The threshold is computed based on a starting value for the image noise. The starting value is obtained by applying the method 'immerkaer'"immerkaer" (see below) in the first step. It is assumed that the gray value fluctuations within the homogeneous regions are solely caused by the image noise. Furthermore it is assumed that the image noise is Gaussian distributed. The average homogeneity measure within the homogeneous regions is then used to calculate a refined estimate for the image noise. The refined estimate leads to a new threshold for the homogeneity. The described process is iterated until the estimated image noise remains constant between two successive iterations. Finally, the standard deviation of the estimated image noise is returned in Sigmasigmasigma.

    Note that in some cases the iteration falsely converges to the value 00. This happens, for example, if the gray value histogram of the input image contains gaps that are caused either by an automatic radiometric scaling of the camera or frame grabber, respectively, or by a manual spreading of the gray values using a scaling factor \(>\) 1.

    Also note that the result obtained by this method is independent of the value passed in Percentpercentpercent.

  • 'immerkaer'"immerkaer": If Methodmethodmethod is set to 'immerkaer'"immerkaer", first the following filter mask is applied to the input image:

    \[\begin{eqnarray*} M = \left| \begin{array}{rrr} 1 & -2 & 1 \\ -2 & 4 & -2 \\ 1 & -2 & 1 \end{array} \right| \enspace . \end{eqnarray*}\]

    The advantage of this method is that \(M\) is almost insensitive to image structure but only depends on the noise in the image. Assuming a Gaussian distributed noise, its standard deviation is finally obtained as

    \[\begin{eqnarray*} \textrm{Sigma} = \sqrt{\frac{\pi}{2}}\frac{1}{6N} \sum_{\textrm{Image}}{\left|\textrm{Image} \ast M\right|} \enspace , \end{eqnarray*}\]

    where \(N\) is the number of image pixels to which \(M\) is applied. Note that the result obtained by this method is independent of the value passed in Percentpercentpercent.

  • 'least_squares'"least_squares": If Methodmethodmethod is set to 'least_squares'"least_squares", the fluctuations of the gray values with respect to a locally fitted gray value plane are used to estimate the image noise. First, a homogeneity measure is computed based on the first derivatives of the gray values of Imageimageimage. Homogeneous image regions are determined by selecting the Percentpercentpercent percent most homogeneous pixels in the domain of the input image, i.e., pixels with small magnitudes of the first derivatives. For each homogeneous pixel a gray value plane is fitted to its 3x3 neighborhood. The differences between the gray values within the 3x3 neighborhood and the locally fitted plane are used to estimate the standard deviation of the noise. Finally, the average standard deviation over all homogeneous pixels is returned in Sigmasigmasigma.

  • 'mean'"mean": If Methodmethodmethod is set to 'mean'"mean", the noise estimation is based on the difference between the input image and a noiseless version of the input image. First, a homogeneity measure is computed based on the first derivatives of the gray values of Imageimageimage. Homogeneous image regions are determined by selecting the Percentpercentpercent percent most homogeneous pixels in the domain of the input image, i.e., pixels with small magnitudes of the first derivatives. A mean filter is applied to the homogeneous image regions in order to eliminate the noise. It is assumed that the difference between the input image and the thus obtained noiseless version of the image represents the image noise. Finally, the standard deviation of the differences is returned in Sigmasigmasigma. It should be noted that this method requires large connected homogeneous image regions to be able to reliably estimate the noise.

Note that the methods 'foerstner'"foerstner" and 'immerkaer'"immerkaer" assume a Gaussian distribution of the image noise, whereas the methods 'least_squares'"least_squares" and'mean'"mean" can be applied to images with arbitrarily distributed noise. In general, the method 'foerstner'"foerstner" returns the most accurate results while the method 'immerkaer'"immerkaer" shows the fastest computation.

If the image noise could not be estimated reliably, the error 3175 is raised. This may happen if the image does not contain enough homogeneous regions, if the image was artificially created, or if the noise is not of Gaussian type. In order to avoid this error, it might be useful in some cases to try one of the following modifications in dependence of the estimation method that is passed in Methodmethodmethod:

  • Increase the size of the input image domain (useful for all methods).

  • Increase the value of the parameter Percentpercentpercent (useful for methods 'least_squares'"least_squares" and 'mean'"mean").

  • Use the method 'immerkaer'"immerkaer", instead of the methods 'foerstner'"foerstner", 'least_squares'"least_squares", or 'mean'"mean". The method 'immerkaer'"immerkaer" does not rely on the existence of homogeneous image regions, and hence is almost always applicable.

Attention๐Ÿ”—

Note that filter operators may return unexpected results if an image with a reduced domain is used as input. Please refer to the chapter Filters.

Execution information๐Ÿ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on tuple level.

Parameters๐Ÿ”—

Imageimageimage (input_object) singlechannelimage(-array) โ†’ object (byte / uint2)object (byte / uint2)HObject (byte / uint2)HImage (byte / uint2)HObject (byte / uint2)Hobject (byte / uint2)

Input image.

Methodmethodmethod (input_control) string โ†’ (string)(string)HTuple (HString)HTuple (string)strHtuple (char*)

Method to estimate the image noise.

Default: 'foerstner'"foerstner"
List of values: 'foerstner', 'immerkaer', 'least_squares', 'mean'"foerstner", "immerkaer", "least_squares", "mean"

Percentpercentpercent (input_control) number โ†’ (real / integer)(real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

Percentage of used image points.

Default: 2020
Suggested values: 1, 2, 5, 7, 10, 15, 20, 30, 40, 501, 2, 5, 7, 10, 15, 20, 30, 40, 50
Restriction: 0 < Percent && Percent <= 50.

Sigmasigmasigma (output_control) real(-array) โ†’ (real)(real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Standard deviation of the image noise.

Assertion: Sigma >= 0

Example๐Ÿ”—

(HDevelop)


read_image (Image, 'combine')
estimate_noise (ImageNoise, 'foerstner', 20, SigmaFoerstner)
estimate_noise (ImageNoise, 'immerkaer', 20, SigmaImmerkaer)
estimate_noise (ImageNoise, 'least_squares', 20, SigmaLeastSquares)
estimate_noise (ImageNoise, 'mean', 20, SigmaMean)

Result๐Ÿ”—

If the parameters are valid, the operator estimate_noiseEstimateNoise returns the value 2 (H_MSG_TRUE). If necessary an exception is raised. If the image noise could not be estimated reliably, the error 3175 is raised.

Combinations with other operators๐Ÿ”—

Combinations

Possible predecessors

grab_imageGrabImage, grab_image_asyncGrabImageAsync, read_imageReadImage, reduce_domainReduceDomain

Possible successors

binomial_filterBinomialFilter, gauss_filterGaussFilter, mean_imageMeanImage, smooth_imageSmoothImage

Alternatives

noise_distribution_meanNoiseDistributionMean, intensityIntensity, min_max_grayMinMaxGray

See also

gauss_distributionGaussDistribution, add_noise_distributionAddNoiseDistribution

References๐Ÿ”—

W. Fรถrstner: โ€œImage Preprocessing for Feature Extraction in Digital Intensity, Color and Range Imagesโ€œ, Springer Lecture Notes on Earth Sciences, Summer School on Data Analysis and the Statistical Foundations of Geomatics, 1999

J. Immerkaer: โ€œFast Noise Variance Estimationโ€œ, Computer Vision and Image Understanding, Vol.ย 64, No.ย 2, pp.ย 300-302, 1996

Module๐Ÿ”—

Foundation