4.5.3 Exact Large-Scale Mean-Shift segmentation, step 1 (smoothing)

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.72, page 570 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

foutpos

Output image

Spatial image

ram

Int

Available RAM (Mb)

spatialr

Int

Spatial radius

ranger

Float

Range radius

thres

Float

Mode convergence threshold

maxiter

Int

Maximum number of iterations

rangeramp

Float

Range radius coefficient

modesearch

Boolean

Mode search.

inxml

XML input parameters file

Load otb application from xml file

outxml

XML output parameters file

Save otb application to xml file











Table 4.72: Parameters table for Exact Large-Scale Mean-Shift segmentation, step 1 (smoothing).

Example

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

otbcli_MeanShiftSmoothing -in maur_rgb.png -fout MeanShift_FilterOutput.tif -foutpos MeanShift_SpatialOutput.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.SetParameterString("foutpos", "MeanShift_SpatialOutput.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.