FUNCTION REFERENCE

imbinarize

Binarize an image by thresholding.

Binarize an image by thresholding.

Syntax

BW = imbinarize(I)

Syntax

BW = imbinarize(I, 'global')

Syntax

BW = imbinarize(I, 'adaptive', 'Sensitivity', sensitivity)

Syntax

BW = imbinarize(I, T)

Returns a logical array of the size of I that is true where I is greater than the threshold. Without T (or with 'global') the threshold is graythresh(I). T is a scalar or an array of the size of I with values in [0, 1] as fractions of the class range, so for uint8 images BW = I > T*255 and for int16 images BW = I > T*65535 - 32768.

Example

imbinarize(uint8([10 20 200 210]))   % [0 0 1 1]

Example

imbinarize([0.1 0.6 0.9], 0.5)   % [0 1 1]

Example

imbinarize([0.1 0.6 0.9], [0 0.7 0.95])   % [1 0 0]

Example

imbinarize(reshape(0:24,5,5)/24, 'adaptive', 'Sensitivity', .5)

Differences from MATLAB: adaptive mode uses the documented MatRust conventions and work limits listed under adaptthresh; its exact numeric sensitivity mapping is not verified against MATLAB.

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