Binary Image Cleaning Based on Area Size

Version 1.0.0.0 (628 Bytes) by Zhe Wu
Foreground area larger (or smaller, depending on 'mode') is preserved; otherwise it's deleted.
4.8K Downloads
Updated 13 Nov 2003

No License

function sizethre(im,s,mode);
input: im=binary image matrix. 0 is background. 1 is foreground
input: s=pixel number
mode: string varable. It should either be 'up' or 'down'
when mode='up', area LARGER than s is DELETED
when mode='down', area SMALLER than s is DELETED
output: imout is an image matrix. size(imout)=size(im)
foreground whose area is larger (or smaller, depending on 'mode') is
preserved; otherwise, it is deleted (marked as background);
Zhe Wu 01-08-2002 @ University of Rochester

Cite As

Zhe Wu (2026). Binary Image Cleaning Based on Area Size (https://www.mathworks.com/matlabcentral/fileexchange/4140-binary-image-cleaning-based-on-area-size), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R11.1
Compatible with any release
Platform Compatibility
Windows macOS Linux
Version Published Release Notes
1.0.0.0