当前位置: 首页 > 编程语言 > C#

如何在Windows8Metro风格的应用程序中获取摄像头?分享

时间:2023-04-11 11:46:59 C#

Windows8Metro风格应用程序中如何获取摄像头?我正在尝试在Windows8Metro风格的应用程序中安装相机,这样我就可以像增强现实一样对其进行一些更改。我试过了,但只能找到如何使用CameraCaptureUI()捕获图像。谁能告诉我如何为AR实现摄像头源?您需要做的就是为CaptureFileAsync传入CameraCaptureUIMode.Video。这是一个示例CameraCaptureUIdialog=newCameraCaptureUI();dialog.VideoSettings.Format=CameraCaptureUIVideoFormat.Mp4;StorageFile文件=空;file=awaitdialog.CaptureFileAsync(CameraCaptureUIMode.Video);if(file!=null){IRandomAccessStreamfileStream=awaitfile.OpenAsync(Windows.Storage.FileAccessMode.Read);//Dosomethingwiththestream}编辑:例如,要应用效果,您可以使用AddEffectAsync方法。mediaCaptureMgr.AddEffectAsync(MediaStreamType.VideoPreview,"Microsoft.Samples.GrayscaleEffect",null);GrayScaleEffect的MicrosoftFoundationTransform(MFT)实现在[此处]。1.此示例应允许您创建自己的效果。我以前写过关于这个的博客。需要用到CaptureElement和MediaCapture对象:以上是C#学习教程:如何获取Windows8Metro风格应用中的摄像头?如果分享的内容对你有用,需要了解更多C#学习教程,希望大家多多关注——varmediaCapture=newMediaCapture();等待mediaCapture.InitializeAsync();this.captureElement.Source=mediaCapture;等待mediaCapture.StartPreviewAsync();本文收集自网络,不代表立场。如涉及侵权,请点击右侧联系管理员删除。如需转载请注明出处:

最新推荐
猜你喜欢