comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Curve Fitting Question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Otsu Threshold for Bimodal Data [message #82169 is a reply to message #82021] Wed, 21 November 2012 09:51 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Gianguido Cianci writes in response to my question about
finding an automatic way to locate the threshold that will
separate a bimodal data set into two populations:

> How about Otsu's method? Meant for images but works for any set of numbers.
>
> http://www.cis.rit.edu/~cnspci/media/software/otsu_threshold .pro
>
> If your numbers aren't integers, I'd multiply by 1000, round, run otsu, divide by 1000. That's assuming 3 sig figs are enough...

The OTSU_THRESHOLD program Gianguido mentions above makes
a number of undocumented assumptions that can cause problems
in the real-world use of the program. In my first attempt
at implementing this algorithm I inadvertently copied all
those dangerous assumptions into my own cgOtsu_Threshold
program.

In particular, this Otsu_Threshold program assumes you
are working with byte type images and that your binsize
is 1. It returns erroneous thresholds if you are working with
real data outside the range 0 to 255 or using bin sizes
other than 1.

Since I work with both these conditions often in effect,
I needed a more robust algorithm. Today I found a great
web page that allowed me to rebuild the algorithm from
the ground floor up:

http://www.labbookpages.co.uk/software/imgProc/otsuThreshold .html

The new algorithm replicates the results of OTSU_Threshold
for byte data with a binsize of 1, but it also works with
real data of whatever data range and with different bin sizes.

You can find the old program with a new algorithm here:

http://www.idlcoyote.com/programs/cgotsu_threshold.pro

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Using TexToIDL in Coyote Graphics Routines
Next Topic: printf within time interval (also posted on exelisvis.com)

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 00:34:14 PDT 2025

Total time taken to generate the page: 0.56204 seconds