ImageDev

MeasureGaussianNoise

Computes an estimation of a gaussian noise standard deviation in an image.

Access to parameter description

This algorithm filters the input image using a zero mean operator that is almost insensitive to image structures. The variance of the result is an estimate of the noise variance. The kernel for filtering the image is $$K = \begin{bmatrix} 1 & -2 & 1\\ -2 & 4 & -2\\ 1 & -2 & 1 \end{bmatrix} $$ which has a zero mean and variance of 36 times the image noise variance. In 2D, the variance of the noise $n$ contained in the image $I$ can then be estimated as $$ \sigma^2_n=\frac{1}{36(M-2)(N-2)}\sum^{M}_{i=1}\sum^{N}_{j=1}(I(i,j)\ast K)^2$$ where $M$ is the image height in pixels, $N$ the image width in pixels and $I(i,j)\ast K$ is the convolution of the image $I$ by the kernel $K$ at the position $(i,j)$.

Reference
J. Immerkoer, "Fast Noise Variance Estimation". Computer Vision and Image Understanding. vol. 64, no. 2, pp. 300-302, Sep. 1996.

See also

Function Syntax

This function returns the outputMeasurement output parameter.
// Function prototype.
GaussianNoiseMsr::Ptr
measureGaussianNoise( std::shared_ptr< iolink::ImageView > inputImage, GaussianNoiseMsr::Ptr outputMeasurement = NULL );
This function returns the outputMeasurement output parameter.
// Function prototype.
measure_gaussian_noise( input_image, output_measurement = None )
This function returns the outputMeasurement output parameter.
// Function prototype.
public static GaussianNoiseMsr
MeasureGaussianNoise( IOLink.ImageView inputImage, GaussianNoiseMsr outputMeasurement = null );

Class Syntax

Parameters

Class Name MeasureGaussianNoise

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral nullptr
output
outputMeasurement
The output measurement result. GaussianNoiseMsr nullptr

Object Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

MeasureGaussianNoise measureGaussianNoiseAlgo;
measureGaussianNoiseAlgo.setInputImage( polystyrene );
measureGaussianNoiseAlgo.execute();

std::cout << "standardDeviation: " << measureGaussianNoiseAlgo.outputMeasurement()->standardDeviation( 0 ) ;
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

measure_gaussian_noise_algo = imagedev.MeasureGaussianNoise()
measure_gaussian_noise_algo.input_image = polystyrene
measure_gaussian_noise_algo.execute()

print( "standardDeviation: ", str( measure_gaussian_noise_algo.output_measurement.standard_deviation( 0 ) ) )
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

MeasureGaussianNoise measureGaussianNoiseAlgo = new MeasureGaussianNoise
{
    inputImage = polystyrene
};
measureGaussianNoiseAlgo.Execute();

Console.WriteLine( "standardDeviation: " + measureGaussianNoiseAlgo.outputMeasurement.standardDeviation( 0 ) );

Function Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

auto result = measureGaussianNoise( polystyrene );

std::cout << "standardDeviation: " << result->standardDeviation( 0 ) ;
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

result = imagedev.measure_gaussian_noise( polystyrene )

print( "standardDeviation: ", str( result.standard_deviation( 0 ) )  )
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

GaussianNoiseMsr result = Processing.MeasureGaussianNoise( polystyrene );

Console.WriteLine(  "standardDeviation: " + result.standardDeviation( 0 )  );