Adaptive Thresholding

Adaptive Thresholdinghttp://homepages.inf.ed.ac.uk/rbf/HIPR2/adpthrsh.htmAdaptiveThresholdingCommonNames: Adaptivethresholding,DynamicthresholdingBriefDescriptionThresholdingisusedtosegmenta

大家好,又见面了,我是你们的朋友全栈君。

http://homepages.inf.ed.ac.uk/rbf/HIPR2/adpthrsh.htm

Adaptive Thresholding


Adaptive Thresholding

Common Names: Adaptive thresholding, Dynamic thresholding

Brief Description

Thresholding is used to segment an image by setting all pixels whose intensity values are above a threshold to a foreground value and all the remaining pixels to a background value.

Whereas the conventional thresholding operator uses a global threshold for all pixels, adaptive thresholding changes the threshold dynamically over the image. This more sophisticated version of thresholding can accommodate changing lighting conditions in the image, e.g. those occurring as a result of a strong illumination gradient or shadows.

Adaptive Thresholding

How It Works

Adaptive thresholding typically takes a grayscale or color image as input and, in the simplest implementation, outputs a binary image representing the segmentation. For each pixel in the image, a threshold has to be calculated. If the pixel value is below the threshold it is set to the background value, otherwise it assumes the foreground value.

There are two main approaches to finding the threshold: (i) the Adaptive ThresholdingChow and Kaneko approach and (ii) Adaptive Thresholdinglocal thresholding. The assumption behind both methods is that smaller image regions are more likely to have approximately uniform illumination, thus being more suitable for thresholding. Chow and Kaneko divide an image into an array of overlapping subimages and then find the optimum threshold for each subimage by investigating its histogram. The threshold for each single pixel is found by interpolating the results of the subimages. The drawback of this method is that it is computational expensive and, therefore, is not appropriate for real-time applications.

An alternative approach to finding the local threshold is to statistically examine the intensity values of the local neighborhood of each pixel. The statistic which is most appropriate depends largely on the input image. Simple and fast functions include the mean of the local intensity distribution,

Eqn:eqnadp1

the median value,

Eqn:eqnadp2

or the mean of the minimum and maximum values,

Eqn:eqnadp3

The size of the neighborhood has to be large enough to cover sufficient foreground and background pixels, otherwise a poor threshold is chosen. On the other hand, choosing regions which are too large can violate the assumption of approximately uniform illumination. This method is less computationally intensive than the Chow and Kaneko approach and produces good results for some applications.

Adaptive Thresholding

Guidelines for Use

Like global thresholding, adaptive thresholding is used to separate desirable foreground image objects from the background based on the difference in pixel intensities of each region. Global thresholding uses a fixed threshold for all pixels in the image and therefore works only if the intensity histogram of the input image contains neatly separated peaks corresponding to the desired subject(s) and background(s). Hence, it cannot deal with images containing, for example, a strong illumination gradient.

Local adaptive thresholding, on the other hand, selects an individual threshold for each pixel based on the range of intensity values in its local neighborhood. This allows for thresholding of an image whose global intensity histogram doesn’t contain distinctive peaks.

A task well suited to local adaptive thresholding is in segmenting text from the image

son1

Because this image contains a strong illumination gradient, global thresholding produces a very poor result, as can be seen in

son1thr1

Using the mean of a 7×7 neighborhood, adaptive thresholding yields

son1adp1

The method succeeds in the area surrounding the text because there are enough foreground and background pixels in the local neighborhood of each pixel; i.e. the mean value lies between the intensity values of foreground and background and, therefore, separates easily. On the margin, however, the mean of the local area is not suitable as a threshold, because the range of intensity values within a local neighborhood is very small and their mean is close to the value of the center pixel.

The situation can be improved if the threshold employed is not the mean, but (mean-C), where C is a constant. Using this statistic, all pixels which exist in a uniform neighborhood (e.g. along the margins) are set to background. The result for a 7×7 neighborhood and C=7 is shown in

son1adp2

and for a 75×75 neighborhood and C=10 in

son1adp3

The larger window yields the poorer result, because it is more adversely affected by the illumination gradient. Also note that the latter is more computationally intensive than thresholding using the smaller window.

The result of using the median instead of the mean can be seen in

son1adp4

(The neighborhood size for this example is 7×7 and C = 4). The result shows that, in this application, the median is a less suitable statistic than the mean.

Consider another example image containing a strong illumination gradient

wdg3

This image can not be segmented with a global threshold, as shown in

wdg3thr1

where a threshold of 80 was used. However, since the image contains a large object, it is hard to apply adaptive thresholding, as well. Using the (mean – C) as a local threshold, we obtain

wdg3adp1

with a 7×7 window and C = 4, and

wdg3adp2

with a 140×140 window and C = 8. All pixels which belong to the object but do not have any background pixels in their neighborhood are set to background. The latter image shows a much better result than that achieved with a global threshold, but it is still missing some pixels in the center of the object. In many applications, computing the mean of a neighborhood (for each pixel!) whose size is of the order 140×140 may take too much time. In this case, the more complex Chow and Kaneko approach to adaptive thresholding would be more successful.

If your image processing package does not contain an adaptive threshold operator, you can simulate the effect with the following steps:

  1. Convolve the image with a suitable statistical operator, i.e. the mean or median.
  2. Subtract the original from the convolved image.
  3. Threshold the difference image with C.
  4. Invert the thresholded image.

Interactive Experimentation

You can interactively experiment with this operator by clicking here.

Exercises

  1. In the above example using

    son1

    why does the mean produce a better result than the median? Can you think of any example where the median is more appropriate?

  2. Think of an appropriate statistic for finding dark cracks on a light object using adaptive thresholding.

  3. If you want to recover text from an image with a strong illumination gradient, how does the local thresholding method relate to the technique of removing the illumination gradient using pixel subtraction? Compare the results achieved with adaptive thresholding, pixel subtraction and pixel division.

References

E. Davies Machine Vision: Theory, Algorithms and Practicalities, Academic Press, 1990, pp 91 – 96.

R. Gonzales and R. Woods Digital Image Processing, Addison-Wesley Publishing Company, 1992, pp 443 – 452.

A. Jain Fundamentals of Digital Image Processing, Prentice-Hall, 1986, p 408.

C.K. Chow and T. Kaneko Automatic Boundary Detection of the Left Ventricle from Cineangiograms, Comp. Biomed. Res.(5), 1972, pp. 388-410.

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/130958.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)
blank

相关推荐

  • keil5安装教程[通俗易懂]

    keil5安装教程[通俗易懂]keil5安装教程第一阶段:安装mdk第一阶段:安装mdk1、下载keil5的解压包,点击运行mdk514.exe文件2、在SetupMDK-ARMV5.14界面,点击Next3、勾选Iagree,点击Next4、自定义安装(1)记住界面弹出的默认安装的路径(2)点击Browse,选择自定义安装的位置,注意路径的命名尽量与默认路径的命名形式保持一致5、…

  • 笔试面试算法经典–最长回文子串

    笔试面试算法经典–最长回文子串回文的定义正读和反读都相同的字符序列为“回文”,如“abba”、“abccba”是“回文”,“abcde”和“ababab”则不是“回文”。字符串的最长回文子串,是指一个字符串中包含的最长的回文子串。例如“1212134”的最长回文子串是“12121”。下面给出了三种求最长子串的方法。解法1(中心扩展法)时间复杂度O(n^2),空间复杂度为O(1)。中心扩展法的思路是,遍历到数组的某一个元素时,以这

  • html卷轴展开动画,Flash制作卷轴展开的动画

    html卷轴展开动画,Flash制作卷轴展开的动画推荐:Flash制作搞笑QQ表情动画副标题#e#QQ表情已经成为一种流行文化,聊天的时候我们经常会被一些搞怪的QQ表情逗得忍俊不禁。其实这些表情制作的方法并不难,只要掌握一些Flash的基本操作,我们就可以把自己的好创意也制作成表情。本实例来自我自己画的一套圆圆溜溜搞怪表情中的一个,下面是制作过北京奥运会开幕式上那充满诗意的卷轴,以及它所呈现给我们的一幅幅无法言喻的美妙画面,大家一定还记忆犹新吧…

  • java向上取整函数_java取整函数,向上取整函数Math.ceil()

    java向上取整函数_java取整函数,向上取整函数Math.ceil()你知道java取整函数要怎样实现吗?下面要给大家分享的是java向上取整函数的相关内容,一起来了解一下具体的方法吧!java向上取整函数Math.ceil():doubledividend=7;//被除数doubledivisor=2;//除数doubleflag=0;intresult1=0;intresult2=0;//函数式flag=Math.ce…

  • 6.Page对象详解

    6.Page对象详解序就好像用户看到的都是由dom表现出来的,所有的业务处理都是在Page对象中处理的。如果业务越简单,创建的Page对象数量就会越少;如果业务越复杂,那么相对而言Page对象数量就越多(或Page实例对象就会越复杂)。Page对象主要做以下事情:渲染页面,保证dom元素的合理安排,以及事件的处理;数据交互,将数据正确的放在dom元素中,并进行合理的前后端数据交互。无论是在哪个时候,这两点确实是前端开发的重中之重,换一句话说这就是前端核心开发内容。为了让Page对象更加专注于上面所提的两件事情,

  • windows10远程桌面连接身份验证错误:函数不受支持,这可能是由于 CredSSP 加密 Oracle 修正

    windows10远程桌面连接身份验证错误:函数不受支持,这可能是由于 CredSSP 加密 Oracle 修正

    2021年11月22日

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号