WOLFRAM

MaxFilter[data,r]

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

MaxFilter[data,{r1,r2,}]

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

Details

  • 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.

Examples

open allclose all

Basic Examples  (3)Summary of the most common use cases

Maximum filter of a list:

Out[1]=1

Filter a TimeSeries:

Out[2]=2
Out[3]=3

Maximum filtering of a color image:

Out[1]=1

Scope  (12)Survey of the scope of standard use cases

Data  (7)

Maximum filtering of a numeric vector:

Out[1]=1

Filtering a symbolic array:

Out[1]=1

Maximum filtering of a 2D array:

Maximum filtering of a list of Quantity objects:

Out[2]=2

Filter an Audio signal:

Out[2]=2
Out[3]=3

Filtering a 2D grayscale image:

Out[1]=1

Maximum filter of a 3D image:

Out[1]=1

Parameters  (5)

Specify one radius to be used in all directions:

Out[1]=1

Increasing the radius will result in brighter images:

Out[1]=1

Maximum filtering just in the first direction:

Out[1]=1

Filtering just in the second direction:

Out[1]=1

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

Out[1]=1

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

Out[2]=2

Applications  (4)Sample problems that can be solved with this function

Remove pepper noise from an astronomical image:

Out[35]=35

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

Out[1]=1

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

Out[1]=1

Use maximum filtering to locate borders in an image:

Out[1]=1

Properties & Relations  (3)Properties of the function, and connections to other functions

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

Out[1]=1

Maximum filtering is the same as ImageFilter with function Max:

Out[1]=1

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

Out[1]=1
Wolfram Research (2008), MaxFilter, Wolfram Language function, https://reference.wolfram.com/language/ref/MaxFilter.html (updated 2016).
Wolfram Research (2008), MaxFilter, Wolfram Language function, https://reference.wolfram.com/language/ref/MaxFilter.html (updated 2016).

Text

Wolfram Research (2008), MaxFilter, Wolfram Language function, https://reference.wolfram.com/language/ref/MaxFilter.html (updated 2016).

Wolfram Research (2008), MaxFilter, Wolfram Language function, https://reference.wolfram.com/language/ref/MaxFilter.html (updated 2016).

CMS

Wolfram Language. 2008. "MaxFilter." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/MaxFilter.html.

Wolfram Language. 2008. "MaxFilter." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/MaxFilter.html.

APA

Wolfram Language. (2008). MaxFilter. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MaxFilter.html

Wolfram Language. (2008). MaxFilter. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MaxFilter.html

BibTeX

@misc{reference.wolfram_2025_maxfilter, author="Wolfram Research", title="{MaxFilter}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/MaxFilter.html}", note=[Accessed: 23-March-2025 ]}

@misc{reference.wolfram_2025_maxfilter, author="Wolfram Research", title="{MaxFilter}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/MaxFilter.html}", note=[Accessed: 23-March-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_maxfilter, organization={Wolfram Research}, title={MaxFilter}, year={2016}, url={https://reference.wolfram.com/language/ref/MaxFilter.html}, note=[Accessed: 23-March-2025 ]}

@online{reference.wolfram_2025_maxfilter, organization={Wolfram Research}, title={MaxFilter}, year={2016}, url={https://reference.wolfram.com/language/ref/MaxFilter.html}, note=[Accessed: 23-March-2025 ]}