我试图将图像读入三维数组。像这样:
Bitmap bmp = new Bitmap("testImage.png");
BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, bmp.PixelFormat);
byte[,,] image = new byte[bmp.Height, bmp.Width, 4];
Marshal.PtrToStructure(bmpData.Scan0, image);
Marshal.StructureToPtr(image, bmpData.Scan0, false);
bmp.UnlockBits(bmpData);
bmp.Save("testImageOut.png");
但这会给我一个错误The specified structure must be blittable or have layout information.
知道我怎么能做到这一点吗?