Order-statistic filters are spatial filters that process an image by sorting the pixel values in a defined neighborhood and selecting a value based on some statistical order (e.g., median, max, min). These filters are non-linear and are effective in removing noise, especially impulse noise, while preserving image edges better than linear filters.
1. Median Filter
- The most commonly used order-statistic filter.
- Replaces each pixel with the median value of the intensities in its neighborhood.
Formula:

- Sxy: neighborhood (like 3×3 or 5×5) centered at (x,y)
- Very effective for salt-and-pepper (impulse) noise.
- Reduces noise without too much blurring.
2. Max Filter
- Selects the maximum intensity value in the neighborhood.
Formula:

- Useful for removing pepper noise (black dots).
- Enhances bright areas in the image.
3. Min Filter
- Selects the minimum intensity value in the neighborhood.
Formula:

- Useful for removing salt noise (white dots).
- Enhances dark regions.
4. Midpoint Filter
- Takes the average of the maximum and minimum values in the neighborhood.
Formula:

- Combines ordering and averaging.
- Works well for Gaussian and uniform noise.
5. Alpha-Trimmed Mean Filter
- Removes d/2 lowest and d/2 highest values from the sorted list of neighborhood pixels.
- Averages the remaining values.
Formula:

