嗨,我需要将非托管图像转换为需要在图片框上显示的托管位图图像,但我似乎抛出了一个异常,说“对象引用未设置为对象的实例”。有人对此有想法吗?我已经评论了引发异常的行。
for (int i = 0; i < characters.Length; i++)
{
area = characters[i].Area;
UnmanagedImage numer = characters[i].Image;
System.Drawing.Image plateImage = numer.ToManagedImage();//Exception
numberplate = new Bitmap(new Bitmap(plateImage));
pictureBox2.Image = numberplate;
pictureBox2.Refresh();
}
我正在使用带有 C# 的 Aforge.net 框架
更新
for (int i = 0; i < characters.Length; i++)
{
area = characters[i].Area;
Bitmap numer = characters[i].Image.ToManagedImage();
//System.Drawing.Image plateImage = numer.ToManagedImage();
//numberplate = new Bitmap(new Bitmap(plateImage));
pictureBox2.Image = numberplate;
pictureBox2.Refresh();
}