开发者

C# Microsoft LifeCam HD mjpeg capture

I have a Microsoft LifeCam HD-5000 webcams. According to AMCap开发者_C百科, the camera outputs a MJPEG stream at 30fps at 720p. I want to capture each JPEG frame in a small application without doing any preview or decompression/transcoding to minimize CPU utilization to the minimum possible.

I'm a C# developer, but I'm new to DirectShow. Is there a simple way to capture the MJPEG stream frame by frame as its output from the camera in C#/.NET without decompressing it?


First of all, you might not need to use DirectShow to access your camera. Check out the OpenCV project, which has .net bindings available at opencvdotnet.

If you'd like to go the DirectShow route, then you'll need the .NET bindings, available at the directshownet project. I believe your best bet will be to create a filter graph that contains your webcam as a source filter, and a sample grabber as your destination filter. Documentation for the sample grabber is on MSDN. This will give you access to the raw data. You can also request a particular data format and use the DirectShow intelligent connect to fill in the filter graph with the right conversion filters.

That being said, I definitely recommend OpenCV over DirectShow. DirectShow is very general purpose, and probably does more than you need it to do. OpenCV can be used to quickly access your camera. Perhaps check out this stackoverflow question Webcam Usage in C# for some more information and answers.


With DirectShowNet, I could never access to a single frame and show it as Bitmap anywhere. In every project I just see converters, direct show to screen or streaming. How to capture the stream as single bitmap frames?


in the Directshow.net Download package, they have sample code and inside Capture there is a project DxSnap which connects to a webcam through directshow.net and snaps a picture from the stream. You can view it and use that as a starting place.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜