【问题标题】:Cannot get an proper bitmap 1290 x 960 image in c#?无法在 c# 中获得正确的位图 1290 x 960 图像?
【发布时间】:2013-09-02 05:47:02
【问题描述】:

我正在尝试使用 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 图像。

【问题讨论】:

  • 显示获取帧的代码,“像素”和颜色字节如何在您的frame 数组中编制索引
  • 位图 bmp = new Bitmap(width, height, 3 * width, PixelFormat.Format24bppRgb, 指针); 3* 宽度在那里做什么??
  • 这是一个硬件故障,现在它正在工作。谢谢

标签: c# image opencv bitmap aforge


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多