如何使用 MediaCapture 类在 Windows 8 中显示 2 个摄像头的预览 [英] How to display the preview of 2 cameras in windows 8 using the MediaCapture class

查看:22
本文介绍了如何使用 MediaCapture 类在 Windows 8 中显示 2 个摄像头的预览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够使用 MediaCapture 类显示多个相机设备的预览.目前,我使用包含设备 ID 的 MediaCaptureInitializationSettings 对象初始化 MediaCapture.设置对象仅接收 1 个 VideoDeviceId,因此我无法为同一个 MediaCapture 对象设置多个视频源.我尝试的另一件事是创建多个 MediaCapture 对象,每个设备一个.但是,看起来最后一个初始化的是获得设备访问权限的设备,因此即使有多个媒体设备,每个设备都关联到不同的设备,也只允许将其中一个设备的视频显示为预览.

I want to be able to show the preview of several camera devices using the MediaCapture class. Currently I initialize the MediaCapture with a MediaCaptureInitializationSettings object which contains the device id. The settings object receives only 1 VideoDeviceId so I cannot set several video sources for the same MediaCapture object. Another thing I tried was to create several MediaCapture objects, one per device. However, it looks like the last one that gets initialized is the one who gets the device access, so even when there are several media devices each one associated to a different device, only the video of one of the devices is allowed to be displayed as a preview.

下面是代码,以便您更好地理解.

Below is the code so that you can have a better understanding.

async private void PreviewDevice(string deviceId)
{
    var mediaCapture = new MediaCapture();
    var mediaCaptureSettings = new MediaCaptureInitializationSettings
    {
        VideoDeviceId = deviceId
    };
    await mediaCapture.InitializeAsync(mediaCaptureSettings);
    var previewElement = new CaptureElement
    {
        Source = mediaCapture
    };
    CamerasDisplayGrid.Children.Add(previewElement);
    await mediaCapture.StartPreviewAsync();
}

我想要实现的是同时在屏幕上预览多个摄像头.

What I want to achieve is to get the preview of several cameras in the screen at the same time.

请指教.提前致谢

推荐答案

也许这个链接可以帮助:http://social.msdn.microsoft.com/Forums/sr-Cyrl-CS/winappswithcsharp/thread/13d2ce8f-de6d-492c0-84d443a49326f

maybe this link can help: http://social.msdn.microsoft.com/Forums/sr-Cyrl-CS/winappswithcsharp/thread/13d2ce8f-de6d-47c0-8992-4d443a49326f

从应用程序的角度来看,理论上是可行的,但也存在硬件限制.

It's theoretically possible from an application perspective, but there are hardware limitations also in place.

这篇关于如何使用 MediaCapture 类在 Windows 8 中显示 2 个摄像头的预览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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