replaces each element in list by the mean of the values of all elements that differ by less than d.


returns the list where only the specified parts pi are replaced with mean-shifted values.


mean shift of the pixel values in image.

Details and Options

  • MeanShift is also known as mode seeking and is typically used to smooth data arrays and images.
  • MeanShift preserves the ordering of the input elements.
  • In MeanShift[image,d,parts], parts can be a marker image or a list of {row,column} positions.
  • The following options can be given:
  • DistanceFunctionEuclideanDistancedistance metric function
    MaxIterations1maximum number of iterations to perform
    Tolerance0allowed tolerance to assume convergence
    WeightsAutomaticweights to use for computing the mean
  • With Tolerance->t, mean-shift iterations stop if no point changes by more than t.
  • By default, unit weights are used. Using Weights->f, function f applied to rescaled distances between elements is used to compute and return a weighted mean of the values. Distances between 0 and d are rescaled to be in the range from 0 and 1.
  • Typical settings for Weights include:
  • UnitStepunit weights (default)
    UnitTrianglelinearly decreasing weight
    "Gaussian"weights based on a Gaussian window with sigma
    {"Gaussian",σ}Gaussian window with sigma σ
  • Common settings for the DistanceFunction option are:
  • ManhattanDistanceManhattan or "city block" distance
    EuclideanDistanceEuclidean distance
    SquaredEuclideanDistancesquared Euclidean distance
    NormalizedSquaredEuclideanDistancenormalized squared Euclidean distance
    CosineDistanceangular cosine distance
    CorrelationDistancecorrelation coefficient distance
    fuse an arbitrary function f


open allclose all

Basic Examples  (3)

Mean shift of a list of integers:

Click for copyable input

Mean shift of a list of vectors:

Click for copyable input

Mean shift of an image's pixels after multiple iterations:

Click for copyable input

Scope  (4)

Options  (8)

Applications  (9)

Properties & Relations  (3)

Neat Examples  (1)

See Also

MeanShiftFilter  ClusterClassify  FindClusters

Introduced in 2010
| Updated in 2014