Otsu thresholding (algorithm adapted from Wikipedia)
Otsu's method