4.5.3 Mean Shift filtering

Perform mean shift filtering

Detailed description

This application performs mean shift fitlering (multi-threaded).

Parameters

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





Parameter key

Parameter type

Parameter description




in

Input image

Input Image

fout

Output image

Filtered output

spatialr

Int

Spatial radius

ranger

Float

Range radius

thres

Float

Mode convergence threshold

maxiter

Int

Maximum number of iterations

modesearch

Boolean

Mode search.





Table 4.29: Parameters table for Mean Shift filtering.

Example

To run this example in command-line, use the following:

otbcli_MeanShiftSmoothing -in maur_rgb.png -fout MeanShift_FilterOutput.tif -spatialr 16 -ranger 16 -thres 0.1 -maxiter 100

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 MeanShiftSmoothing application 
MeanShiftSmoothing = otbApplication.Registry.CreateApplication("MeanShiftSmoothing") 
 
# The following lines set all the application parameters: 
MeanShiftSmoothing.SetParameterString("in", "maur_rgb.png") 
 
MeanShiftSmoothing.SetParameterString("fout", "MeanShift_FilterOutput.tif") 
 
MeanShiftSmoothing.SetParameterInt("spatialr", 16) 
 
MeanShiftSmoothing.SetParameterFloat("ranger", 16) 
 
MeanShiftSmoothing.SetParameterFloat("thres", 0.1) 
 
MeanShiftSmoothing.SetParameterInt("maxiter", 100) 
 
# The following line execute the application 
MeanShiftSmoothing.ExecuteAndWriteOutput()

Limitations

With mode search option, the result will slightly depend on thread number.

Authors

This application has been written by OTB-Team.