Applies an adaptive threshold to an array

``````dst = cv.adaptiveThreshold(src)
``````

## Input

• src Source 8-bit single-channel `uint8` image.

## Output

• dst Destination image of the same size and the same type as `src`.

## Options

• MaxValue Non-zero value assigned to the pixels for which the condition is satisfied. See the details below. default 255
• Method Adaptive thresholding algorithm to use, default 'Mean'. One of:
• Mean the threshold value `T(x,y)` is a mean of the `BlockSize x BlockSize` neighborhood of `(x,y)` minus `C`
• Gaussian the threshold value `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.getGaussianKernel
• Type Thresholding type, default 'Binary'. One of:
• Binary `dst(x,y) = (src(x,y) > thresh) ? maxValue : 0`
• BinaryInv `dst(x,y) = (src(x,y) > thresh) ? 0 : maxValue`
• BlockSize Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on. Default 3
• C Constant subtracted from the mean or weighted mean. Normally, it is positive but may be zero or negative as well. Default 5

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).