Replaces each pixel by the median of its window. It is non-linear: it removes impulse ("salt and pepper") noise while preserving edges better than an average.
Parameters
| Parameter | Meaning |
|---|---|
| Kernel size (odd) | k, odd and at least 3. OpenCV only allows k > 5 on 8-bit images. |
References
- OpenCV 4.x documentation — Image Filtering (GaussianBlur, blur, medianBlur, bilateralFilter, morphologyEx). docs.opencv.org/4.x/d4/d86/group__imgproc__filter.html
- T. S. Huang, G. J. Yang, G. Y. Tang. "A fast two-dimensional median filtering algorithm." IEEE Transactions on Acoustics, Speech, and Signal Processing, 27(1):13–18, 1979.
- S. Perreault, P. Hébert. "Median filtering in constant time." IEEE Transactions on Image Processing, 16(9):2389–2394, 2007.