【发布时间】:2012-08-04 18:27:08
【问题描述】:
我正在尝试在 Aforge 中应用 Bradleys 阈值算法
每次我尝试处理图像时都会出现以下异常
throw new UnsupportedImageFormatException("源像素格式不 过滤器支持。");
在应用算法之前,我使用以下方法对图像进行了灰度化
private void button2_Click(object sender, EventArgs e)
{
Grayscale filter = new Grayscale(0.2125, 0.7154, 0.0721);
Bitmap grayImage = filter.Apply(img);
pictureBox1.Image = grayImage;
}
算法调用代码
public void bradley(ref Bitmap tmp)
{
BradleyLocalThresholding filter = new BradleyLocalThresholding();
filter.ApplyInPlace(tmp);
}
我在图像处理实验室尝试了正常的图像,它确实有效,但在我的系统上却不行。
知道我做错了什么吗?
【问题讨论】:
-
你确定你的
bradley方法真的接收到灰度过滤的图像吗?当我运行您的代码并直接在button2_Click中的grayImage上应用BradleyLocalThresholding过滤器时(在更新pictureBox1.Image之前),Bradley 过滤器按需要工作。