ImageDev

Deblurring2d

Enhances contrast and removes blur from a two-dimensional image.

Access to parameter description

For an introduction to image filters: see section Images Filtering.

This algorithm provides contrast enhancement and removes blur. It improves the boundaries of the different objects. The principle is to subtract from the image its own Laplacian.

A sharpening factor parameter controls the filter strength. The higher it is, the more sharpened the edges are and the more noise is revealed.

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > deblurring2d( std::shared_ptr< iolink::ImageView > inputImage, double sharpeningFactor, Deblurring2d::OutputType outputType, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype.
deblurring_2d(input_image: idt.ImageType,
              sharpening_factor: float = 1,
              output_type: Deblurring2d.OutputType = Deblurring2d.OutputType.SAME_AS_INPUT,
              output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
Deblurring2d( IOLink.ImageView inputImage,
              double sharpeningFactor = 1,
              Deblurring2d.OutputType outputType = ImageDev.Deblurring2d.OutputType.SAME_AS_INPUT,
              IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Grayscale or Multispectral nullptr
input
sharpeningFactor
The sharpening factor. Float64 >0 1
input
outputType
The output data type. It can either be the same as the input type, or forced to be float. In the case of floating input images, this parameter has no effect.
SAME_AS_INPUT The output image has same type as the input image. In the case of integer images, this mode can lead to a loss of precision.
FLOAT_32_BIT The output image type is forced to floating point.
Enumeration SAME_AS_INPUT
output
outputImage
The output image. Its dimensions are forced to the same values as the input. Its data type is promoted. Image nullptr
Parameter Name Description Type Supported Values Default Value
input
input_image
The input image. image Grayscale or Multispectral None
input
sharpening_factor
The sharpening factor. float64 >0 1
input
output_type
The output data type. It can either be the same as the input type, or forced to be float. In the case of floating input images, this parameter has no effect.
SAME_AS_INPUT The output image has same type as the input image. In the case of integer images, this mode can lead to a loss of precision.
FLOAT_32_BIT The output image type is forced to floating point.
enumeration SAME_AS_INPUT
output
output_image
The output image. Its dimensions are forced to the same values as the input. Its data type is promoted. image None
Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Grayscale or Multispectral null
input
sharpeningFactor
The sharpening factor. Float64 >0 1
input
outputType
The output data type. It can either be the same as the input type, or forced to be float. In the case of floating input images, this parameter has no effect.
SAME_AS_INPUT The output image has same type as the input image. In the case of integer images, this mode can lead to a loss of precision.
FLOAT_32_BIT The output image type is forced to floating point.
Enumeration SAME_AS_INPUT
output
outputImage
The output image. Its dimensions are forced to the same values as the input. Its data type is promoted. Image null

Object Examples

auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

Deblurring2d deblurring2dAlgo;
deblurring2dAlgo.setInputImage( polystyrene );
deblurring2dAlgo.setSharpeningFactor( 1.0 );
deblurring2dAlgo.setOutputType( Deblurring2d::OutputType::SAME_AS_INPUT );
deblurring2dAlgo.execute();

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

deblurring_2d_algo = imagedev.Deblurring2d()
deblurring_2d_algo.input_image = polystyrene
deblurring_2d_algo.sharpening_factor = 1.0
deblurring_2d_algo.output_type = imagedev.Deblurring2d.SAME_AS_INPUT
deblurring_2d_algo.execute()

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

Deblurring2d deblurring2dAlgo = new Deblurring2d
{
    inputImage = polystyrene,
    sharpeningFactor = 1.0,
    outputType = Deblurring2d.OutputType.SAME_AS_INPUT
};
deblurring2dAlgo.Execute();

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

Function Examples

auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

auto result = deblurring2d( polystyrene, 1.0, Deblurring2d::OutputType::SAME_AS_INPUT );

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

result = imagedev.deblurring_2d(polystyrene, 1.0, imagedev.Deblurring2d.SAME_AS_INPUT)

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

IOLink.ImageView result = Processing.Deblurring2d( polystyrene, 1.0, Deblurring2d.OutputType.SAME_AS_INPUT );

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