Adaptive Threshold

Adaptive Threshold

1. Otsu's Binarization:

  1. Using a discriminant analysis to partition the image into 2 classes C0 = {0, 1, 2, ..., t} and C1 = {t+1, t+2, ..., L-1} at which is the total number of the gray levels in image;

  2. (1). Let n be the total number of pixels in the image,

    (2). the probabilities of the two classes equal to \(w_0 = \sum\limits_{i=1}^{t}{p_i}\), \(w_1 = \sum\limits_{i=t+1}{L-1}{p_i}\),

    (3). and so are the means: \(\mu_0(t) = \sum_{i=0}^{t}{\frac{i*p_i}{w_0}} = \sum_{i=0}^{t}{\frac{i*p_i}{{\sum_{i=0}^{t}{p_i}}}}\), \(\mu_1(t) = \sum_{i=t+1}^{L-1}{\frac{i*p_i}{w_1}} = \sum_{i=t+1}^{L-1}{\frac{i*p_i}{w_1}} = \sum_{i=t+1}^{L-1}{\frac{i*p_i}{{\sum_{i=t+1}^{L-1}{p_i}}}}\),

    (4). \(\sigma^{2}_{B}\) and \(\sigma^{2}_{T}\) -- the variance in between classes and total variance,

    (5). \(\mu = \sum_{i=0}^{L-1}{i*p_i}\);

  3. An optimal threshold t* can be computed by maxmizing the \(\sigma_{B}^{2}\) -- \(t^2 = Arg\{\max\limits_{0<=i<=L-1}{(\frac{\sigma_{B}^{2}}{\sigma_T^2})}\}\), where \(\sigma_B^2 = w_{0} * (\mu_{0} - \mu_{T})^{2} + w_{1} * (\mu_1 - \mu_T)^{2}\) and \(\sigma_{T}^{2} = \sum_{i=1}^{L-1}{(i-\mu_{T})^{2}}\);

  4. Simplier formula: \(t^{*} = Arg\{\max\limits_{0<=i<=L}{(w_{0}*[\mu_0-\mu_T]^{2}+w_{1}*[\mu_{1} - \mu_{T}]^{2}})\}\)

2. Bernsen's Method:

  1. [Used when]: different parts of an image show large varivation between background and foreground, especially as a result of darkness or shadow.

  2. Steps:

    (1). Let f(x, y) denotes the gray value in point(x, y);

    (2). For a (2w+1)x(2w+1) mask centered at point(x, y), and the threshold T(x, y) characteristic to image is: T(x, y) = 0.5 x (\(\max\limits_{-w<=m<=w, -w<=n<=w}f(x+m, y+m) + \min\limits_{-w<=m<=w, -w<=n<=w}f(x+m, y+m)\))
    P.S. It's necessary that mask size should be adapted to the size of the existing objects.

3. Niblack's Method:

  1. [Definition]: A local thresholding method that adapts the threshold's valuebased on local mean and local standard deviation, with a specific rectangular window around each pixel location.

  2. Formula:

    Notation: m -- local mean value;
    k -- represents size of window, recommended value: -0.2, adjust it -- trying to improve denoising efficacy and preservation of local details;
    N -- number of pixels;
    \(p_i^2\) -- value of the i-th pixel;
    std -- standard-deviation.

    \(\displaystyle T(x, y) = m(x, y) + k*\sqrt{\frac{\sum_i{p_i^2}}{NP} - m(x, y)^2} = m(x, y) + k*\sqrt{std(x, y)}\)

转载于:https://www.cnblogs.com/ZhengPeng7/p/7690556.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值