ImageDev

ExponentialFilter2d

Smoothes an image using a kernel based on an exponential distribution.

Access to parameter description

This algorithm performs a 2D smoothing filter whose impulse response is an exponential function. $$ f(x,y) = e^{-\alpha x^2}e^{ -\alpha y^2 } $$ Where: This filter is very close to a Gaussian filter. The main difference is the alpha coefficient, which has an inverse behavior compared to a Gaussian standard deviation.
The filtered image can be normalized by dividing the output gray levels by the sum of absolute values of the kernel coefficients. If not, overflows might occur.

See also

Function Syntax

This function returns the outputImage output parameter.
// Function prototype.
std::shared_ptr< iolink::ImageView >
exponentialFilter2d( std::shared_ptr< iolink::ImageView > inputImage,
                     double alphaFactor,
                     iolink::Vector2i32 kernelSize,
                     ExponentialFilter2d::AutoScale autoScale,
                     std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns the outputImage output parameter.
// Function prototype.
exponential_filter_2d( input_image,
                       alpha_factor = 0.125,
                       kernel_size = [9, 9],
                       auto_scale = ExponentialFilter2d.AutoScale.YES,
                       output_image = None )
This function returns the outputImage output parameter.
// Function prototype.
public static IOLink.ImageView
ExponentialFilter2d( IOLink.ImageView inputImage,
                     double alphaFactor = 0.125,
                     int[] kernelSize = null,
                     ExponentialFilter2d.AutoScale autoScale = ImageDev.ExponentialFilter2d.AutoScale.YES,
                     IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Class Name ExponentialFilter2d

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral nullptr
input
alphaFactor
The alpha factor. The lower this value, the smoother the result. This value must be greater than 0. Practically, this filter response is a mostly visible in the [0.3, 5.3] range. Float64 >0 0.125
input
kernelSize
The size of the kernel. Vector2i32 >0 {9, 9}
input
autoScale
The automatic intensity scaling mode.
NO The result is not normalized; it corresponds to the weighted sum of the window elements.
YES The result is automatically normalized by the sum of the kernel weights.
Enumeration YES
output
outputImage
The output image. Its dimensions are forced to the same values as the input. Its data type is promoted to avoid overflows in the non-normalized mode. Image nullptr

Object Examples

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

ExponentialFilter2d exponentialFilter2dAlgo;
exponentialFilter2dAlgo.setInputImage( polystyrene );
exponentialFilter2dAlgo.setAlphaFactor( 0.125 );
exponentialFilter2dAlgo.setKernelSize( {9, 9} );
exponentialFilter2dAlgo.setAutoScale( ExponentialFilter2d::AutoScale::YES );
exponentialFilter2dAlgo.execute();

std::cout << "outputImage:" << exponentialFilter2dAlgo.outputImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

exponential_filter_2d_algo = imagedev.ExponentialFilter2d()
exponential_filter_2d_algo.input_image = polystyrene
exponential_filter_2d_algo.alpha_factor = 0.125
exponential_filter_2d_algo.kernel_size = [9, 9]
exponential_filter_2d_algo.auto_scale = imagedev.ExponentialFilter2d.YES
exponential_filter_2d_algo.execute()

print( "output_image:", str( exponential_filter_2d_algo.output_image ) );
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

ExponentialFilter2d exponentialFilter2dAlgo = new ExponentialFilter2d
{
    inputImage = polystyrene,
    alphaFactor = 0.125,
    kernelSize = new int[]{9, 9},
    autoScale = ExponentialFilter2d.AutoScale.YES
};
exponentialFilter2dAlgo.Execute();

Console.WriteLine( "outputImage:" + exponentialFilter2dAlgo.outputImage.ToString() );

Function Examples

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

auto result = exponentialFilter2d( polystyrene, 0.125, {9, 9}, ExponentialFilter2d::AutoScale::YES );

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

result = imagedev.exponential_filter_2d( polystyrene, 0.125, [9, 9], imagedev.ExponentialFilter2d.YES )

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

IOLink.ImageView result = Processing.ExponentialFilter2d( polystyrene, 0.125, new int[]{9, 9}, ExponentialFilter2d.AutoScale.YES );

Console.WriteLine( "outputImage:" + result.ToString() );