使用DirectShow.NET获取摄像头视频流
开源社区提供了DirectShow的.NET版本,为C#开发者提供了便利。这里分享下如何用DirectShow.NET API来启动摄像头,以及获取视频流数据。 参考原文: Read Barcode from Webcam Viewer with DirectShow.NET 作者: Xiao Ling 翻译:yushulx 学习资源 DirectShow.NET library DirectShow.NET Documentation DirectShow.NET samples 示例:获取视频流数据识别barcode 获取连接设备: DsDevice[] devices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice); 获取DirectShow接口: int hr = 0; this.graphBuilder = (IFilterGraph2)new FilterGraph(); this.captureGraphBuilder = (ICaptureGraphBuilder2)new CaptureGraphBuilder2(); this.mediaControl = (IMediaControl)this.graphBuilder; this.videoWindow = (IVideoWindow