BW = imbinarize(I)
BW = imbinarize(I, T)
BW = imbinarize(I, 'global')
BW = imbinarize(I, 'adaptive')
BW = imbinarize(__, 'Sensitivity', value)
BW = imbinarize(__, 'ForegroundPolarity', polarity)
| Parameter | Description |
|---|---|
| I | Input image. |
| T | Numeric threshold. It can be scalar or the same size as I. |
| method | Binarization method: 'global' or 'adaptive'. |
| 'Sensitivity' | Sensitivity passed to adaptive thresholding. |
| 'ForegroundPolarity' | Foreground polarity for adaptive thresholding: 'bright' or 'dark'. |
| Parameter | Description |
|---|---|
| BW | Logical binary image. |
Binarize image using a threshold. The global method uses graythresh when no threshold is supplied. A numeric threshold can be scalar or the same size as the input. The adaptive method uses adaptthresh and supports bright or dark foreground polarity.
I=[0 0.25 0.75 1; 0.1 0.4 0.6 0.9];
BW=imbinarize(I,0.5);
figure; subplot(1,2,1); imagesc(I); g=linspace(0,1,64)'; colormap([g g g]); title('Input');
subplot(1,2,2); imagesc(BW); g=linspace(0,1,64)'; colormap([g g g]); title('Binary');
I=[0.1 0.1 0.1; 0.1 0.9 0.1; 0.1 0.1 0.1];
BW=imbinarize(I,'adaptive','Sensitivity',0.4)
| Version | Description |
|---|---|
| 2.0.0 | initial version |