FUNCTION REFERENCE

multithresh

Compute multilevel Otsu image thresholds.

Compute multilevel Otsu image thresholds.

Syntax

[levels, metric] = multithresh(A, N)

N defaults to 1 and must be an integer from 1 to 20. Returns a 1-by-N vector in the input class and range, plus a double effectiveness metric in [0,1]. N=1 uses graythresh scaled to the class range and cast to the input class. Other N use 256 bins across the observed finite range and exact dynamic programming. NaNs are ignored; infinities occupy end bins. Degenerate inputs return zero metric.

Example

[levels, metric] = multithresh(uint8([0 20 90 120 220 255]), 2)

Differences from MATLAB: N=1 follows the task-required graythresh class-range histogram instead of an observed-range histogram. For N>1, optimization is globally optimal on the histogram; tied optima choose the earliest boundaries. Degenerate extra thresholds repeat the maximum.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.