无法在C#PictureBox中显示8MP相机框架

问题描述 投票:0回答:1

我有C#应用程序,可从USB相机下载帧并将其显示在图片框中。与ELP 5MP USB相机配合使用效果很好。但是对于SPINEL 8MP 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 8MP摄像机的'newby'帧参数为:

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

来自ELP 5MP摄像机的Frame'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 . . .
}
c# .net image image-processing bitmap
1个回答
0
投票

如果只想显示摄像机流,建议使用nVLC。>>

© www.soinside.com 2019 - 2024. All rights reserved.