您的位置:首页 > 运维架构

OpenCV :: adaptiveThreshold()

2015-08-10 11:29 363 查看
Applies an adaptive threshold to an array.

void adaptiveThreshold(InputArray src, OutputArray dst, double maxValue, int adaptiveMethod, int thresholdType, int blockSize, double C)

Parameters:
src – Source 8-bit single-channel image.
dst – Destination image of the same size and the same type as src
maxValue – Non-zero value assigned to the pixels for which the condition is satisfied. See the details below
adaptiveMethod – Adaptive thresholding algorithm to use, ADAPTIVE_THRESH_MEAN_C or ADAPTIVE_THRESH_GAUSSIAN_C, See the details below.
thresholdType – Thresholding type that must be either THRESH_BINARY or THRESH_BINARY_INV
blockSize – Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on
C – Constant subtracted from the mean or weighted mean (see the details below). Normally, it is positive but may be zero or negative as well

The function transforms a grayscale image to a binary image according to the formulae:




where T(x,y)is a threshold calculated individually for each pixel

For the method ADAPTIVE_THRESH_MEAN_C , the threshold value T(x,y) is a mean of the \texttt{blockSize} \times \texttt{blockSize} neighborhood of (x, y) minus C .

ADAPTIVE_THRESH_MEAN_C: 计算(x,y)为中心的方块内的均值 - C = (x,y)的值

For the method ADAPTIVE_THRESH_GAUSSIAN_C , the threshold value T(x, y) is a weighted sum (cross-correlation with a Gaussian window) of the \texttt{blockSize} \times \texttt{blockSize} neighborhood of (x, y) minus C . The default sigma (standard deviation) is used for the specified blockSize . See getGaussianKernel() .

ADAPTIVE_THRESH_GAUSSIAN_C:计算(x,y)为中心的高斯块(方块不同位置权重不一样)内的均值 - C = (x, y)的值
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  opencv