cv.adaptiveThreshold - MATLAB File Help |
Applies an adaptive threshold to an array
dst = cv.adaptiveThreshold(src)
dst = cv.adaptiveThreshold(src, 'OptionName',optionValue, ...)
uint8
image.src
.T(x,y)
is a mean of the
BlockSize x BlockSize
neighborhood of (x,y)
minus C
T(x,y)
is a weighted sum
(cross-correlation with a Gaussian window) of the BlockSize x BlockSize
neighborhood of (x,y)
minus C
. The default sigma (standard deviation)
is used for the specified BlockSize
. See cv.getGaussianKerneldst(x,y) = (src(x,y) > thresh) ? maxValue : 0
dst(x,y) = (src(x,y) > thresh) ? 0 : maxValue
The function transforms a grayscale image to a binary image according to the formulae:
Binary
| maxValue, if src(x,y) > T(x,y)
dst(x,y) = |
| 0, otherwise
BinaryInv
| 0, if src(x,y) > T(x,y)
dst(x,y) = |
| maxValue, otherwise
where T(x,y)
is a threshold calculated individually for each pixel (see
Method
parameter).
Note: Internally the options 'BorderType','Replicate', 'Isolated',true
are
used to process boundaries (see cv.copyMakeBorder).