Median

Perform a median filter.

Inputs

Image (Type: Image)

The input image.

KernelSizeX (Type: Int32)

The kernel width.

KernelSizeY (Type: Int32)

The kernel height.

Region (Type: Region)

Specifies an optional area of interest.

Outputs

Image (Type: Image)

The output image.

Comments

The median is a noise reduction filter, which often performs better than simple averaging, expecially for salt-and-pepper noise.

For every pixel, the median filter selects the median value of all values in the neighborhood of the pixel.

Here are a few results of the median filter with increasing kernel sizes:

Original:

KernelSizeX = KernelSizeY = 3:

KernelSizeX = KernelSizeY = 5:

KernelSizeX = KernelSizeY = 7:

KernelSizeX = KernelSizeY = 9:

Sample

Here is an example that shows how to use the median filter.