Automatic Thresholding

版本 1.0.0.0 (724 字节) 作者: Gauthier Fleutot
How to find a good default threshold value?
9.3K 次下载
更新时间 2004/7/6

无许可证

Dhanesh Ramachandram posted on same algorithm, march 2003.

This iterative technique for choosing a threshold was developed by Ridler and Calvard . The histogram is initially segmented into two parts using a starting threshold value such as 0 = 2B-1, half the maximum dynamic range.

The sample mean (mf,0) of the gray values associated with the foreground pixels and the sample mean (mb,0) of the gray values associated with the background pixels are computed. A new threshold value 1 is now computed as the average of these two sample means. The process is repeated, based upon the new threshold, until the threshold value does not change any more.
(quote from http://www.ph.tn.tudelft.nl/Courses/FIP/frames/fip-Segmenta.html)

New feature from the m-file of Dhanesh Ramachandram:
- one does not have to rescale one's image to a uint array. This algorithm works for negative intensities, for example.

Run:
vImage = Image(:);
[n xout]=hist(vImage, <nb_of_bins>);
threshold = isodata(n, xout)

You get a (hopefully relevant) threshold for your image.

引用格式

Gauthier Fleutot (2024). Automatic Thresholding (https://www.mathworks.com/matlabcentral/fileexchange/5389-automatic-thresholding), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R13
兼容任何版本
平台兼容性
Windows macOS Linux
致谢

参考作品: Automatic Thresholding

启发作品: Ridler-Calvard image thresholding

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0