Otsu’s thresholding method


One of the thresholding method out there is Otsu’s thresholding. What’s interesting about this method, is that, it assumes there’s two probability distribution from the image’s histogram, and these distributions represents the background and foreground of the image.

This method tries to find weighted variances for background and foreground classes, and then try to find the minimum the sum between those two weighted variances, or to find the minimum intra class variance. And since total variance = intra class variance + inter class variance, it also means that we could find the same threshold by finding the maximum variance between classes.

Screen Shot 2014-03-04 at 17.21.30You can find the algorithm on its Wikipedia page

I’ve also created a sample python code that implements Otsu’s thresholding algorithm over here: https://github.com/subokita/Sandbox/blob/master/otsu.py. The sample code shows how the original algorithm (without any optimization) that searches for the minimum inter-class variance works.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s