如何在 C# 中获取网络摄像头图像? [英] How to get web cam images in C#?

查看:97
本文介绍了如何在 C# 中获取网络摄像头图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 C# 和 .Net4.0 进行在线视频会议项目.

I'm working on online video conferencing project in C# and .Net4.0.

我想要一个库或代码,我可以用它来每秒收集不同形式的网络摄像头图像.我通过使用 AVICAP32 来尝试这个,其中我们发送消息用于不同的目的,如复制或编辑帧.但在此我们必须在创建处理程序时传递一个图片框的引用,如下所示:

I want a library or code which I can use for collecting web camera images per second in different form. I try this by using the AVICAP32, in which we send Messages for different purpose like copy or edit frames.but in this we have to pass a reference of picturebox while creating handler as given below:

mCapHwnd = capCreateCaptureWindowA("0", 268435456 | 1073741824, 0, 0, 640, 480,picturebox1.Handle.ToInt32(), 0);

使用这些命令我能够捕获图像,但是当我最小化图片框表单时问题就出现了.那时不会创建新图像.

Using these commands I'm able to capture images but the problem comes when I minimize the picturebox form. At that time doesn't create new image.

我认为这是因为我最小化了表单,当它从剪贴板复制图像时,它没有显示任何内容.

I think this is happened because I minimize the form and when it copies the image from this clipboard it doesn't show anything.

我该如何解决这个问题.任何类型的帮助将不胜感激.

How can i solve this problem . Any type of help will be appreciated.

谢谢srdusad

推荐答案

我已经使用所有提到的技术(WIA、AviCap 和 DirectShow)完成了这项工作.DirectShow 是您的最佳选择.查看免费的 DirectShowNet 库,它是 DirectShow 的 .NET 包装器,它甚至包括示例:http://directshownet.sourceforge.净/

I've done this using all the mentioned techniques (WIA, AviCap & DirectShow). DirectShow is your best option. Check out the free DirectShowNet library which is a .NET wrapper for DirectShow, it even includes samples: http://directshownet.sourceforge.net/

更新 2012-07-26:我刚刚发布了我的 Windows 应用程序 CamTimer(用 .NET/C# 编写)的完整源代码.在 https://github.com/johanssonrobotics/CamTimer

UPDATE 2012-07-26: I've just released the complete sourcecode of my Windows app CamTimer (written in .NET/C#). Download/view the complete code (with working Webcam examples) at https://github.com/johanssonrobotics/CamTimer

这篇关于如何在 C# 中获取网络摄像头图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆