c# - 无法在 C# PictureBox 中显示 8MP 相机帧
问题描述
我有 C# 应用程序,它从 USB 相机下载帧并将它们显示在图片框中。适用于 ELP 5MP USB 相机。但是对于 SPINEL 8MP USB 相机,PictureBox 仍然是黑色的。
我正在使用 Windows 10 Pro 笔记本电脑和 Visual Studio 2017 C#,以及用于 USB 相机帧捕获的 Accord VideoCaptureDevice ( http://accord-framework.net/docs/html/T_Accord_Video_DirectShow_VideoCaptureDevice.htm )
尖晶石 8MP 相机的帧“newby”参数为:
H: 720
HR: 96
PHYS DIM: 1280 X 720
PixelFormat: 32bppArgb
VerRes: 96
W: 1280
1280 x 720
来自 ELP 5MP 相机的帧“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 . . .
}
解决方案
推荐阅读
- sql-server - sql server中的顺序库存利用率
- android - 如何解决“不变违规:对象作为反应孩子无效”
- excel-formula - Excel IFERROR 计算 #VALUE 并返回数字
- php - 使用 php 和 preg_match_all 分析大文本文件
- firebase - 有没有办法按原样克隆 Google Firebase 项目和设置?
- postgresql - Kettle - Duplicate key error using Insert/Update
- r - 点面积是否不会随着 scale_size_continuous 的大小线性增加?
- sql-server - Powershell x86:无法加载文件或程序集 Microsoft.SqlServer.BatchParser
- linux - 执行大量渲染任务时如何在 linux 上正确处理屏幕外 EGLContext?
- jquery - Bootstrap 模态显示事件未被任何事件侦听器拦截