同时使用两个Kinect [英] Using Two Kinect at the same time

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

问题描述

您好


我想同时从两个Kinect设备获取图像流,但是有问题。 第二个Kinect的初始化失败。这是一个显示问题的简单代码:


 
// Bug_report.cpp:定义控制台应用程序的入口点。
//
#pragma一次

#include " stdafx.h"
#include " windows.h"

#include " MSR_NuiApi。 h"


int _tmain( int argc,_TCHAR * argv [])
{

printf("" Connecting to Kinetics ... \ n"< /跨度>);

HRESULT hr,hr0,hr1,hr_init_0,hr_init_1;
int no_kinetics;

hr = MSR_NUIGetDeviceCount(& no_kinetics);
printf("%d Kinetics found the\\\ n",no_kinetics);

if (no_kinetics!= 2){

printf("此测试需要两个动力学!中止... \ n");
return -1;
}

INuiInstance * kinect_0 = NULL;
hr_init_0 = MSR_NuiCreateInstanceByIndex(0,& kinect_0);

if (hr_init_0 == S_OK){

printf(" Created Kinetic instance 0,pointer addres:%p \ n" ,kinect_0);
}
else {

printf("创建Kinetic实例0 FAILED。\ n"");
}
hr0 = kinect_0-> NuiInitialize(NUI_INITIALIZE_FLAG_USES_SKELETON);

if (hr0 == S_OK){
printf(" ; Kinect 0的初始化成功\\ n");
}
else {
printf("动力学初始化0失败了!返回代码是%d \ n" ,( int )hr0);
// return -3;
}

printf(" \\\
" );
INuiInstance * kinect_1 = NULL;
hr_init_1 = MSR_NuiCreateInstanceByIndex(1,& kinect_1);
printf(" Created Kinetic instance 1,pointer addres:%p \ n" ,kinect_1);

hr1 = kinect_1-> NuiInitialize(NUI_INITIALIZE_FLAG_USES_SKELETON);

if (hr1 == S_OK){
printf(" ; Kinect 1的初始化成功\\ n");
}
else {
printf("动能初始化1失败了!返回代码是%d \ n" ,( int )hr1);
// return -3;
}

return 0;
}

解决方案

您好,您可以使用多个Kinect捕获 图像流同一时间。


但是,您的初始化是 第二个Kinect失败了,原因可能是 您的两个Kinect设备都连接在一个USB控制器中。 &NBSP; Kinect设备连接到同一USB主控制器时可能无法正常工作


使用多个Kinect开发应用程序时,请确保设备连接不同的USB控制器和 两者都插上外接电源。


只需在论坛帖子中查看答案,
http://social.msdn.microsoft.com/Forums/en- US / kinectsdk / thread / 58644472-25ce-4378-aeab-424307440616 /#da320604-885a-4cb0-9ad8-6ec187dec2b7


 


以下是使用多个kinect设备开发的示例应用程序


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


 


希望这会有所帮助!


干杯!


Abhijit


 


Hello

I would like to acquire image stream from two Kinect devices at the same time, however there is a problem.  Initialization of a second Kinect fails. Here is a simple code that shows the problem:

// Bug_report.cpp : Defines the entry point for the console application.
//
#pragma once

#include "stdafx.h"
#include "windows.h"

#include "MSR_NuiApi.h"


int _tmain(int argc, _TCHAR* argv[])
{
	
	printf("Connecting to Kinetics ...\n");

	HRESULT hr, hr0, hr1, hr_init_0, hr_init_1;
	int no_kinetics;

	hr = MSR_NUIGetDeviceCount(&no_kinetics);
	printf(" %d Kinetics found \n\n", no_kinetics);
	
	if (no_kinetics != 2) {
		
		printf ("Two kinetics are needed for this test! Aborting ...\n");
		return -1 ;
	}

	INuiInstance*  kinect_0=NULL;  
	hr_init_0 = MSR_NuiCreateInstanceByIndex(0, &kinect_0);
	
	if (hr_init_0 == S_OK) {
	
		printf("Created Kinetic instance 0, pointer addres:  %p \n",kinect_0);
	}
	else {

		printf("Creation of Kinetic instance 0 FAILED. \n");
	}
	hr0 = kinect_0->NuiInitialize(NUI_INITIALIZE_FLAG_USES_SKELETON);
	
	if (hr0 == S_OK) {	
		printf("Initialization of Kinect 0 was successful\n");
	}
	else {
		printf("Initialization of kinetic 0 failed ! Return code was %d\n",(int)hr0);
		//return -3;
	}
	
	printf("\n");
	INuiInstance*  kinect_1=NULL; 
	hr_init_1 = MSR_NuiCreateInstanceByIndex(1, &kinect_1);
	printf("Created Kinetic instance 1, pointer addres:  %p \n",kinect_1);
	
	hr1 = kinect_1->NuiInitialize(NUI_INITIALIZE_FLAG_USES_SKELETON); 
	
	if (hr1 == S_OK) {	
		printf("Initialization of Kinect 1 was successful\n");
	}
	else {
		printf("Initialization of kinetic 1 failed ! Return code was %d\n",(int)hr1);
		//return -3;
	}

	return 0;
}

解决方案

Hi, You can use multiple Kinect to capture  Image Stream Same time.

However, your initialization is  second Kinect is failing because the reason could be  both of your Kinect device connected in a single USB Controller.   Kinect devices might not work reliably when they are connected to the same USB host controller .

While developing application using multiple Kinect, make sure devices are connected with different USB Controller and  both are plugged in with external power.

Just Checkout the answer in one of the forum post, http://social.msdn.microsoft.com/Forums/en-US/kinectsdk/thread/58644472-25ce-4378-aeab-424307440616/#da320604-885a-4cb0-9ad8-6ec187dec2b7

 

Here is a sample application developed using multiple kinect device

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

 

Hope this will helps !

Cheers!

Abhijit

 


这篇关于同时使用两个Kinect的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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