Processing math: 100%
ImageDev

SigmaFilter2d

Performs an adaptive smoothing of a two-dimensional image by excluding any aberrant pixels of a local averaging.

Access to parameter description

For an introduction to image filters: see Images Filtering.

This algorithm computes a local mean from each pixel neighborhood values. Pixel values far from the considered pixel intensity Ic are excluded using a user threshold σ.
Only pixels verifying the following formula are kept for computation:
I[Ic2σ,Ic+2σ] A user-defined population threshold allows the algorithm to switch between the formula above and a classical neighbor mean formula. This parameter avoids considering low populated neighborhoods for computation.

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > sigmaFilter2d( std::shared_ptr< iolink::ImageView > inputImage, int32_t kernelSizeX, int32_t kernelSizeY, double standardDeviation, int32_t populationThreshold, std::shared_ptr< iolink::ImageView > outputImage = NULL );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral nullptr
input
kernelSizeX
The horizontal kernel size in pixels (odd value). Int32 [3, 100] 3
input
kernelSizeY
The vertical kernel size in pixels (odd value). Int32 [3, 100] 3
input
standardDeviation
The intensity interval for retaining a pixel of the neighborhood. Float64 >0 20
input
populationThreshold
The population threshold. If the number of pixels selected by the formula is lower than this threshold, all pixels of the neighborhood are used for computing the mean. Int32 >=0 8
output
outputImage
The output image. Its dimensions, type, and calibration are forced to the same values as the input. Image nullptr

Object Examples

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

SigmaFilter2d sigmaFilter2dAlgo;
sigmaFilter2dAlgo.setInputImage( polystyrene );
sigmaFilter2dAlgo.setKernelSizeX( 3 );
sigmaFilter2dAlgo.setKernelSizeY( 3 );
sigmaFilter2dAlgo.setStandardDeviation( 20.0 );
sigmaFilter2dAlgo.setPopulationThreshold( 8 );
sigmaFilter2dAlgo.execute();

std::cout << "outputImage:" << sigmaFilter2dAlgo.outputImage()->toString();

Function Examples

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

auto result = sigmaFilter2d( polystyrene, 3, 3, 20.0, 8 );

std::cout << "outputImage:" << result->toString();