简体   繁体   English

C#控件用DirectShow.Net显示摄像头视频

[英]C# control to display camera video with DirectShow.Net

I want to use DirectShow.Net to capture the stream from a webcam.我想使用 DirectShow.Net 从网络摄像头捕获 stream。

What type of UI control can I use to display a the webcam video capture?我可以使用哪种类型的 UI 控件来显示网络摄像头视频捕获?

I have seen an example that uses the whole window of a Form, but are there any other controls I can use: a Panel, PictureBox?我见过一个使用表单的整个 window 的示例,但是我可以使用任何其他控件:面板、图片框?

yes.是的。 you can use pictureboxes or forms or panels.您可以使用图片框或 forms 或面板。

You need to call and use IVideoWindow.您需要调用和使用 IVideoWindow。 you can cast the directshow.net graph that is streaming/capturing to the IVideoWindow and then you can set it to being owned by whatever object you want to put your video stream into.您可以将流式传输/捕获的 directshow.net 图形投射到 IVideoWindow,然后您可以将其设置为由您想要将视频 stream 放入的任何 object 拥有。 just have to give it the objects handle and then set its windowstyle to child of the parent object.只需给它对象句柄,然后将其窗口样式设置为父 object 的子级。

IVideoWindow videowindow;
videowindow = FirstGraph as IVideoWindow;
videowindow.put_Owner(panel1.Handle);
videowindow.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipChildren);

http://channel9.msdn.com/Forums/TechOff/93476-Programatically-Using-A-Webcam-In-C - its not formatted, but it has a code that actually implants what you need. http://channel9.msdn.com/Forums/TechOff/93476-Programatically-Using-A-Webcam-In-C - 它没有格式化,但它有一个代码可以实际植入你需要的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM