初始化连接到三个USB控制器的三个Kinect [英] Initialize three Kinects connected to three USB-Controllers

查看:77
本文介绍了初始化连接到三个USB控制器的三个Kinect的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!是否可以将三个kinect设备与一台计算机一起使用?
$


当我插入3个kinects启动程序时,运行时初始化失败。当我只插入一个或两个设备时,没有失败。我努力寻找一些有两个以上运动的例子。但是就像没有人试过使用3个kinects一样。
所以我真的不知道我做错了什么。也许有人可以帮助我。或者有人有3个kinects和一台带3个控制器的电脑,可以尝试看看它是否适用于他的电脑。
$


我有3个USB控制器(两个USB 2.0和一个USB 3.0)



在设备管理器中,所有3个运动都正确显示。 (对于每个kinect:设备/音频控制/摄像头)



这里我的代码:


使用System; 
使用System.Collections.Generic;
使用System.Linq;
使用System.Text;使用System.Windows
;使用System.Windows.Controls
;
使用System.Windows.Data;
使用System.Windows.Documents;
使用System.Windows.Input;
使用System.Windows.Media;
使用System.Windows.Media.Imaging;使用System.Windows.Navigation
;
使用System.Windows.Shapes;
使用Microsoft.Research.Kinect.Nui;

名称空间WpfApplication2
{
///< summary>
/// MainWindow.xaml的交互逻辑
///< / summary>
public partial class MainWindow:Window
{
public MainWindow()
{
InitializeComponent();
}

int numOfCams = 1;
列表<运行时> NUI;

private void Window_Loaded(object sender,RoutedEventArgs e)
{
numOfCams =(new Device())。Count;
nui = new List< Runtime>();

for(int i = 0; i< numOfCams; i ++)
{
nui.Add(new Runtime(i));
}

foreach(nui中的运行时间)
{
// initialice所有kinect设备
尝试
{
r .Initialize(RuntimeOptions.UseColor | RuntimeOptions.UseDepth);
}
catch(InvalidOperationException)
{
System.Windows.MessageBox.Show("运行时初始化失败。请确保插入Kinect设备。");
返回;
}


尝试
{
r.VideoStream.Open(ImageStreamType.Video,2,ImageResolution.Resolution640x480,ImageType.Color);
r.DepthStream.Open(ImageStreamType.Depth,2,ImageResolution.Resolution640x480,ImageType.Depth);
}
catch(InvalidOperationException)
{
System.Windows.MessageBox.Show(""无法打开流。请确保指定支持的图像类型和分辨率。" );
返回;
}

r.DepthFrameReady + = new EventHandler< ImageFrameReadyEventArgs>(nui_DepthFrameReady);
r.VideoFrameReady + = new EventHandler< ImageFrameReadyEventArgs>(nui_VideoFrameReady);
r.NuiCamera.ElevationAngle = 0;
}
}

void nui_DepthFrameReady(对象发送者,ImageFrameReadyEventArgs e)
{
}

void nui_VideoFrameReady(对象发送者) ,ImageFrameReadyEventArgs e)
{
}

private void Window_Closed(对象发送者,EventArgs e)
{
foreach(运行时r in nui)
r.Uninitialize();

Environment.Exit(0);
}
}
}

解决方案

我刚刚将一些故障排除信息添加到只有2个kinects有类似问题的线程中:http://social.msdn.microsoft.com/论坛/ en-US / kinectsdk / thread / 857d33b5-e58d-461b-8f75-614aa17bcd72你能按照我在该主题中概述的步骤,
但是应用于3个kinects而不是2,并回到我们这里?涡

Hi! Is it possible to use three kinect devices with one Computer?

When I start my program with 3 kinects plugged in, the runtime initialization failes. There is no fail when I plug just one or two devices. I tried hard to find some examples with more than two kinects. But it is like nobody has ever tried to use 3 kinects. So I have really no idea what I am doing wrong. Maybe somebody can help me. Or someone has 3 kinects and a computer with 3 controllers and could try and see if it works with his PC.

I have 3 USB-Controller (two USB 2.0 and one USB 3.0)

In Device Manager are all 3 kinects displayed correctly. (for each kinect: device/audio control/camera)

Here my code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Research.Kinect.Nui;

namespace WpfApplication2
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        int numOfCams = 1;
        List<Runtime> nui;

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            numOfCams = (new Device()).Count;
            nui = new List<Runtime>();

            for (int i = 0; i < numOfCams; i++)
            {
                nui.Add(new Runtime(i));
            }

            foreach (Runtime r in nui)
            {
                // initialice all kinect devices
                try
                {
                    r.Initialize(RuntimeOptions.UseColor | RuntimeOptions.UseDepth);
                }
                catch (InvalidOperationException)
                {
                    System.Windows.MessageBox.Show("Runtime initialization failed. Please make sure Kinect device is plugged in.");
                    return;
                }


                try
                {
                    r.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color);
                    r.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution640x480, ImageType.Depth);
                }
                catch (InvalidOperationException)
                {
                    System.Windows.MessageBox.Show("Failed to open stream. Please make sure to specify a supported image type and resolution.");
                    return;
                }

                r.DepthFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nui_DepthFrameReady);
                r.VideoFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nui_VideoFrameReady);
                r.NuiCamera.ElevationAngle = 0;
            }
        }

        void nui_DepthFrameReady(object sender, ImageFrameReadyEventArgs e)
        {
        }

        void nui_VideoFrameReady(object sender, ImageFrameReadyEventArgs e)
        {
        }

        private void Window_Closed(object sender, EventArgs e)
        {
            foreach (Runtime r in nui)
                r.Uninitialize();

            Environment.Exit(0);
        }
    }
}

解决方案

I just added some troubleshooting information to a thread having a similar problem with just 2 kinects: http://social.msdn.microsoft.com/Forums/en-US/kinectsdk/thread/857d33b5-e58d-461b-8f75-614aa17bcd72 Could you follow the steps I outlined in that thread, but applied to 3 kinects instead of 2, and get back to us? Eddy


这篇关于初始化连接到三个USB控制器的三个Kinect的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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