otsu threshold in python

Hyuga hyugaricdeau at gmail.com
Tue Jun 5 12:02:37 EDT 2007


On Jun 5, 10:19 am, azrael <jura.gro... at gmail.com> wrote:
> Hy guys.
> I'd like to ask you for a favour.
> I tried several times to implement the otsu threshold filter in
> python. but I failed every time. I found the soucre code i n Java from
> the ImageJ project but I never worked in Java and there have been used
> some built in Java functions which I don't know how they behave. I
> also found the otsu threshold in the ia636 python module and would
> like only this filter and don't want to import this library.
> Is there anyone who wold like to help me. I need a function that takes
> a list of 256 elements as an argument and returns the threshold values
> for the threshold according to Otsu.
>
> In addvance, I don't expect someone to do my homework. I really tried
> it, I have been googling and didn't find a standalone function. I
> wasn't able write a standalone function because I don't understand the
> Otsu method. I just know that it works well and that I need it.
>
> If there is no one that wants to help me with this problem, can
> someone at least explain me in a detailed way how to implement it.
>
> Thanks

What is the whole assignment meant to accomplish?  Is the assignment
to implement the Otsu method?  If so, you shouldn't be trying to find
library functions.  Or is it just something you need for some larger
task?

I would ask exactly what problems you're running into, but:
> it, I have been googling and didn't find a standalone function. I
> wasn't able write a standalone function because I don't understand the
> Otsu method. I just know that it works well and that I need it.

How do you know you need it?  Did you learn about this in class?  And
if so, are you expected to understand it?
I've never even heard of it, but I googled it, and found the fourth
hit pretty good: http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/MORSE/threshold.pdf
This gives a reasonable explanation.  I couldn't tell you *exactly*
why it works, but it's understandable enough from that that I can see
that it should work, and to see how to implement it.

Not to mention that the above PDF basically *gives* you the
implementation for free (just make sure not to miss the recurrence
relations at the end of the section on the Otsu method, or else you'll
be screwing yourself).

So give that a look and see if it helps.

Hyuga




More information about the Python-list mailing list