5.5.4 Smoothing

Apply a smoothing filter to an image

Detailed description

This application applies smoothing filter to an image. Either gaussian, mean, or anisotropic diffusion are available.

Parameters

This section describes in details the parameters available for this application. Table 5.36, page 530 presents a summary of these parameters and the parameters keys to be used in command-line and programming languages. Application key is Smoothing.




Parameter key

Parameter type

Parameter description




in

Input image

Input Image

out

Output image

Output Image

ram

Int

Available RAM (Mb)

type

Choices

Smoothing Type

type mean

Choice

Mean

type gaussian

Choice

Gaussian

type anidif

Choice

Anisotropic Diffusion

type.mean.radius

Int

Radius

type.gaussian.radius

Float

Radius

type.anidif.timestep

Float

Time Step

type.anidif.nbiter

Int

Nb Iterations

type.anidif.conductance

Float

Conductance

inxml

XML input parameters file

Load otb application from xml file

outxml

XML output parameters file

Save otb application to xml file








Figure 5.36: Parameters table for Smoothing.

Input Image Input image to smooth.

Output Image Output smoothed image.

Available RAM (Mb) Available memory for processing (in MB)

Smoothing Type Smoothing kernel to apply Available choices are:

Load otb application from xml file Load otb application from xml file

Save otb application to xml file Save otb application to xml file

Examples

Example 1 Image smoothing using a mean filter.To run this example in command-line, use the following:

otbcli_Smoothing -in Romania_Extract.tif -out smoothedImage_mean.png uchar -type mean

To run this example from Python, use the following code snippet:

#!/usr/bin/python 
 
# Import the otb applications package 
import otbApplication 
 
# The following line creates an instance of the Smoothing application 
Smoothing = otbApplication.Registry.CreateApplication("Smoothing") 
 
# The following lines set all the application parameters: 
Smoothing.SetParameterString("in", "Romania_Extract.tif") 
 
Smoothing.SetParameterString("out", "smoothedImage_mean.png") 
Smoothing.SetParameterOutputImagePixelType("out", 1) 
 
Smoothing.SetParameterString("type","mean") 
 
# The following line execute the application 
Smoothing.ExecuteAndWriteOutput()

Example 2 Image smoothing using an anisotropic diffusion filter.To run this example in command-line, use the following:

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

To run this example from Python, use the following code snippet:

#!/usr/bin/python 
 
# Import the otb applications package 
import otbApplication 
 
# The following line creates an instance of the Smoothing application 
Smoothing = otbApplication.Registry.CreateApplication("Smoothing") 
 
# The following lines set all the application parameters: 
Smoothing.SetParameterString("in", "Romania_Extract.tif") 
 
Smoothing.SetParameterString("out", "smoothedImage_ani.png") 
Smoothing.SetParameterOutputImagePixelType("out", 6) 
 
Smoothing.SetParameterString("type","anidif") 
 
Smoothing.SetParameterFloat("type.anidif.timestep", 0.1) 
 
Smoothing.SetParameterInt("type.anidif.nbiter", 5) 
 
Smoothing.SetParameterFloat("type.anidif.conductance", 1.5) 
 
# The following line execute the application 
Smoothing.ExecuteAndWriteOutput()

Limitations

None

Authors

This application has been written by OTB-Team.