将灰度转换为黑白的最佳阈值 [英] Best threshold for converting grayscale to black and white

查看:784
本文介绍了将灰度转换为黑白的最佳阈值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自动确定将灰度图像转换为黑白图像的最佳阈值的最佳方法是什么?我可以手动找出相当不错的阈值,但我想自动选择阈值。

What's the best way to automatically figure out the best threshold for converting a grayscale image to black and white? I can figure out pretty good threshold values by hand, but I would like to automate choosing the threshold value.

编辑:我一直在读这个问题,通过查看图像的直方图可以提供帮助,例如:如果图像具有双模直方图,那么在模式之间选择阈值似乎是合理的。但是,对于多模态或平面直方图,它看起来更复杂。所以我想我还有更多的阅读要做。感谢所有回复的人!

I've been reading a bit about this problem, and by looking at the histogram for the image can help, e.g. if the image has a bi-modal histogram then choosing a threshold between the modes seems to be reasonably. However, for multi-modal, or flat histograms, it appears more complicated. So I think I have some more reading to do. Thanks to everyone who replied!

推荐答案

0.5除非原始图像非常明亮,否则通常最终会丢失大量信息。实际上,任何绝对阈值都会弄乱一种图像或另一种图像。

0.5 usually ends up loosing a lot of information unless the original image is extremely bright. In fact, any absolute threshold will mess up one kind of images or another.

更好的方法是制作光度直方图并在模式附近选择一个阈值。这应该在大多数图像上比任何绝对阈值都更好。

A better method would be to make a histogram of luminosities and choose a threshold near the mode. This should work better on most images than any absolute threshold.

这篇关于将灰度转换为黑白的最佳阈值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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