FUNCTION REFERENCE
adaptthresh
Compute locally adaptive image thresholds.
Compute locally adaptive image thresholds.
Syntax
T = adaptthresh(I, sensitivity, 'NeighborhoodSize', size, 'ForegroundPolarity', polarity, 'Statistic', statistic)Returns a double threshold image in [0,1]. Defaults: sensitivity .5, NeighborhoodSize 2*floor(size(I)/16)+1, bright polarity and mean statistic. mean, median and gaussian use replicated borders. Accepts 2-D images and 3-D grayscale volumes. Neighborhood dimensions must be positive odd integers. imbinarize(I,T) compares intensities with this image; imbinarize(I,'adaptive',...) also accepts Sensitivity and the same options, and selects the specified foreground polarity.
Example
adaptthresh(reshape(0:24,5,5)/24, .5, 'NeighborhoodSize', 3)Differences from MATLAB: The public reference does not specify a numeric sensitivity mapping, Gaussian sigma or border rule. This implementation uses 2*(1-sensitivity) times the local statistic for bright foreground, 2*sensitivity for dark, and Gaussian sigma=(windowSize-1)/6. This numerical compatibility choice is not verified against MATLAB. Median and Gaussian work is capped at 100 million taps; windows at 1000001 per axis.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.