无法在C#PictureBox中显示800万像素的相框

时间:2018-05-21 19:26:54

标签: c# .net image image-processing bitmap

我有C#app从USB摄像头下载帧并将其显示在图片框中。适用于ELP 5MP USB摄像头。 但是对于SPINEL 800万像素USB摄像头,PictureBox仍然是黑色的。

我正在使用Windows 10 Pro笔记本电脑和Visual Studio 2017 C#, 和Accord VideoCaptureDevice用于USB相机帧捕获(http://accord-framework.net/docs/html/T_Accord_Video_DirectShow_VideoCaptureDevice.htm

来自Spinel 800万像素相机的帧'newby'参数是:

H: 720
HR: 96
PHYS DIM: 1280 X 720
PixelFormat: 32bppArgb
VerRes: 96
W: 1280
1280 x 720

ELP 500万像素摄像机的帧'newby'参数是:

h: 480
hr: 96
phys dim: 640 x 480
PixelFormat: 32bppArgb
Size: 640 X 480
VERTRES: 96
W: 640

开始从相机下载帧位图的C#代码:

var videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
videoSource = new VideoCaptureDevice( videoDevices[0].MonikerString, pixelFormat_for_ExhaustiveTemplateMatching);
videoSource.NewFrame += new NewFrameEventHandler( EVENT_camera_frame );
videoSource.Start();

C#帧事件代码:

private static void EVENT_camera_frame(object sender, NewFrameEventArgs camera_frame_event)
{

Bitmap newby = new Bitmap(     camera_frame_event);

PictureBox_live_camera.Image = newby;
PictureBox_live_camera.BackgroundImage = newby;

       . . .  processing and Bitmap disposal . . .
}

0 个答案:

没有答案