Median Filter
Perform 2-D median filtering
Libraries:
Computer Vision Toolbox /
Analysis & Enhancement
Computer Vision Toolbox /
Filtering
Description
The Median Filter block applies a median filter to each pixel of an input image. For each M-by-N neighborhood, the filter replaces the central value with the median value of the neighborhood. If the neighborhood has a center element, the block replaces the center pixel with the median value, as shown in this figure.
If the neighborhood does not have an exact center, then the block has a bias toward the upper-left corner of the neighborhood. In this figure, the median value has been placed in the top-left pixel of the four pixels that meet at the center of the neighborhood.
The block pads the edges of the input image for filtering. This causes the pixels within M/2 pixels of the sides and N/2 pixels of the top or bottom of the image to appear distorted.
The median value is less sensitive than the mean to extreme values. Thus, Median Filter is effective for removing salt-and-pepper noise from an image without significantly reducing the sharpness of the image.
Examples
Ports
Input
Output
Parameters
Block Characteristics
Data Types |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
References
[1] Gonzalez, Rafael C., and Richard E. Woods. Digital Image Processing. 2nd ed. Upper Saddle River, N.J: Prentice Hall, 2002.
Extended Capabilities
Version History
Introduced before R2006a