applies the function f to the range-r neighborhood of each pixel in each channel of image.

Details and Options

  • ImageFilter is a generic neighborhood operator that replaces the value of each pixel by the result of applying a function to a pixel neighborhood. It can be used to implement linear or nonlinear local filters.
  • ImageFilter works with 2D and 3D images with any number of channels, operating separately on each channel.
  • ImageFilter[f,image,{r1,r2,}] applies f to blocks centered on each pixel.
  • ImageFilter assumes the index coordinate system for lists and images.
  • The channel values supplied to f are normally in the range 0 to 1, regardless of the underlying type used in the Image object. The function f is assumed to return channel values that are normally in the range 0 to 1.
  • ImageFilter[f,image, r] returns an image of the same type as image.
  • The following options can be given:
  • Padding"Fixed"what values to assume beyond the image
    InterleavingFalsewhether to supply f lists of channel values
    MaskingAllregion of interest
  • With the default setting Interleaving->False, the elements in the arrays to which f is applied are individual channel values for the pixels.
  • With Interleaving->True, the elements are instead the list of all channel values for a particular pixel.
  • ImageFilter by default gives an image of the same dimensions as image.
  • With a setting Padding->None, ImageFilter[f,image,] normally gives an image smaller than image.


open allclose all

Basic Examples  (3)

Apply a local minimum filter:

Blur an image by replacing each pixel with the local mean:

Apply a local maximum filter to a 3D image:

Options  (2)

Interleaving  (1)

Mean filter computed over all channels:

Masking  (1)

Process the area outside a disk:

Applications  (3)

Find the exact position of an image fragment:

Create a mean filter using a line kernel:

Median deviation filter:

Introduced in 2008
Updated in 2010