OpenCV :: adaptiveThreshold()

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)的值 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值