Smoothing

Apply a smoothing filter to an image

Description

This application applies a smoothing filter to an image. Three methods can be used: a gaussian filter , a mean filter , or an anisotropic diffusion using the Perona-Malik algorithm.

Parameters

Input Image -in image Mandatory
Input image to smooth.

Output Image -out image [dtype] Mandatory
Output smoothed image.

Smoothing Type -type [mean|gaussian|anidif] Default value: anidif
Smoothing kernel to apply

  • Mean
  • Gaussian
  • Anisotropic Diffusion

Mean options

Radius -type.mean.radius int Default value: 2
Kernel’s radius (in pixels)

Gaussian options

Radius -type.gaussian.radius float Default value: 2
Standard deviation of the gaussian kernel used to filter the image

Anisotropic Diffusion options

Time Step -type.anidif.timestep float Default value: 0.125
Time step that will be used to discretize the diffusion equation

Nb Iterations -type.anidif.nbiter int Default value: 10
Number of iterations needed to get the result

Conductance -type.anidif.conductance float Default value: 1
Controls the sensitivity of the conductance term in the diffusion equation. The lower it is the stronger the features will be preserved


Available RAM (MB) -ram int Default value: 256
Available memory for processing (in MB).

Examples

From the command-line:

# Image smoothing using a mean filter.
otbcli_Smoothing -in Romania_Extract.tif -out smoothedImage_mean.png uchar -type mean

# Image smoothing using an anisotropic diffusion filter.
otbcli_Smoothing -in Romania_Extract.tif -out smoothedImage_ani.png float -type anidif -type.anidif.timestep 0.1 -type.anidif.nbiter 5 -type.anidif.conductance 1.5

From Python:

# Image smoothing using a mean filter.
import otbApplication

app = otbApplication.Registry.CreateApplication("Smoothing")

app.SetParameterString("in", "Romania_Extract.tif")
app.SetParameterString("out", "smoothedImage_mean.png")
app.SetParameterOutputImagePixelType("out", 1)
app.SetParameterString("type","mean")

app.ExecuteAndWriteOutput()
# Image smoothing using an anisotropic diffusion filter.
import otbApplication

app = otbApplication.Registry.CreateApplication("Smoothing")

app.SetParameterString("in", "Romania_Extract.tif")
app.SetParameterString("out", "smoothedImage_ani.png")
app.SetParameterOutputImagePixelType("out", 6)
app.SetParameterString("type","anidif")
app.SetParameterFloat("type.anidif.timestep", 0.1)
app.SetParameterInt("type.anidif.nbiter", 5)
app.SetParameterFloat("type.anidif.conductance", 1.5)

app.ExecuteAndWriteOutput()