filters data by replacing every value by the maximum value in its range-r neighborhood.


uses ri for filtering the ^(th)dimension in data.


  • MaxFilter is a nonlinear filter commonly used to locally smooth data and diminish pepper-like noise, where the amount of smoothing is dependent on the value of r.
  • The function applied to each range-r neighborhood is Max.
  • The data can be any of the following:
  • listarbitrary-rank numerical array
    tseriestemporal data such as TimeSeries, TemporalData,
    imagearbitrary Image or Image3D object
    audioan Audio object
  • For multichannel images, MaxFilter replaces each pixel by a pixel in its neighborhood that has the maximum total intensity, averaged over all channels.
  • MaxFilter[data,{r1,r2,}] computes the maximum value in blocks centered on each sample.
  • MaxFilter assumes the index coordinate system for lists and images.
  • At the data boundaries, MaxFilter uses smaller neighborhoods.


open allclose all

Basic Examples  (3)

Maximum filter of a list:

Filter a TimeSeries:

Maximum filtering of a color image:

Scope  (12)

Data  (7)

Maximum filtering of a numeric vector:

Filtering a symbolic array:

Maximum filtering of a 2D array:

Maximum filtering of a list of Quantity objects:

Filter an Audio signal:

Filtering a 2D grayscale image:

Maximum filter of a 3D image:

Parameters  (5)

Specify one radius to be used in all directions:

Increasing the radius will result in brighter images:

Maximum filtering just in the first direction:

Filtering just in the second direction:

Maximum filtering of a 3D image in the vertical direction only:

Filtering of a 3D image in the horizontal planes only:

Applications  (4)

Remove pepper noise from an astronomical image:

Use a maximum filter to dilate the brighter parts of a color image:

Dilate the brighter parts of an image to remove thin, dark features:

Use maximum filtering to locate borders in an image:

Properties & Relations  (3)

Maximum filtering is the same as Dilation with a box structuring element:

Maximum filtering is the same as ImageFilter with function Max:

Subsequent application of MaxFilter and MinFilter is the same as Closing:

Wolfram Research (2008), MaxFilter, Wolfram Language function, (updated 2016).


Wolfram Research (2008), MaxFilter, Wolfram Language function, (updated 2016).


@misc{reference.wolfram_2020_maxfilter, author="Wolfram Research", title="{MaxFilter}", year="2016", howpublished="\url{}", note=[Accessed: 04-March-2021 ]}


@online{reference.wolfram_2020_maxfilter, organization={Wolfram Research}, title={MaxFilter}, year={2016}, url={}, note=[Accessed: 04-March-2021 ]}


Wolfram Language. 2008. "MaxFilter." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016.


Wolfram Language. (2008). MaxFilter. Wolfram Language & System Documentation Center. Retrieved from