public static void Bitmap2HObjectBpp8(Bitmap bmp, out HObject image)
{
try
{
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
BitmapData srcBmpData = bmp.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format8bppIndexed);
HOperatorSet.GenImage1(out image, "byte", bmp.Width, bmp.Height, srcBmpData.Scan0);
bmp.UnlockBits(srcBmpData);
}
catch (Exception)
{
image = null;
}
}
C#中bitmap图像格式转换为Halcon图像格式
最新推荐文章于 2024-08-19 14:26:50 发布
这段代码展示了如何将Bitmap对象转换为HObject,重点在于使用8位索引模式处理,并捕获异常。它涉及图像数据操作和底层API调用,适用于图像处理或底层编程的学习者。
2180

被折叠的 条评论
为什么被折叠?



