Tag: webcam

在Windows 8桌面应用上使用MediaCapture

在Windows 8桌面应用程序中,我需要使用C#4.5中的相机拍摄照片。 我曾尝试使用CameraCaptureUI类,但它不适用于桌面应用程序。 所以我尝试使用MediaCapture类,它可用于Metro应用程序或桌面应用程序。 它的工作原理非常好,基于此处的示例: http : //code.msdn.microsoft.com/windowsapps/media-capture-sample-adf87622/ var capture = new MediaCapture(); // Find the camera device id to use string deviceId = “”; var devices = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(Windows.Devices.Enumeration.DeviceClass.VideoCapture); for (var i = 0; i < devices.Count; i++) { Console.WriteLine(devices[i]); deviceId = devices[i].Id; } // init the settings of the capture var settings = […]

如何显示使用Emgu捕获的网络摄像头图像?

我目前正在开发一个使用面部识别的项目。 因此,我需要一种向用户显示网络摄像头图像的方法,以便他可以调整他的脸部。 我一直在尝试使用尽可能少的CPU来从网络摄像头获取图像: VideoRendererElement WPFMediaKit DirectShow的库 但它们都不是很好……无论是太慢还是太耗费CPU资源。 然后我尝试了Emgu库 ,我觉得很棒。 起初,我在Windows窗体项目中尝试了它,并在图片框中更新图像。 但是,当我试图将它集成到我的WPF项目中时,我遇到了如何将我的图像传递给我的Image控件的问题。 现在,我有以下源代码: 而背后的代码: private Capture capture; private System.Timers.Timer timer; public Window1() { InitializeComponent(); } private void Window_Loaded(object sender, RoutedEventArgs e) { capture = new Capture(); capture.FlipHorizontal = true; timer = new System.Timers.Timer(); timer.Interval = 15; timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); timer.Start(); } void timer_Elapsed(object sender, ElapsedEventArgs […]

C#+ DirectShow.NET =简单的WebCam访问?

我找到了一个用C#访问网络摄像头的例子 。 该示例使用DirectShow.NET库。 我试图理解代码,但到目前为止我唯一可以理解的是,usercontrol以某种方式调用directshow直接绘制到用户控件的表面。 我想访问每个帧并将其放入Bitmap对象。 如何判断新帧何时到达? 如何将这个新帧捕获到位图对象中? 如果您了解DirectShow.NET的方法,这可能很容易回答。