自适应阈值二值化的坏影响 [英] Adaptive threshold Binarization's bad effects

查看:185
本文介绍了自适应阈值二值化的坏影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实现了一些自适应二值化方法,他们使用一个小窗口,并在每个像素的阈值计算。这些方法存在问题:
如果我们选择窗口大小太小,我们会得到这个效果(我认为原因是窗口大小很小)



左上角有一个原始图片,右上角 - 全局阈值结果。左下角 - 将图像分割为某些部分的示例(但我要说的是分析图像的像素小的周围环境,例如大小为10X10的窗口)。
所以你可以在右下图看到这样的算法的结果,我们有一个黑色区域,但它必须是白色的。
有人知道如何改进算法来解决这个问题吗?

解决方案

有很多研究在这个区域,但不幸的是我没有给予良好的链接。



一个想法,可能工作,但我没有测试,是尝试估计照明变化,然后在阈值化之前去除(这是比二值化更好的术语)。
然后问题从自适应阈值处理转移到寻找良好的照明模型。



如果你知道光源的任何事情,那么你当然可以建立一个模型从那。



否则,一个可能工作的快速黑客是对图像应用一个非常重的低通滤镜(模糊),然后使用它作为你的照明模型。然后在原始版本和模糊版本之间创建差异图片,并设置阈值。



编辑:快速测试后,快速黑客真的不会工作。在思考之后,我也不是很惊讶:)

  I = someImage 
Ib = blur很多!')
Idiff = I - Idiff
It = threshold(Idiff,'some global threshold')

编辑2
根据您的图片生成方式,有一个其他的想法可以工作。
尝试从图像的前几行估算照明模型:


  1. 拍摄图像中的前N行

  2. 从N个收集的行中创建一个平均行。

  3. 对于图片中的每一行,减去背景模型行(平均值)。



  4. 不幸的是,我在家里没有任何好的工具来测试这个。


    I implemented some adaptive binarization methods, they use a small window and at each pixel the threshold value is calculated. There are problems with these methods: If we select the window size too small we will get this effect (I think the reason is because of window size is small)

    At the left upper corner there is an original image, right upper corner - global threshold result. Bottom left - example of dividing image to some parts (but I am talking about analyzing image's pixel small surrounding, for example window of size 10X10). So you can see the result of such algorithms at the bottom right picture, we got a black area, but it must be white. Does anybody know how to improve an algorithm to solve this problem?

    解决方案

    There shpuld be quite a lot of research going on in this area, but unfortunately I have no good links to give.

    An idea, which might work but I have not tested, is to try to estimate the lighting variations and then remove that before thresholding (which is a better term than "binarization"). The problem is then moved from adaptive thresholding to finding a good lighting model.

    If you know anything about the light sources then you could of course build a model from that.

    Otherwise a quick hack that might work is to apply a really heavy low pass filter to your image (blur it) and then use that as your lighting model. Then create a difference image between the original and the blurred version, and threshold that.

    EDIT: After quick testing, it appears that my "quick hack" is not really going to work at all. After thinking about it I am not very surprised either :)

    I = someImage
    Ib = blur(I, 'a lot!')
    Idiff = I - Idiff
    It = threshold(Idiff, 'some global threshold')
    

    EDIT 2 Got one other idea which could work depending on how your images are generated. Try estimating the lighting model from the first few rows in the image:

    1. Take the first N rows in the image
    2. Create a mean row from the N collected rows. You know have one row as your background model.
    3. For each row in the image subtract the background model row (the mean row).
    4. Threshold the resulting image.

    Unfortunately I am at home without any good tools to test this.

    这篇关于自适应阈值二值化的坏影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆