单色黑与白的位图 [英] monochrome black-and-white bitmap

查看:186
本文介绍了单色黑与白的位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的机器人,用于转换从相机捕获的彩色位图到黑色和白色的单色图像(无灰色!)。

I'm working on Android for converting a colored bitmap captured from the camera into a black-and-white monochromatic image (no grays!).

我有几种方法的灰度转换,但我不能设法让我的形象到B和; W格式

I've got several methods for the gray scale conversion but I can't manage to get my image to a b&W format.

有什么方法转换成位图格式?

Are there any methods for converting a bitmap into this format?

推荐答案

一种可靠的方法是平均阈值的位图。该方法在本文的,在该方法部分。它通常用于图像比对,并补偿不同的亮度级别等,您可以直接使用它的颜色,或灰度转换后。如果你把你的形象,你可以简单地从一个缓冲区设置白色像素为白色,黑色黑色的setPixels()

One solid way is a mean threshold bitmap. The method is described in this paper, in the method section. It's often used for image alignment, and will compensate for different brightness levels, etc. You can use it straight from color, or after a greyscale conversion. After you get your image, you can simply set the white pixels to white, and black to black with setPixels() from a buffer.

您也可以调整,以便它不使用意味着什么。你可以有一个滑块0-100%的黑色,其中,平均为50%。这样,你可以为每个画面做即时的调整。你只需要重新计算的门槛,并再次申请像素缓冲区。

You can also tweak it so that it doesn't use the mean exactly. You could have a slider for 0-100% black, where the mean would be 50%. That way you could do on-the-fly adjustments for each individual picture. You just have to recalculate the threshold and apply the pixel buffer again.

这篇关于单色黑与白的位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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