Min/Max filter

Multidimensional non-linear min/max filtering
Updated 20 Sep 2018

View License

The filter computes the minima and/or maxima of an array over sliding window with a given size.

Multidimensional array is fully supported: running filter in 1D, 2D filter for image processing applications (erosion/dilatation), 3D and more.

This package has been implemented with a special care on the running speed: the MEX engine uses an algorithms that requires no more than three (3) comparisons per element and per dimension in all configurations.

All numerical and logical class arrays are supported.

Contributor (beside author) is Vaclav Potesil

Cite As

Bruno Luong (2024). Min/Max filter (https://www.mathworks.com/matlabcentral/fileexchange/24705-min-max-filter), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Recognition, Object Detection, and Semantic Segmentation in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

Change MEX files to be compatible with R2018a MEX-API

Correct a small bug when "WIN" is a scalar and input array is vector (error wrongly issued)


Cleaner algorithm for same shape filtering


Correct BUG of cropping the index array when shape is SAME

New feature: Possibly to output corresponding indexes arrays (suggested by a user) + slight improvement of the Lemire's engine.

Correct a bug that causes crash on 64-bit plateform
Additional memory check in one MEX function
Friendly matlab gateway for 1D min/max filtering