简体   繁体   English

使用C#中的EasyWebCam在Windows 8平板电脑上自动打开后置摄像头

[英]Automatically open the rear camera on a windows 8 tablet using EasyWebCam in c#

I'm currently putting together a little project in c# designed to be used on Windows based tablets. 我目前正在使用c#整理一个旨在在基于Windows的平板电脑上使用的小项目。

I have integrated the open source code available from http://easywebcam.codeplex.com/ to run the tablets camera. 我已经集成了可从http://easywebcam.codeplex.com/获得的开放源代码,以运行平板电脑相机。 However, when you click the start button, it asks you to choose between the front or rear camera and as it is being used on a touch screen tablet, it's a bit on the fiddly side. 但是,当您单击“开始”按钮时,它会要求您在前置或后置摄像头之间进行选择,并且由于它在触摸屏平板电脑上使用,因此有点偏僻。

Does anyone know of a way of either adding a button to choose between the cameras or, better still, a way of automatically selecting the rear camera? 有谁知道一种添加按钮以在摄像机之间进行选择的方法,或者更好的方法是自动选择后置摄像机的方法?

For Windows Store apps, a list of video capture device ids can be returned from DeviceInformation.FindAllAsync (DeviceClass.VideoCapture). 对于Windows应用商店应用,可以从DeviceInformation.FindAllAsync (DeviceClass.VideoCapture)返回视频捕获设备ID的列表。 See the Device enumeration sample for details. 有关详细信息,请参见设备枚举示例

Then you can set MediaCaptureInitializationSettings.VideoDeviceId and use it to initialize a capture session. 然后,您可以设置MediaCaptureInitializationSettings.VideoDeviceId并将其用于初始化捕获会话。 Note however, this only supports UI-less capture. 但是请注意,这仅支持无UI捕获。 You cannot customize the selection in the CameraCaptureUI dialog. 您无法在CameraCaptureUI对话框中自定义选择。

For Desktop apps, a list of video capture device monikers can be returned from the device numerator (see How To Get A List Of Available Video Capture Devices for an example). 对于桌面应用程序,可以从设备分子返回视频捕获设备别名的列表(有关示例,请参见如何获取可用视频捕获设备的列表 )。 Then you can plug the desired device moniker in your filter graph via IFilterGraph::AddFilter. 然后,您可以通过IFilterGraph :: AddFilter在过滤器图中插入所需的设备名称。

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

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