在同一个应用中查看多个Kinect设备 [英] View Multiple Kinect Devices in the same app

查看:68
本文介绍了在同一个应用中查看多个Kinect设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我在Kinect SDK v1中有一些Kinect编程经验。


我在这里有4个kinects,我试着在同一时间同时使用SAME窗口。


我已经使用每个可执行文件的一个kinect搞乱了骨架和深度流,我将使用以下代码单独启动我的应用程序的4个实例:


               

  
  foreach(KinectSensor.KinectSensors中的var potentialSensor)
            {
                if(potentialSensor.Status == KinectStatus.Connected)
                {

                   试试
                    {
                        //尝试开始,如果我们不能使用它,请尝试另一个
                        potentialSensor.Start();                  
                        this.sensor = potentialSensor;
                       打破;
                    }
                    catch(System.IO.IOException)//由KinectSensorStart抛出()
                    {
                       继续;
                    }

                }
            }



但现在我想要查看同一个窗口中的所有kinects(可执行文件)。


我只发现了一个执行此操作的代码,但它在SDK的旧版本(测试版)中,我无法设法移植它。 


代码在这里,它太大了,不能放在这里。


http://abhijitjana.net/2011/09 / 23 / development-with-kinect-net-sdk-part-v-developing-application-using-multiple-kinect-devices /



任何帮助?


PS:USB总线没有问题,我买了usb控制器,我可以看到4个kinect探测器示例。


解决方案

您需要一组KinectSensor对象。现在你的代码只设置第一个传感器,然后打破循环。您需要修改多个传感器的帐户,因为this.sensor无效。另请注意,
如果有其他正在运行的应用程序,该传感器将不会出现在您的收藏中。

 this.sensorCollection = new List< KinectSensor> (); 

foreach(kinectSensor.KinectSensors中的var potentialSensor)
{
if(potentialSensor.Status == KinectStatus.Connected)
{
try
{
//尝试开始,如果我们不能使用它,请尝试另一个
potentialSensor.Start();
this.sensorCollection.Add(potentialSensor);
}
catch(System.IO.IOException)//由KinectSensorStart抛出()
{
continue;
}

}

如果需要更多代码,可以从SDK工具包中查看Kinect Explorer示例。


Hello, i have some experiencie with programming for Kinect in Kinect SDK v1 .

I have 4 kinects here and im trying to work with then at the same time in the SAME window.

I already messed with skeleton and depth streams using one kinect per executable, i would start 4 instances of my application separately, using the following code:

               

 
 foreach (var potentialSensor in KinectSensor.KinectSensors)
            {
                if (potentialSensor.Status == KinectStatus.Connected)
                {

                    try
                    {
                        // try to start, if we can't it is in use, try another one
                        potentialSensor.Start();                  
                        this.sensor = potentialSensor;
                        break;
                    }
                    catch (System.IO.IOException) // thrown by KinectSensorStart()
                    {
                        continue;
                    }

                }
            }

But now i want to view all kinects in the same window (executable).

I ve only found one code that does this, but its in a old version (beta) of the SDK, and i cant manage to port it. 

The code is here, its too big to put here.

http://abhijitjana.net/2011/09/23/development-with-kinect-net-sdk-part-v-developing-application-using-multiple-kinect-devices/

Any help?

PS: I have no problem with USB bus, i ve bought usb controllers for that, and i can see 4 kinects with the kinect explorer sample.

解决方案

You need a collection of KinectSensor objects. Right now your code only sets the first sensor only and then breaks the loop. You need to modify what you have to account for multiple sensors though, since this.sensor will not be valid. Also take note, if there are other application that are running that sensor will not appear in your collection.

this.sensorCollection = new List<KinectSensor>();

foreach (var potentialSensor in KinectSensor.KinectSensors)
            {
                if (potentialSensor.Status == KinectStatus.Connected)
                {
                    try
                    {
                        // try to start, if we can't it is in use, try another one
                        potentialSensor.Start();                  
                        this.sensorCollection.Add(potentialSensor);
                    }
                    catch (System.IO.IOException) // thrown by KinectSensorStart()
                    {
                        continue;
                    }

                }

You can review the Kinect Explorer sample from the SDK toolkit if you need more code.


这篇关于在同一个应用中查看多个Kinect设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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