简体   繁体   English

使用c#在Windows 8应用程序中捕获相机

[英]Camera capture in windows 8 apps using c#

To take a picture using the webcam in windows 8 app by clicking on a button , i have written the following code in c#: 要通过单击按钮在Windows 8应用程序中使用网络摄像头拍照,我已在c#中编写了以下代码:

    private async void camera_Click_1(object sender, RoutedEventArgs e)
    {
        cam = new CameraCaptureUI();
        await cam.CaptureFileAsync(CameraCaptureUIMode.Photo);
    }

now the Camera app got opened when i clicked the button but it's giving me a message: 现在,当我点击按钮时相机应用程序已打开,但它给了我一条消息:

This app needs permission to use your camera
you can change this in app's settings

What app's settings should be changed? 应该更改哪些应用程序的设置?

With Using the Manifest Designer you need to add the following Capabilities into your Package.appxmanifest : 使用Manifest Designer,您需要在Package.appxmanifest添加以下功能

<Capabilities>
   <DeviceCapability Name="webcam" />
</Capabilities>

Note: The webcam capability only grants access to the video stream . 注意: 网络摄像头功能仅授予对视频流的访问权限。 In order to grant access to the audio stream as well, the microphone capability must be also added. 为了同时授予对音频流的访问权限,还必须添加麦克风功能。

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

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