ImageDev

RecursiveExponentialFilter2d

Smoothes a two-dimensional image with a recursive algorithm implementing an exponential filter.

Access to parameter description

This algorithm performs a 2D smoothing filter whose impulse response is an exponential function. The smoothing is achieved by a separable exponential decreasing filter with a variable scale factor. Where: The lower the $\alpha$ value, the smoother the result. Practically, this filter response is mostly visible in the [0.3, 5.3] range.
For convenience, the scale factor is controlled by a spread value in order to convert it between 0 et 100. A value of 0 applies a very limited smoothing, while 100 induces a strong smoothing: $$ SpreadValue=\frac{(5.3-\alpha)}{5}\times 100 $$ 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.

This implementation is based on an Infinite Impulse Response (IIR) algorithm. It computes the sum of one causal and one anti-causal filter where previous results are used to compute the next result. Using this mode, the computation time is independent of the spread parameter.

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > recursiveExponentialFilter2d( std::shared_ptr< iolink::ImageView > inputImage, int32_t spreadValue, std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns outputImage.
// Function prototype.
recursive_exponential_filter_2d( input_image, spread_value = 60, output_image = None )
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
RecursiveExponentialFilter2d( IOLink.ImageView inputImage,
                              Int32 spreadValue = 60,
                              IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Class Name RecursiveExponentialFilter2d

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral nullptr
input
spreadValue
The spread value between 0 and 100. The larger the value, the more intensive the smoothing. Int32 [0, 100] 60
output
outputImage
The output image. Its dimensions are forced to the same values as the input. Its data type is promoted. Image nullptr

Object Examples

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

RecursiveExponentialFilter2d recursiveExponentialFilter2dAlgo;
recursiveExponentialFilter2dAlgo.setInputImage( polystyrene );
recursiveExponentialFilter2dAlgo.setSpreadValue( 60 );
recursiveExponentialFilter2dAlgo.execute();

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

recursive_exponential_filter_2d_algo = imagedev.RecursiveExponentialFilter2d()
recursive_exponential_filter_2d_algo.input_image = polystyrene
recursive_exponential_filter_2d_algo.spread_value = 60
recursive_exponential_filter_2d_algo.execute()

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

RecursiveExponentialFilter2d recursiveExponentialFilter2dAlgo = new RecursiveExponentialFilter2d
{
    inputImage = polystyrene,
    spreadValue = 60
};
recursiveExponentialFilter2dAlgo.Execute();

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

Function Examples

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

auto result = recursiveExponentialFilter2d( polystyrene, 60 );

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

result = imagedev.recursive_exponential_filter_2d( polystyrene, 60 )

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

IOLink.ImageView result = Processing.RecursiveExponentialFilter2d( polystyrene, 60 );

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