MaxFilter[image, r]
filters image by replacing every value by the maximum in its range-r neighborhood.

MaxFilter[data, r]
applies max filtering to an array of data.


  • MaxFilter[image, r] finds the maximum in × blocks centered on each pixel.
  • At the edges of an image, MaxFilter uses smaller neighborhoods.
  • MaxFilter works with 3D as well as 2D images, and also with data arrays of any rank.
  • MaxFilter[image, {rrow, rcol}] uses range in height, and in width.
  • MaxFilter[image, {rslice, rrow, rcol}] uses range in height, in depth, and in width.
  • MaxFilter[image, {r1, r2}] uses neighborhoods with vertical range and horizontal range .
  • For multichannel images, MaxFilter[image, ...] replaces each pixel by a pixel in its neighborhood that has the maximum total intensity, averaged over all channels.

ExamplesExamplesopen allclose all

Basic Examples (3)Basic Examples (3)

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

Click for copyable input

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

Click for copyable input

Maximum filter of a vector:

Click for copyable input
New in 7 | Last modified in 9
New to Mathematica? Find your learning path »
Have a question? Ask support »