灰度图像转换成黑色&安培;采用白色Aforge.Net [英] Converting a Grayscale image to black&white using Aforge.Net

查看:506
本文介绍了灰度图像转换成黑色&安培;采用白色Aforge.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很新的Aforge.Net,我在寻找一种方式为灰度图像转换为黑色和白色。我想不出真正找到任何支持?

I am quite new to Aforge.Net and I am looking for a way to convert a greyscale image to black and white. I couldnt really find any support on it?

我设法一个正常的图像转换为应用灰度滤镜灰度再见。但我无法找到关于黑白converion什么

I managed to convert a normal image to a GrayScale bye applying a Grayscale filter. but i couldnt find anything regarding the black and white converion

有人可以给我一只手用它吧。

Can someone give me a hand with it please.

推荐答案

使用阈值类的图像为黑白转换。

Use the Threshold Class to convert the image to black and white.

 // create filter
Threshold filter = new Threshold( 100 );
// apply the filter
filter.ApplyInPlace( image );



阈值类详情可的 Aforge

并使用指定的过滤图像二值化阈值。与强度等于或大于阈值时的所有像素转换为白色像素。所有其它的像素具有低于阈值强度被转换为黑色像素。
中的过滤器接受用于处理8位和16 BPP灰度图像。
注意:由于过滤器可以以8 BPP和16 BPP图像被施加,所述ThresholdValue值应适当地设定到象素格式。在8 BPP图像的情况下的阈值是在[0,255]范围内,但在16 BPP图像的情况下的阈值是在[0,65535]范围

The filter does image binarization using specified threshold value. All pixels with intensities equal or higher than threshold value are converted to white pixels. All other pixels with intensities below threshold value are converted to black pixels. The filter accepts 8 and 16 bpp grayscale images for processing. Note:Since the filter can be applied as to 8 bpp and to 16 bpp images, the ThresholdValue value should be set appropriately to the pixel format. In the case of 8 bpp images the threshold value is in the [0, 255] range, but in the case of 16 bpp images the threshold value is in the [0, 65535] range.

这篇关于灰度图像转换成黑色&安培;采用白色Aforge.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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