简体   繁体   English

在WPF应用程序中从网络摄像头抓取图片?

[英]Grab picture from web cam in WPF Application?

I am using web cam in WPF application. 我在WPF应用程序中使用web cam。 I am using Expression Encoder for video capture. 我正在使用Expression Encoder进行视频捕获。 for video capture I have created Job and its working properly. 对于视频捕获我创建了Job及其正常工作。 While I want to get picture with same resolution as video is. 虽然我想获得与视频分辨率相同的图片。 for this I am using ffmpeg to extract first frame from video. 为此,我使用ffmpeg从视频中提取第一帧。 but quality of image is very low. 但是图像质量很低。 the priority is that image quality should be best of attached web cam and resolution should be as much as video is. 优先考虑的是图像质量应该是最好的附加网络摄像头,分辨率应该与视频一样多。

Either we have any better option in Expression Encode for taking picture or kindly help me with any alternative. 要么我们在Expression Encode中有更好的选择来拍照,要么帮助我任何选择。

You can have a look at this control : 你可以看看这个控件

The control provides the following functionalities: 该控件提供以下功能:

  • Gets a list of available web camera devices on a system. 获取系统上可用的Web摄像头设备列表。

  • Displays a video stream from a web camera device. 显示来自网络摄像头设备的视频流。

  • Gets the current image being captured. 获取当前捕获的图像。

Requirements 要求

  • The WPF version of the control is implemented using .NET Framework 4 Client Profile. 控件的WPF版本使用.NET Framework 4 Client Profile实现。

  • The control uses the VMR-9 renderer filter available since Windows XP SP2. 该控件使用自Windows XP SP2以来可用的VMR-9渲染器过滤器。

  • The control supports both x86 and x64 platform targets. 该控件支持x86和x64平台目标。

For some reason, accessing images from a web cam is far more complicated then it should be. 出于某种原因,从网络摄像头访问图像要复杂得多。 While I have not used the Expression Encode application, I can provide you with two links to CodePlex, where you can find two different libraries that could help you to solve your problem. 虽然我没有使用Expression Encode应用程序,但我可以为您提供两个指向CodePlex的链接,您可以在其中找到两个可以帮助您解决问题的不同库。 Please see the following pages: 请参阅以下页面:

WebCam Library for WinForm and WPF with C# and VB.NET 用于WinForm的WebCam库和带有C#和VB.NET的WPF

WPF MediaKit - For webcam, DVD and custom video support in WPF WPF MediaKit - 用于WPF中的网络摄像头,DVD和自定义视频支持

Alternatively, if you're happy with using Expression Encode, then you could take a look at the following links: 或者,如果您对使用Expression Encode感到满意,那么您可以查看以下链接:

Extracting still pictures from movie files, with C# 使用C#从电影文件中提取静态图片
Extract frames from video files – The Code Project – Multimedia 从视频文件中提取帧 - 代码项目 - 多媒体

I would recommend AForge.Net , it works flawless, free and licensed under LGPL v3 license, it also seems to work in both 32 and 64 bit. 我会推荐AForge.Net ,它可以完美无缺,免费并获得LGPL v3许可,它似乎也适用于32位和64位。

The only drawback is that you need ~400 kb worth of dlls to get the webcam control. 唯一的缺点是你需要~400 kb的dll才能获得网络摄像头控制权。

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

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