ImageDev

CurvatureDrivenDiffusion

Smoothes a two-dimensional image using an advanced local edge analysis technique.

Access to parameter description

For an introduction to image filters: see Images Filtering.

This algorithm smoothes an image with respect to its edges.
The algorithm is ruled by three main parameters: number of iterations, sharpness, and anisotropy.



Figure 1. Curvature-Driven diffusion on a noisy image with default parameters (10 iterations, sharpness = 0.9 and anisotropy = 0.6)


Figure 2. Influence of sharpness parameter on curvature-driven diffusion process: (left) Sharpness = 0.1, (right) Sharpness = 2.0


Figure 3. Influence of anisotropy parameter on curvature-driven diffusion process: (left) Anisotropy = 0.3, (right) Anisotropy = 0.9

Reference:
J.Weickert. "Anisotropic Diffusion in Image Processing". B.G. Teubber Verlag, Stuttgart, 1998.

See also

Function Syntax

This function returns the outputImage output parameter.
// Function prototype.
std::shared_ptr< iolink::ImageView >
curvatureDrivenDiffusion( std::shared_ptr< iolink::ImageView > inputImage,
                          std::shared_ptr< iolink::ImageView > inputMaskImage,
                          int32_t numberOfIterations,
                          double sharpnessFactor,
                          double anisotropyFactor,
                          std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns the outputImage output parameter.
// Function prototype.
curvature_driven_diffusion( input_image,
                            input_mask_image,
                            number_of_iterations = 10,
                            sharpness_factor = 0.9,
                            anisotropy_factor = 0.6,
                            output_image = None )
This function returns the outputImage output parameter.
// Function prototype.
public static IOLink.ImageView
CurvatureDrivenDiffusion( IOLink.ImageView inputImage,
                          IOLink.ImageView inputMaskImage,
                          Int32 numberOfIterations = 10,
                          double sharpnessFactor = 0.9,
                          double anisotropyFactor = 0.6,
                          IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Class Name CurvatureDrivenDiffusion

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral nullptr
input
inputMaskImage
The optional binary mask defining area to process into input image (null to process the whole image). It must have same dimensions as the input image and cannot be null. Image Binary nullptr
input
numberOfIterations
The number of iterations of the curvature-driven diffusion process (must be a positive integer). Int32 >=1 10
input
sharpnessFactor
The edge preserving factor. Float64 >=0 0.9
input
anisotropyFactor
The curvature-driven factor (value within ]0, 1[). Float64 [0, 0.99999] 0.6
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" );
auto polystyrene_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep.vip" );

CurvatureDrivenDiffusion curvatureDrivenDiffusionAlgo;
curvatureDrivenDiffusionAlgo.setInputImage( polystyrene );
curvatureDrivenDiffusionAlgo.setInputMaskImage( polystyrene_sep );
curvatureDrivenDiffusionAlgo.setNumberOfIterations( 3 );
curvatureDrivenDiffusionAlgo.setSharpnessFactor( 0.9 );
curvatureDrivenDiffusionAlgo.setAnisotropyFactor( 0.6 );
curvatureDrivenDiffusionAlgo.execute();

std::cout << "outputImage:" << curvatureDrivenDiffusionAlgo.outputImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip"))

curvature_driven_diffusion_algo = imagedev.CurvatureDrivenDiffusion()
curvature_driven_diffusion_algo.input_image = polystyrene
curvature_driven_diffusion_algo.input_mask_image = polystyrene_sep
curvature_driven_diffusion_algo.number_of_iterations = 3
curvature_driven_diffusion_algo.sharpness_factor = 0.9
curvature_driven_diffusion_algo.anisotropy_factor = 0.6
curvature_driven_diffusion_algo.execute()

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

CurvatureDrivenDiffusion curvatureDrivenDiffusionAlgo = new CurvatureDrivenDiffusion
{
    inputImage = polystyrene,
    inputMaskImage = polystyrene_sep,
    numberOfIterations = 3,
    sharpnessFactor = 0.9,
    anisotropyFactor = 0.6
};
curvatureDrivenDiffusionAlgo.Execute();

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

Function Examples

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

auto result = curvatureDrivenDiffusion( polystyrene, polystyrene_sep, 3, 0.9, 0.6 );

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

result = imagedev.curvature_driven_diffusion( polystyrene, polystyrene_sep, 3, 0.9, 0.6 )

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

IOLink.ImageView result = Processing.CurvatureDrivenDiffusion( polystyrene, polystyrene_sep, 3, 0.9, 0.6 );

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