1

我正在尝试使用 c# 获取 1280 x 960 图像的位图。我没有获得单个 1280 x 960 图像,而是获得 3 个复制图像 426 x 320,覆盖 1280 x 960 区域的顶部 1/3,而其余 2/3 为黑色。

这是上传的图片:

http://tinypic.com/r/538ltd/5

这是我正在使用的代码。

using System.Runtime.InteropServices;

byte[] frame;
//... code
frame = new byte[1280 * 960 * 3]; 

// code to get the frame

System.Runtime.InteropServices.GCHandle pinnedArray =   
      GCHandle.Alloc(frame, GCHandleType.Pinned);
IntPtr pointer = pinnedArray.AddrOfPinnedObject();

Bitmap bmp = new Bitmap(width, height, 3 * width, 
        PixelFormat.Format24bppRgb, pointer);

MemoryStream JPEGStream = new MemoryStream ();
bmp.Save(filepath, System.Drawing.Imaging.ImageFormat.Bmp);

我想获得一张覆盖整个区域的 1280 x 960 图像。

4

1 回答 1

0

这是间歇性硬件故障,现在问题已解决。

于 2013-11-01T00:16:01.130 回答