如何在Windows 8 Metro风格的应用程序中获取相机供稿? [英] How to get camera feeds in Windows 8 Metro style app?

查看:59
本文介绍了如何在Windows 8 Metro风格的应用程序中获取相机供稿?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Windows 8 Metro风格的应用程序中获取相机供稿,以便我可以对其进行一些更改,例如增强现实.我已经尝试过,但是只能找到如何使用CameraCaptureUI()捕获图像.谁能告诉我如何实现AR的相机供稿?

I am trying to get camera feeds in Windows 8 metro style app so that i can make some changes on it something like augmented reality. I have tried but only able to find how to capture images using CameraCaptureUI(). Can anyone tell me how can i achieve camera feeds for AR?

推荐答案

您需要做的就是传递CameraCaptureUIMode.Video for CaptureFileAsync.这是一个示例

All you need to do is pass in CameraCaptureUIMode.Video for CaptureFileAsync. Here is a sample

CameraCaptureUI dialog = new CameraCaptureUI();
dialog.VideoSettings.Format = CameraCaptureUIVideoFormat.Mp4;

StorageFile file = null;
file = await dialog.CaptureFileAsync(CameraCaptureUIMode.Video);
if (file != null)
{

    IRandomAccessStream fileStream = await   file.OpenAsync(Windows.Storage.FileAccessMode.Read);
    //Do something with the stream
}

例如,要应用效果,可以使用AddEffectAsync方法.

In order to apply effects you can use the AddEffectAsync method, for example.

mediaCaptureMgr.AddEffectAsync(MediaStreamType.VideoPreview, "Microsoft.Samples.GrayscaleEffect", null);

GrayScaleEffect的Microsoft Foundation Transform(MFT)实现在[here]. 1 .该示例应允许您创建自己的效果.

The Microsoft Foundation Transform (MFT) implementation of the GrayScaleEffect is [here]. 1. That example should allow you to create your own effects.

这篇关于如何在Windows 8 Metro风格的应用程序中获取相机供稿?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆