pub fn otsu_threshold(data: &[f64], num_bins: usize) -> f64Expand description
Otsu’s method for automatic threshold selection
Finds the threshold that maximizes inter-class variance over a histogram spanning the data’s
own range (all values, zeros included), and returns the threshold at a bin edge. For MATLAB’s
graythresh on double data, which does not rescale, see [graythresh].
§Arguments
data- Input data (e.g. flattened 3D image)num_bins- Number of histogram bins (typically 256)
§Returns
The optimal threshold value