16.16 Median Filter
The medianflt2 X-Function filter examines the N by N pixels centered on each cell of a matrix, finds the median value of the N by N cells, and then replaces the central cell value with the median value. The filter is useful for removing spot noise (white spots, black spots) from an image because noisy pixels typically have values that depart significantly from the median cell values.
To use this function:
- Create a new matrix with data.
- Activate the matrix.
- Select Analysis: Mathematics: Median Filter. This opens the medianflt2 dialog.
Controls recalculation of analysis results
For more information, see: Recalculating Analysis Results
The input Matrix.
For help with range controls, see: Specifying Your Input Data
The output matrix.
For help with the range controls, see: Output Results
Specify the filter window size.
Specifies how to pad cells outside borders.
- Pads with zeros.
- Uses reflection padding.
- Repeats edge values.
This function examines an matrix centered on each cell of a matrix, finds the median value of the N by N cells, and then replaces the central cell value with the median value.
For a 3 X 3 filter matrix, centered on cell (2,2), the matrix is:
The median value of the filter matrix is ; therefore cell(2,2) in the output matrix remains .
When applying filtering to the edge of source matrix, the filter may fall outside the matrix. In such cases, we can pad the area outside the source matrix with zeros (Zero Padding), by reflection padding (Map Padding), or by repeating edge values (Repeat Padding).