MeanShiftFilter[data,r,d]
filters data by replacing every value by the mean of the pixels in a range-r neighborhood and whose value is within a distance d.
MeanShiftFilter[data,{r1,r2,…},d]
uses ri for filtering the dimension in data.


MeanShiftFilter
MeanShiftFilter[data,r,d]
filters data by replacing every value by the mean of the pixels in a range-r neighborhood and whose value is within a distance d.
MeanShiftFilter[data,{r1,r2,…},d]
uses ri for filtering the dimension in data.
Details and Options


- MeanShiftFilter is used to locally smooth data and diminish noise while preserving significant jumps such as edges in images, where the amount of smoothing is dependent on the values of r and d.
- The function applied to each range-r neighborhood is MeanShift.
- The data can be any of the following:
-
list arbitrary-rank numerical array tseries temporal data such as TimeSeries, TemporalData, … image arbitrary Image or Image3D object audio an Audio object video a Video object - For multichannel images and audio signals, the distance is computed between channel vectors.
- MeanShiftFilter[data,{r1,r2,…},d] computes the mean shift value in
blocks centered on each sample.
- MeanShiftFilter assumes the index coordinate system for lists and images.
- At the data boundaries, MeanShiftFilter uses smaller neighborhoods.
- The following options can be given:
-
DistanceFunction EuclideanDistance how to compute the distance between values MaxIterations 1 maximum number of iterations to be performed - For a complete list of possible settings for DistanceFunction, see the reference page for MeanShift.
- The possible range for the distance parameter d depends on the distance function as well as the dimension of the color space.


Background & Context
- MeanShiftFilter is a filter for smoothing images to remove local variations typically caused by noise, rough textures, etc. MeanShiftFilter is often used as a preprocessing step before doing other image analysis operations such as segmentation.
- Unlike most other noise-removing filters (e.g. MeanFilter), MeanShiftFilter preserves edges in the image. Other similar functions include PeronaMalikFilter, BilateralFilter, and NonlocalMeansFilter.
Examples
open all close allBasic Examples (3)
Scope (12)
Data (7)
Mean-shift filtering of a 2D array:
Filter a TimeSeries:
Filter an Audio signal:
Parameters (5)
Specify one radius to be used in all directions:
Mean-shift filtering in just the first direction:
Filtering in just the second direction:
Mean-shift filtering of a 3D image in the vertical direction only:
Mean-shift filtering of a 3D image in the horizontal planes only:
Mean-shift filter averages only over pixels that differ in value by less than d:
Options (3)
DistanceFunction (2)
MaxIterations (1)
By default, only one iteration of mean shift is applied to input:
Use MaxIterations to specify the number of iterations:
Applications (2)
Properties & Relations (1)
MeanShiftFilter is equivalent to MeanFilter for distance d greater than the data dynamic range:
Neat Examples (1)
Show how MeanShiftFilter iteratively shifts values until they converge:
History
Introduced in 2010 (8.0) | Updated in 2015 (10.2) ▪ 2016 (11.0) ▪ 2025 (14.3)
Text
Wolfram Research (2010), MeanShiftFilter, Wolfram Language function, https://reference.wolfram.com/language/ref/MeanShiftFilter.html (updated 2025).
CMS
Wolfram Language. 2010. "MeanShiftFilter." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/MeanShiftFilter.html.
APA
Wolfram Language. (2010). MeanShiftFilter. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MeanShiftFilter.html
BibTeX
@misc{reference.wolfram_2025_meanshiftfilter, author="Wolfram Research", title="{MeanShiftFilter}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/MeanShiftFilter.html}", note=[Accessed: 11-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_meanshiftfilter, organization={Wolfram Research}, title={MeanShiftFilter}, year={2025}, url={https://reference.wolfram.com/language/ref/MeanShiftFilter.html}, note=[Accessed: 11-August-2025]}