gpt4 book ai didi

c# - aforge.net 中的过滤器不支持源像素格式

转载 作者:行者123 更新时间:2023-12-05 08:43:10 27 4
gpt4 key购买 nike

我正在尝试使用 Aforge.net 开发一个 LPR 系统,我想在我的图像上应用一个过滤器,正如您在此处看到的:

            Bitmap a = new Bitmap(@"C:\Users\Public\Pictures\Sample Pictures\1.png");
SobelEdgeDetector filter = new SobelEdgeDetector();
filter.ApplyInPlace(a);
pictureBox1.Image = a;

但是在运行之后我得到了这个错误:

Source pixel format is not supported by the filter.

我是 aforge.net 的新手。

最佳答案

this可以看出API 文档页面,SobolEdgeDetector 过滤器仅支持 8bpp 灰度图像。

要应用滤镜,您需要先将图像转换为 8bpp 和灰度,例如:

Bitmap a = AForge.Imaging.Image.Clone(
new Bitmap(@"C:\Users\Public\Pictures\Sample Pictures\1.png"),
PixelFormat.Format8bppIndexed);
AForge.Imaging.Image.SetGrayscalePalette(a);

关于c# - aforge.net 中的过滤器不支持源像素格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34483369/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com