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

Perform mean shift filtering

Detailed description

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


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

[1]Table: Parameters table for Exact Large-Scale Mean-Shift segmentation, step 1 (smoothing).
Parameter Key Parameter Name Parameter Type
in Input Image Input image
fout Filtered output Output image
foutpos Spatial image Output image
ram Available RAM (Mb) Int
spatialr Spatial radius Int
ranger Range radius Float
thres Mode convergence threshold Float
maxiter Maximum number of iterations Int
rangeramp Range radius coefficient Float
modesearch Mode search. Boolean
inxml Load otb application from xml file XML input parameters file
outxml Save otb application to xml file XML output parameters file
  • Input Image: The input image.
  • Filtered output: The filtered output image.
  • Spatial image: The spatial image output. Spatial image output is a displacement map (pixel position after convergence).
  • Available RAM (Mb): Available memory for processing (in MB).
  • Spatial radius: Spatial radius of the neighborhood.
  • Range radius: Range radius defining the radius (expressed in radiometry unit) in the multi-spectral space.
  • Mode convergence threshold: Algorithm iterative scheme will stop if mean-shift vector is below this threshold or if iteration number reached maximum number of iterations.
  • Maximum number of iterations: Algorithm iterative scheme will stop if convergence hasn’t been reached after the maximum number of iterations.
  • Range radius coefficient: This coefficient makes dependent the ranger of the colorimetry of the filtered pixel : y = rangeramp*x+ranger.
  • Mode search.: If activated pixel iterative convergence is stopped if the path crosses an already converged pixel. Be careful, with this option, the result will slightly depend on thread number.
  • Load otb application from xml file: Load otb application from xml file.
  • Save otb application to xml file: Save otb application to xml file.


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

otbcli_MeanShiftSmoothing -in maur_rgb.png -fout smooth.tif -foutpos position.tif -spatialr 16 -ranger 16 -thres 0.1 -maxiter 100

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


# 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", "smooth.tif")

MeanShiftSmoothing.SetParameterString("foutpos", "position.tif")

MeanShiftSmoothing.SetParameterInt("spatialr", 16)

MeanShiftSmoothing.SetParameterFloat("ranger", 16)

MeanShiftSmoothing.SetParameterFloat("thres", 0.1)

MeanShiftSmoothing.SetParameterInt("maxiter", 100)

# The following line execute the application


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


This application has been written by OTB-Team.