medpy.filter.image.otsu#

medpy.filter.image.otsu(img, bins=64)[source]#

Otsu’s method to find the optimal threshold separating an image into fore- and background.

This rather expensive method iterates over a number of thresholds to separate the images histogram into two parts with a minimal intra-class variance.

An increase in the number of bins increases the algorithms specificity at the cost of slowing it down.

Parameters:
imgarray_like

The image for which to determine the threshold.

binsinteger

The number of histogram bins.

Returns:
otsufloat

The otsu threshold to separate the input image into fore- and background.