No BSD License  

Highlights from
Automatic Thresholding

3.5

3.5 | 4 ratings Rate this file 23 Downloads (last 30 days) File Size: 1.26 KB File ID: #5389

Automatic Thresholding

by Gauthier Fleutot

 

01 Jul 2004 (Updated 06 Jul 2004)

How to find a good default threshold value?

| Watch this File

File Information
Description

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.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Automatic Thresholding

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
13 Jan 2005 Senes Yin

So Simple!

10 Mar 2008 Farry anto

not good,too bad.

21 Jul 2008 hanno walter

perfect for me

23 Feb 2009 neftirini isabel

what's <nb_of_bins>); ?

20 Oct 2009 Atta-Ul Ghaffar

Not too bad. I found the following error on line 27:
mat = sum(count(T_i:end) .* intensity(T_i:end) ) ./ sum(count(T_i:end));

The calculations should run from, T_i + 1 : end

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
morphology Gauthier Fleutot 22 Oct 2008 07:26:01
segmentation Gauthier Fleutot 22 Oct 2008 07:26:01
histogram isodata threshold edge recognition Gauthier Fleutot 22 Oct 2008 07:26:01
histogram isodata threshold edge recognition Super Luo 16 Mar 2011 21:38:00
morphology Sandhya 19 Apr 2011 15:23:45
segmentation Sandhya 19 Apr 2011 15:23:50

Contact us at files@mathworks.com