简体   繁体   English

亮度图像的阈值

[英]Thresholding in luminance image

I have an image that contains an illuminate. 我有一个包含照明的图像。 First I crop the area which I want to process then convert it into the binary image. 首先,我裁剪要处理的区域,然后将其转换为二进制图像。 I use Otsu's thresholding, but it gives a bad result for this problem. 我使用了Otsu的阈值设置,但此问题的结果很糟糕。 I have to try to use adaptive threshold, but this method dependent on block size and C parameter (opencv method). 我必须尝试使用​​自适应阈值,但是此方法取决于块大小和C参数(opencv方法)。 What should I do to get a good result in this problem? 我应该怎么做才能在这个问题上取得好的结果?

Original image, but I crop the certain area 原始图片,但我裁切了特定区域 原始图片,但我裁切了特定区域 :

Otsu Thresholding result 大津阈值结果

大津阈值结果

adaptive threshold in not suitable for your case. 自适应阈值不适合您的情况。 if you like to simply create a binary image with black background and white text (or vise-versa), and you have tight cropped area, you can simply do below steps: 如果您只想创建带有黑色背景和白色文本(或反之亦然)的二进制图像,并且裁切区域很紧,则可以执行以下步骤:
1-convert image to gray scale 1将图像转换为灰度
2-normalize your image (ignore 1% of darkest and lightest pixels) 2标准化您的图像(忽略最暗和最亮像素的1%)
3-use a fixed threshold (something between 0.3 to 0.7) 3-使用固定阈值(介于0.3到0.7之间)
4-do some morphological enhancement like eroding, dilating, opening and closing for eliminating noise. 4-做一些形态上的增强,例如腐蚀,扩张,打开和关闭以消除噪音。
adaptive thresholding used in case of uneven luminance when you have a gradient light on board which is not present in you example. 当您的示例中不存在梯度光时,在亮度不均匀的情况下使用自适应阈值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM