I have found an example for accessing a webcam in C#. The example uses the DirectShow.NET library. I have tried to understand the code, but so far the only thing I could figure out is that somehow the usercontrol calls directshow to draw directly to the surface of the user control.
我找到了一个用C#访问网络摄像头的例子。该示例使用DirectShow.NET库。我试图理解代码,但到目前为止我唯一可以理解的是,usercontrol以某种方式调用directshow直接绘制到用户控件的表面。
I want to access each frame and put it into a Bitmap object. How can I tell when a new frame arrived? How can I capture this new frame into a Bitmap Object?
我想访问每个帧并将其放入Bitmap对象。如何判断新帧何时到达?如何将这个新帧捕获到位图对象中?
This might be simple to answer if you know your way around DirectShow.NET.
如果您了解DirectShow.NET的方法,这可能很容易回答。
3 个解决方案
#1
You will need to use the ISampleGrabber interface there are many c++ examples on the net on how to use it, it will give you data the in RGB raw format which you can feed into the Bitmap class.
您将需要使用ISampleGrabber接口,网上有许多关于如何使用它的c ++示例,它将为您提供RGB原始格式的数据,您可以将其输入到Bitmap类中。
There is also an open source library called Touchless it has a project in code which takes a web cam and give you a callback every time a new frame arrived.
还有一个名为Touchless的开源库,它有一个代码项目,它带有一个网络摄像头,每次新帧到达时都会给你一个回调。
#2
Be sure to take a look at this article - http://www.codeproject.com/Articles/125478/Versatile-WebCam-C-library ; it is based on Touchless WebCam capturing component (but without other parts from Touchless SDK).
一定要看一下这篇文章 - http://www.codeproject.com/Articles/125478/Versatile-WebCam-C-library;它基于Touchless WebCam捕获组件(但没有Touchless SDK的其他部分)。
#3
If you found Touchless useful, but would like to use the latest DirectX SDK, try getting the latest source after change 31008 at http://touchless.codeplex.com/SourceControl/ListDownloadableCommits.aspx
如果您发现Touchless很有用,但想使用最新的DirectX SDK,请尝试在http://touchless.codeplex.com/SourceControl/ListDownloadableCommits.aspx更改31008后获取最新的源代码。
#1
You will need to use the ISampleGrabber interface there are many c++ examples on the net on how to use it, it will give you data the in RGB raw format which you can feed into the Bitmap class.
您将需要使用ISampleGrabber接口,网上有许多关于如何使用它的c ++示例,它将为您提供RGB原始格式的数据,您可以将其输入到Bitmap类中。
There is also an open source library called Touchless it has a project in code which takes a web cam and give you a callback every time a new frame arrived.
还有一个名为Touchless的开源库,它有一个代码项目,它带有一个网络摄像头,每次新帧到达时都会给你一个回调。
#2
Be sure to take a look at this article - http://www.codeproject.com/Articles/125478/Versatile-WebCam-C-library ; it is based on Touchless WebCam capturing component (but without other parts from Touchless SDK).
一定要看一下这篇文章 - http://www.codeproject.com/Articles/125478/Versatile-WebCam-C-library;它基于Touchless WebCam捕获组件(但没有Touchless SDK的其他部分)。
#3
If you found Touchless useful, but would like to use the latest DirectX SDK, try getting the latest source after change 31008 at http://touchless.codeplex.com/SourceControl/ListDownloadableCommits.aspx
如果您发现Touchless很有用,但想使用最新的DirectX SDK,请尝试在http://touchless.codeplex.com/SourceControl/ListDownloadableCommits.aspx更改31008后获取最新的源代码。