Multiples Kinects (avin2 SensorKinect) in Windows

707 views
Skip to first unread message

david

unread,
Feb 21, 2011, 3:47:49 AM2/21/11
to openn...@googlegroups.com
Hi all,

I am trying to use two kinects in a windows, but I have not succeed ... I will explain the different steps and tests I have done in testing it so that if anybody has encountered similar problems/doubts and have solved them, I would be very thankful if he/she could help me in this task... I have looked at the example application, ROS-independent, suggested by Suat Gedikli, and I would like to simplify it...

- First of all, when initializing the context, I have tried both using XML file configuration and without any configuration file. I don't know, which would be the best way to do that when using two kinects. When I tried to use the XML file, I modified it by adding two additional Nodes (one additional image and another for the depth) inside production nodes.

- After this initialization, I enumerate all devices, depth nodes and image nodes. The enumeration I have obtained is similar as the one obtained of grrrwaaa in the topic ( OpenNI and multiple kinects (avin2 SensorKinect), Ubuntu 10.10 This enumeration, as pointed out by grrrwaaa looks quite strange... 

- After that I create the production trees:

status = _g_context.CreateProductionTree (const_cast<xn::NodeInfo&>(depth_info[0]));

status = _g_context.CreateProductionTree (const_cast<xn::NodeInfo&>(image_info[0]));

status = _g_context.CreateProductionTree (const_cast<xn::NodeInfo&>(depth_info[1]));

status = _g_context.CreateProductionTree (const_cast<xn::NodeInfo&>(image_info[1]));


- Then I get production nodes instances: 


status = depth_info[0].GetInstance (_g_depth);

status = image_info[0].GetInstance (_g_image);

status = depth_info[1].GetInstance (_g_depth2);

status = image_info[1].GetInstance (_g_image2);


- Afterwards I do:


_g_depth.GetMetaData(_g_depthMD);

_g_image.GetMetaData(_g_imageMD);

_g_depth2.GetMetaData(_g_depthMD2);

_g_image2.GetMetaData(_g_imageMD2);


- Finally:


_g_context.StartGeneratingAll();


In the update function, if I set _g_context.WaitAndUpdateAll(),it keeps waiting for data... it seems that the kinect is not sending data properly...

I know that I am probably missing something with the code above that I should take into account... If anybody has solved this issue in connecting two kinects in windows, I would appreciate any suggestion so that I could move forward... 

Thank you,

david.

andrissh

unread,
Feb 21, 2011, 5:27:25 AM2/21/11
to OpenNI
This probably will not solve your problem, but just a hint:
As I know, first you should start generating all, update, and only
after that you can get meta data.

I am also trying to get 2 kinects working together. But just started.

andrissh

unread,
Feb 21, 2011, 6:25:24 AM2/21/11
to OpenNI

magge

unread,
Feb 21, 2011, 7:35:25 AM2/21/11
to OpenNI
Hey there,

I'm trying to use multiple kinects as well and I realized, that the
context.waitXYZ function appear to not work properly with multiple
kinects. As well as the context.startGeneratingAll(). It only starts
generating with 1 device and when trying to update I get timeouts all
over the place. What solved the problem for me was to call
StartGenerating(); for each generator seperately and also call
WaitAndUpdate(); for each generator. I know it's not as comfortable as
updating all generators at once, but I have not found a way around it
yet. Give it a try.

Andris Kővári

unread,
Feb 21, 2011, 7:56:25 AM2/21/11
to openn...@googlegroups.com
Thanks, magge, but it doesn't seem to work.
First I also tried with context.StartGeneratingAll(), and context.WaitAndUpdateAll(), but the output was the same device giving me the output twice. (I get the metadata and save the frame as an image to the harddisk, this is how I check the outcome). The point is, I got a result, but it was wrong.

I also tried now as you said, the code is below. but it doesn't even write an error code to me, it seems that it just gives a timeout. What else should I do besides:
      status=genImage0.StartGenerating();
       status=genDepth1.StartGenerating();
       status=genDepth0.StartGenerating();
       status=genImage1.StartGenerating();
       if (status != XN_STATUS_OK)
               printf("Startgenerating failed: %s\n", xnGetStatusString(status));
       else printf("all started generating\n");
       status=genDepth0.WaitAndUpdateData();
       status=genDepth1.WaitAndUpdateData();
       status=genImage0.WaitAndUpdateData();
       status=genImage1.WaitAndUpdateData();

       if (status != XN_STATUS_OK)
               printf("UpdateData failed: %s\n", xnGetStatusString(status));
       else printf("updated generators\n");

should I stop generating?

thanks,
andrissh

magge

unread,
Feb 21, 2011, 8:13:36 AM2/21/11
to OpenNI
Hey,

now I see that you're using depth and image generators for both
devices. This requires you to have both devices connected on seperate
usb busses. Otherwise the required bandwidth of both devices is just
too much for one usb bus to handle. I had this problem just yesterday.
Make sure, that you have the two devices on seperate busses. I had to
install a seperate pci usb controller to achieve that. Instead of
that, you could try to only retrieve the depth or only the image
information from both devices. Either way, this will work over a
single usb bus and you would know if your code is generally working
and retrieving the data correctly.

Suat Gedikli

unread,
Feb 21, 2011, 4:56:30 PM2/21/11
to openn...@googlegroups.com
Hello together,

an example application for running multiple kinects (under linux) can be
found in
"https://github.com/ros-pkg-git/ni/tree/rewrite/openni_camera"
It is a ROS package, but the example application works ROS independent.

Cheers,
Suat Gedikli

david

unread,
Feb 21, 2011, 5:23:01 PM2/21/11
to openn...@googlegroups.com
Hi,

Andrissh, I tried to remove these commands from the init function and before starting generating as you suggest:

    _g_depth.GetMetaData(_g_depthMD);
    _g_image.GetMetaData(_g_imageMD);

but the application crashes if I do that...

I tried what Magge suggest, that is calling StartGenerating() for each generator and WaitAndUpdate() for each one, as well. Now the timout problem is solved and seems that at least I can get depth data from the devices... but not the colour.. I get a black image when I try to display the colour image..

One of the problem that may cause this behaviour is that I do not initialize the context correctly:

- I tried to initialize with an XML file adding two additional nodes, but it crashes:

    <ProductionNodes>
        <Node type="Image" name="Image1">
            <Configuration>
                <MapOutputMode xRes="640" yRes="480" FPS="30"/>
                <Mirror on="true"/>
            </Configuration>
        </Node>
        <Node type="Depth" name="Depth1">
            <Configuration>
                <MapOutputMode xRes="640" yRes="480" FPS="30"/>
                <Mirror on="true"/>
            </Configuration>
        </Node>
        <Node type="Image" name="Image2">
            <Configuration>
                <MapOutputMode xRes="640" yRes="480" FPS="30"/>
                <Mirror on="true"/>
            </Configuration>
        </Node>
        <Node type="Depth" name="Depth2">
            <Configuration>
                <MapOutputMode xRes="640" yRes="480" FPS="30"/>
                <Mirror on="true"/>
            </Configuration>
        </Node>
    </ProductionNodes>

I tried also wihtout an XML file and configure it manually:

XnMapOutputMode outputMode;
    outputMode.nXRes = 640;
    outputMode.nXRes = 480;
    outputMode.nFPS = 30;

_g_depth.SetMapOutputMode(outputMode);
    _g_image.SetMapOutputMode(outputMode);
    _g_depth2.SetMapOutputMode(outputMode);
    _g_image2.SetMapOutputMode(outputMode);

but when I print the resolution it says is still 320x240... I don't know why the resolution is not changed..

Another thing is that the performance has decreased dramatically when openning the two kinects... probably it is needed to create a thread per kinect like in the example application of Suat Gedikli. Does anybody succeed in porting this example application to windows ?

Thank you,

Andris Kővári

unread,
Feb 22, 2011, 4:32:01 AM2/22/11
to openn...@googlegroups.com
Hi, David and all,

I did not look at the examples from the ROS pkg, because I managed to get it running with a helpful hand of my tutor. You thought right about the initialisation, as you will see, I also initialized without xml. This is the only logic way for me. Also, I started generating them separately, as magge said. Basically I did this, and it finally worked for me:

status = context.Init();
status = context.EnumerateProductionTrees(cNodeType, NULL,image_node_info_list, NULL);
int i = 0;
           for (xn::NodeInfoList::Iterator nodeIt =image_node_info_list.Begin(); nodeIt != image_node_info_list.End(); ++nodeIt, ++i) {
                xn::NodeInfo info = *nodeIt;
                const XnProductionNodeDescription& description = info.GetDescription();
                printf("image: vendor %s name %s, instance %s\n",description.strVendor, description.strName, info.GetInstanceName());


                status = context.CreateProductionTree (info);
                status = info.GetInstance (genImage);
                XnMapOutputMode mode;
                mode.nXRes = 640;
                mode.nYRes = 480;
                mode.nFPS = 30;
                genImage.SetMapOutputMode(mode);
                status=genImage.StartGenerating();
                status=genImage.WaitAndUpdateData();
                genImage.GetMetaData(imMD);
                status=genImage.StopGenerating();
                char filename[1024];
                sprintf(filename, "test_i%d.png", i);
                Kovari::Kinect::Save(imMD, filename);
           }

Here the genImage can be declared as Image-, Depth- or IR- generator, it works for all of them. I didn't try to mix them however. I also didn't try to display the image continuously with opengl, as you see I only saved a capture in png to the harddisk with my own little saving function.
This one works also with 3 kinects, I tried it! ;) I am in linux though, and also a newbie.
It remains to see how they work in mixed mode, maybe I will have to use threads, I don't know yet.
thanks for the help, everyone!

david

unread,
Feb 22, 2011, 10:45:02 PM2/22/11
to openn...@googlegroups.com
Hi Andrissh,

thanks for your help. I will try to do it separetely as you have done, that is, without mixing the Image, Depth or IR generators. Let's see if I can make it work... I still don't understand why when I tried the SetMapOutputMode, this function did not change the resolution of the images...

I will let you know when I try it if I make it work and then I will try again mixing the generators... I don't know when I will be able to test it since the university where I have the kinects is closed because of the earthquake recently hit the city... hope to test it soon and make it work soon, as well.

thanks !

oppilif

unread,
Feb 23, 2011, 5:46:29 AM2/23/11
to OpenNI
Hi all,

I managed to run 2 Kinects on Win7 using the same method of Andris
(Kinects on 2 different buses, initializing without XML file).
Instead, I found it impossible to initialize 2 Kinects by a XML file,
whatever options I put in there.

@david: I think that SetMapOutputMode does not *immediately* changes
the resolution values in MetaData. I suppose you have to call
StartGenerating() and/or WaitAndUpdateData() first, then the MetaData
will display the correct value.

Andris Kővári

unread,
Feb 23, 2011, 8:04:09 AM2/23/11
to openn...@googlegroups.com

HI,
David, what earthquake? where do you study?
Yesterday I tried the mixing. I tried to make the 2 kinects save Rgb, depth and IR images in parallel. I found that it is not working. This is what happens:
creating image nodes successful
creating depth nodes successful
creating ir nodes successful (i.e. create production tree command)
creating im node instances successful
creating de node instances successful
creating ir node instances successful (i.e. GetInstance)
starting im generation successful (i.e. StartGenerating())
starting de generation successful
starting ir generation failed: Bad Parameter sent to the device!

I found out, that rgb and IR cannot generate in parallel. this is sad, I don't understand, why is this so, and why can a sensor not be configured to work with both rgb and IR at the same time.

The other combinations (depth+IR  and depth+rgb) worked fine together in parallel.

If someone understands how these sensors are working and why they cannot do this in parallel, please explain!
Any hints about  how could I resolve this problem in software are welcome.
would separate contexts resolve this? maybe...have to try out.

cheers

jbolton

unread,
Mar 9, 2011, 8:57:29 PM3/9/11
to OpenNI
I was wondering if anyone had any luck implementing this using the C#
wrapper. I've been running into an access violation exception when
calling createProductionTree with the node info from the enumerator.

Thanks,
John

david

unread,
Mar 13, 2011, 8:35:14 PM3/13/11
to openn...@googlegroups.com
Hi all,
 
I have finally managed to make the two kinects working and getting both depth and rgb information of two kinects following the same methods of Andris :). Thanks all for your help.
 
I was wondering if there is any function to get the serial number or anything from the kinects so that I can differenciate the devices. When printing the information of the devices, I can't print anything that differenciate the two kinects (for example, serial number).
 
The XnProductionNodeDescription attributes (strVendor, strName) are the same for both kinects...
 
Thanks,
 
david

andrissh

unread,
Mar 14, 2011, 5:58:15 AM3/14/11
to OpenNI
When I initialise a context with 2 depth generators, lets say
depthGen0 and depthGen1, and write the following code:
cout<<depthGen0.GetName()<<" "<<depthGen1.GetName()<<endl;

it gives:
Depth1 Depth2

I guess this is a way to differentiate between devices. it is the same
for rgb and ir.

andris

david

unread,
Mar 14, 2011, 6:50:42 AM3/14/11
to openn...@googlegroups.com
but the problem with that is that maybe the same kinect in different executions (or when rebooting the system) will have different names... i was trying to find a way that in all executions the same kinect will have the same name or identification... maybe the only way to do that is to get the serial number... but maybe there are other ways... i dont know if there is a command in openni that can do that...
 
david. 

Naëm Baron

unread,
Mar 15, 2011, 4:45:30 AM3/15/11
to OpenNI
Hello world,

I tried to find a way to do that by digging in the OpenNI sources.
I think we should modify the XnProductionNodeDescription and the
prodnode enumerator to provide the device serial number,
but all the "multi-platform" packaging is obsfuscing the code...
OpenNI should be more "clean" to be really open-source (but it's
another subject).
Message has been deleted

david

unread,
Mar 15, 2011, 6:11:33 AM3/15/11
to openn...@googlegroups.com
I think that the function GetCreationInfo() might be useful to identify the kinects.
 
If printing directly what this function returns, you get something like:
 
 
I don't know what this number that is in between '#' means (a00362....102a), but I have observed that it changes given two conected kinects. Does anybody knows what it means and if it can be used to identify a kinect ?
 
david

janboehm

unread,
Mar 15, 2011, 11:28:07 AM3/15/11
to OpenNI
very interesting, david. How are you calling the function?

If I do

DepthGenerator depth;
...
const XnChar* CreationInfoStr = depth.GetInfo().GetCreationInfo();

I get 0 (empty string?).

jan

david

unread,
Mar 15, 2011, 3:18:52 PM3/15/11
to openn...@googlegroups.com
To get get the information you have to call the GetCreationInfo when the node type is DEVICE. When the node type is IMAGE or DEPTH I also get an empty string...
 
david.

david

unread,
Mar 15, 2011, 5:19:10 PM3/15/11
to openn...@googlegroups.com
I have tried to get the information using the following code:
 
unsigned short vendor_id;
unsigned short product_id;
unsigned char bus;
unsigned char address;
sscanf(info.GetCreationInfo(), "%hx/%hx@%hhu/%hhu", &vendor_id, %product_id, &bus, &address);
 
however, this is not enough to identify a certain kinect...

Naëm Baron

unread,
Mar 17, 2011, 4:55:24 AM3/17/11
to OpenNI
Hello world,

\\?\usb#vid_045e&pid_02ae#a00362....102a#{.(some more numbers)..}

The last part "a00362....102a" is the instance identification number,
it is the unique for each kinect (or USB device in general).
So If we can get that information it will be in a nutshell to
diferenciate our kinects.

janboehm

unread,
Mar 17, 2011, 10:56:44 AM3/17/11
to OpenNI

Hi Naem!
Would you know if that number is fixed for the lifetime of a device or
just for the time it is plugged in? In other words, when I plug it out
and plug it in again, would it have the same number?

Cheers,
jan

Naëm Baron

unread,
Mar 17, 2011, 1:12:02 PM3/17/11
to OpenNI
I don't know and I not have my kinect for the moment.
But that number is called "INSTANCE identification", it looks like it
will change each time you plug the device.
Not sure about that.

david

unread,
Mar 17, 2011, 4:12:08 PM3/17/11
to openn...@googlegroups.com
Hi, I have seen that this part "a00362....102a" can be used as a identification number of the kinect as long as you always plug the kinect at the same usb port... At the moment I am doing this as a temporary soloution for kinect identification..

Matthew Yee

unread,
Mar 17, 2011, 7:44:51 PM3/17/11
to openn...@googlegroups.com
Just wondering though that since you're trying to use multiple kinect for one computer would use a spliter for all of them (possible saturation of usb) or separate transceiver? 

--
You received this message because you are subscribed to the Google Groups "OpenNI" group.
To post to this group, send email to openn...@googlegroups.com.
To unsubscribe from this group, send email to openni-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/openni-dev?hl=en.

Naëm Baron

unread,
Mar 18, 2011, 4:46:50 AM3/18/11
to OpenNI
Could you share your complete code to use multiple kinect ?
Best, if you can add an entry to the wiki : http://wiki.openni.org/mediawiki/index.php/Main_Page
Because we (here on google groups) talk about and fix a lot of thing
but it's a maze to found an answer in all the mails,
it will be nice if can feed the wiki :)

Felix

unread,
Mar 18, 2011, 5:46:59 AM3/18/11
to OpenNI
Well, but you can only identify a Kinect if you enumerate the
production trees of the node type DEVICE. I have seen that this
doesn't fit to the other node types: I have two Kinects connected on
Windows 7 and if I enumerate IR nodes or DEPTH nodes, I don't get the
image of the same Kinect at the same index. Even more strange: if I
first enumerate the IR nodes and after that the DEPTH nodes I find 2
IR nodes, but 4 DEPTH nodes without being able to predict which node
belongs to which Kinect. And at last: if I additionally enumerate USER
nodes I get 6 different nodes, but all refer to the same Kinect.
Maybe the support of multiple sensors isn't really working, yet. Or am
I doing something wrong?

david

unread,
Mar 18, 2011, 6:15:02 AM3/18/11
to openn...@googlegroups.com
The code I have written it seems to work well with multiple kinects (at least with two). Below is the code I have used... Test it and let me know if it works with you as well. 

Context _g_context;

std::vector<DepthGenerator*> _g_depth;
std::vector<ImageGenerator*> _g_image;
std::vector<DepthMetaData*> _g_depthMD;
std::vector<ImageMetaData*> _g_imageMD;

int _nKinects;

int kinectManager::init() {

XnStatus status;
status = _g_context.Init();

static xn::NodeInfoList node_info_list;
static xn::NodeInfoList depth_nodes;
static xn::NodeInfoList image_nodes;

status = _g_context.EnumerateProductionTrees (XN_NODE_TYPE_DEVICE, NULL, node_info_list);

if (status != XN_STATUS_OK && node_info_list.Begin () != node_info_list.End ()) { 
printf ("Enumerating devices failed. Reason: %s", xnGetStatusString (status)); 
return -1;
}
else if (node_info_list.Begin () == node_info_list.End ()) {
printf("No devices found.\n");
return -1;
}

for (xn::NodeInfoList::Iterator nodeIt = node_info_list.Begin (); nodeIt != node_info_list.End (); ++nodeIt) {
_nKinects++;
}

status = _g_context.EnumerateProductionTrees (XN_NODE_TYPE_IMAGE, NULL, image_nodes, NULL);

if (status != XN_STATUS_OK && image_nodes.Begin () != image_nodes.End ()) { 
printf ("Enumerating devices failed. Reason: %s", xnGetStatusString (status)); 
return -1;
}
else if (image_nodes.Begin () == image_nodes.End ()) {
printf("No devices found.\n");
return -1;
}

status = _g_context.EnumerateProductionTrees (XN_NODE_TYPE_DEPTH, NULL, depth_nodes, NULL);

if (status != XN_STATUS_OK && depth_nodes.Begin () != depth_nodes.End ()) { 
printf ("Enumerating devices failed. Reason: %s", xnGetStatusString (status)); 
return -1;
}
else if (depth_nodes.Begin () == depth_nodes.End ()) {
printf("No devices found.\n");
return -1;
}


int i = 0;
for (xn::NodeInfoList::Iterator nodeIt =image_nodes.Begin(); nodeIt != image_nodes.End(); ++nodeIt, i++) {
xn::NodeInfo info = *nodeIt;
const XnProductionNodeDescription& description = info.GetDescription();
printf("image: vendor %s name %s, instance %s\n",description.strVendor, description.strName, info.GetInstanceName());

XnMapOutputMode mode;
mode.nXRes = 640;
mode.nYRes = 480;
mode.nFPS = 30;

status = _g_context.CreateProductionTree (info);

ImageGenerator* g_image = new ImageGenerator();
ImageMetaData* g_imageMD = new ImageMetaData();

status = info.GetInstance (*g_image);

g_image->SetMapOutputMode(mode);
g_image->GetMetaData(*g_imageMD);
g_image->StartGenerating();

_g_image.push_back(g_image);
_g_imageMD.push_back(g_imageMD);
}


i = 0;
for (xn::NodeInfoList::Iterator nodeIt =depth_nodes.Begin(); nodeIt != depth_nodes.End(); ++nodeIt, i++) {
xn::NodeInfo info = *nodeIt;
const XnProductionNodeDescription& description = info.GetDescription();
printf("image: vendor %s name %s, instance %s\n",description.strVendor, description.strName, info.GetInstanceName());

XnMapOutputMode mode;
mode.nXRes = 640;
mode.nYRes = 480;
mode.nFPS = 30;

status = _g_context.CreateProductionTree (info);

DepthGenerator* g_depth = new DepthGenerator();
DepthMetaData* g_depthMD = new DepthMetaData();

status = info.GetInstance (*g_depth);

g_depth->SetMapOutputMode(mode);
g_depth->GetMetaData(*g_depthMD);
g_depth->StartGenerating();

_g_depth.push_back(g_depth);
_g_depthMD.push_back(g_depthMD);
}

for (int i = 0; i < _nKinects; i++) {
_g_image[i]->GetMirrorCap().SetMirror(false);
_g_depth[i]->GetAlternativeViewPointCap().SetViewPoint(*_g_image[i]);
_g_depth[i]->GetMirrorCap().SetMirror(false);
}
 
status =_g_context.StartGeneratingAll();
return 1;
}

void kinectManager::update() {
XnStatus status = XN_STATUS_OK;

status = _g_context.WaitAndUpdateAll();

if (status != XN_STATUS_OK) {
printf("Read failed: %s\n", xnGetStatusString(status));
return;
}

for (int i = 0; i<_nKinects; i++) {

_g_image[i]->GetMetaData(*_g_imageMD[i]);
_g_depth[i]->GetMetaData(*_g_depthMD[i]);

}
}

Felix

unread,
Mar 18, 2011, 8:32:32 AM3/18/11
to OpenNI
Thank you for your code!

Basically, my code was the same, but the important difference is, that
you first call EnumerateProductionTrees() for all node types and only
after that you iterate over them and call CreateProductionTree () and
GetInstance().

I always called EnumerateProductionTrees(), CreateProductionTree() and
GetInstance() for one node type and after that for the next node type
and so on, which resulted in the error mentioned above.

Only problem that is left: Now I get two user generators, but they
still refer to the same kinect (in other words: work on the depth
image of the same kinect).

david

unread,
Mar 18, 2011, 4:20:19 PM3/18/11
to openn...@googlegroups.com
Felix, have you checked that the index of the depth vector generator is the same as the index of the image vector generator ? Try also connecting one kinect to a different usb port.
 
Try to check if  kinect 0 has the index 0 in depth vector generator and an index 1 to image vector generator... that is, the vector indexs for each kinect in depth and image generators dont match. Is this the case ?

Felix

unread,
Mar 21, 2011, 7:02:35 AM3/21/11
to OpenNI
I have no access to my Kinects this Week, but as I remember, with my
original code, the indeces didn't match, but with your code they did.
But the problem left only is related to the user generators, as both
indices track the users in front of the same Kinect.
Changing the USB ports or hubs didn't make difference.

janboehm

unread,
Mar 21, 2011, 1:52:32 PM3/21/11
to OpenNI
Thank you for the code david!
It runs without errors(at least it seems so to me). however for two
connected PrimeSensors it gives me

image: vendor PrimeSense name SensorV2, instance
image: vendor PrimeSense name SensorV2, instance
depth: vendor PrimeSense name SensorV2, instance
depth: vendor PrimeSense name SensorV2, instance

So the instance is always an empty name. Is that the case for you as
well?
(I changed the 2nd set of printfs to 'depth').

Cheers,
jan

david

unread,
Mar 21, 2011, 3:00:30 PM3/21/11
to openn...@googlegroups.com
@janboehm. Yes , when printing the information I got the same results. To try to identify the kinects i have to look at the GetCreationInfo() string when looping for the node info list after enumerating the device (for the image and depth enumeration does not work). And to achieve the same identification number I have to connect the same kinect at the same port usb... Until now it worked for me... I know it is not the best solution but I still have not found anything better ...

@Felix. i havent tried the user generators... I will try it and see what happens...

Cheers,

David.

blueskin

unread,
Mar 22, 2011, 4:34:56 PM3/22/11
to OpenNI
Thank you very much David.
I was trying to use ROS code for launching multiple kinects but had
some problems. Your code simplifies it.

Best,
-CV

MDRAM

unread,
Mar 25, 2011, 1:40:10 PM3/25/11
to OpenNI
Hi all, i've been reading this and other threads, is there a shared
sample to access and enumerate kinect devices ? can it works on .Net
as well ?

MDRAM

unread,
Mar 25, 2011, 10:05:37 PM3/25/11
to OpenNI
I've tried, as Jbolton, to use the C# wrapper, can't create a
ProductionNode with device detected, anybody tried it too ?

On 25 Mar, 18:40, MDRAM <mi...@bcaa.it> wrote:
> Hi all, i've been reading this and other threads, is there a shared
> sample to access and enumeratekinectdevices ? can it works on .Net
> as well ?
>
> On 17 Mar, 21:12, david <davidaltim...@gmail.com> wrote:
>
> > Hi, I have seen that this part "a00362....102a" can be used as a
> > identification number of thekinectas long as you always plug thekinectat

Marius

unread,
Mar 26, 2011, 4:41:49 PM3/26/11
to OpenNI
I also tried. I think the issue has something to do with managed
versus unmanaged code.
May have to declare some sections of the c# code as unsafe. Not sure.
It would be nice if the person that made the c# wrapper could explain
how to do it with an example.

Marius

MDRAM

unread,
Mar 26, 2011, 6:12:54 PM3/26/11
to OpenNI
Actually i dont have 2 kinect here to make some tests, anyway, look
like to have a ProductionNode u have to use these method before :

this.context.StartGeneratingAll();
this.context.WaitAndUpdateAll();

that is actually using an empty context, on monday i will make some
test and try to get what I need :D

p.s.: about the wrapper author, will be just enough to be pointed by
admin to a direction, cos multiple support really enanche the
chance :P

MDRAM

unread,
Mar 27, 2011, 9:53:08 PM3/27/11
to OpenNI
It was a random case, looks like everything we want to do with
deviceNode, catch a nullReferenceException


On 27 Mar, 00:12, MDRAM <mi...@bcaa.it> wrote:
> Actually i dont have 2kinecthere to make some tests, anyway, look
> like to have a ProductionNode u have to use these method before :
>
>  this.context.StartGeneratingAll();
>  this.context.WaitAndUpdateAll();
>
> that is actually using an empty context, on monday i will make some
> test and try to get what I need :D
>
> p.s.: about the wrapper author, will be just enough to be pointed by
> admin to a direction, cosmultiplesupport really enanche the

MDRAM

unread,
Mar 28, 2011, 8:58:47 AM3/28/11
to OpenNI
After enumerating devices , using a device as NodeInfo, let's call it
"node", i do this :



and i got this error, what is wrong with it ? :

ProductionNode pd = context.CreateProductionTree(node);

failed to create nodeSystem.AccessViolationException: Attempted to
read or write protected memory. This is often an indication that other
memory is corrupt.
at xn.OpenNIImporter.xnNodeInfoGetDescription(IntPtr pNodeInfo)
at xn.Context.CreateProductionTree(NodeInfo nodeInfo)

blueskin

unread,
Mar 28, 2011, 10:53:59 AM3/28/11
to OpenNI
Hey David,

I see that when I connect multiple Kinects and obtain info using
GetCreationInfo(),
Ex:
vendorId="045e" productId="02ae" serialNum="serialnumber007"
somenum={c3b5f022-5a42-1980-1909-ea72095601b1}
The serial numbers of-course are different but the last id (not sure
if that is bus ID) is also the same
Does this mean they are connected on the same bus??

--CV

On Mar 21, 2:00 pm, david <davidaltim...@gmail.com> wrote:

david

unread,
Mar 29, 2011, 6:10:37 AM3/29/11
to openn...@googlegroups.com, blueskin
hi blueskin,

yes, the last id obteined for both kinects is the same ... I am using a laptop and I connect the two kinects to the only two usb ports that it has... when printing the bus information, i get the same id for both kinects...

david

unread,
Mar 29, 2011, 6:17:35 AM3/29/11
to openn...@googlegroups.com, Felix
Felix, have you finally managed to run a user generator for each kinect ?? I would like to try that tomorrow and wondering if you finally managed to do so... I am also wondering if it would be possible to merge the information of both kinects and running a user generator for these merged information... anyone tried that ?

thanks,

Michael Kuzmin

unread,
Mar 29, 2011, 6:40:55 AM3/29/11
to OpenNI
Hi guys,

when I try to connect two Kinects to my USB ports, one of those two
Kinect Cameras get an explanation mark in the hardware setup of
windows. Someone wrote that each Kinect has to be connected to a
different USB root hub - is that true? In my hardware settings, there
are 5 USB root hubs listed - does that mean, that I can connect max. 5
Kinects? I tried sveral USB ports, but with no success :( Everytime
one of the Kinects has an yellow explanation mark...

One thing to the identification of several Kinects: Did you tried to
use the CL NUI driver for the motor and audio? There is a function, to
get the serial nuber. Didn't tried it yet, because I can't get them to
work, but maybe that works for you ;)

MDRAM

unread,
Mar 29, 2011, 8:57:28 AM3/29/11
to OpenNI
Im a little bit sad noone, tried to use the .net wrapper, anyway ,
what i wanted using 2 kinects was just the depth map and rgb map, i
manged it using CLNUI, kinda easy to do, using hardware serials,
however is kust to get some images.

If i dotn remember wrong there is somebody who was playing with this
to use CLNUI featured (serial, motor, accelerometer and so on ), with
OPENNi, cant figure out how to use both drivers together.

Anyway at this point i just expect an update of OPENNI wrapper for
the .net issues, or, at least, microsoft SDK on june , or asus Xtion.

I was pretty surprised just a couple guys talked about multiple
support on .net :)


On 29 Mar, 12:40, Michael Kuzmin <email.kuz...@googlemail.com> wrote:
> Hi guys,
>
> when I try to connect two Kinects to my USB ports, one of those twoKinectCameras get an explanation mark in the hardware setup of
> windows. Someone wrote that eachKinecthas to be connected to a

MichaelK

unread,
Mar 29, 2011, 9:16:48 AM3/29/11
to OpenNI
I'm also looking forward to use C# for my project ;)
And I got both drivers running together!

Simply install OpenNI and after that CL NUI. Then all three components
(audio, motor, camera) should be managed by CL NUI.
Now just go to your hardware configuration and delete the driver for
the NUI Camera. When you have done that, the OpenNI driver should be
found by your OS.
If your OS installs the NUI driver again, just go to your CL NUI
installation dir and rename the "driver" folder, so it can't find it
again ;)

Here you see, how it should look like: http://i.imgur.com/sa8OH.png

Then you can use the CLNUIdevice dll to control the motor, the led and
to get the serial ;)

Felix

unread,
Mar 29, 2011, 2:02:37 PM3/29/11
to OpenNI
No, I still haven't succeeded in running a user generator for each
kinect :-(
But I would also be interested in merging the information of both
kinects for improving the user tracking by avoiding occlusions.

I already tested how the IR emitter of one kinect influences the other
one. I found out that you should not set them up directly facing each
other as that considerably disturbs their IR image (and depth image).
But if you place them in a way that the emitter of one kinect isn't in
the field of view of the other, you nearly get no distortion,
regardless of the fact that the tracked scene is projected with IR
dots of both emitters.

MDRAM

unread,
Mar 29, 2011, 2:42:08 PM3/29/11
to OpenNI
thanks for trick info :D

blueskin

unread,
Mar 29, 2011, 3:01:04 PM3/29/11
to OpenNI
Hello Michael,

It is possible that all your USBs are on the same bus. I had the same
issue so I downloaded USBlyzer and found that I have different
controllers i.e. Intel and NEC so I connected my kinects to these
different ones and they work perfectly.

-CV

On Mar 29, 5:40 am, Michael Kuzmin <email.kuz...@googlemail.com>
wrote:

david

unread,
Mar 29, 2011, 9:38:20 PM3/29/11
to openn...@googlegroups.com
Felix, I have looked at the user generator class and I still haven't seen any function that relates a certain user generator with a depth generator... I don't know which data user generator takes into account to do the analysis... I expected to find a method in user generator such as 'userGenerator.SetData(...)'... I was wondering how you have tried to link each kinect with a different user generator...

MichaelK

unread,
Mar 31, 2011, 6:38:50 AM3/31/11
to OpenNI
Hi,

I installed USBlyzer to check my computer config. Here is a
screenshot: http://i.imgur.com/0LvpE.jpg
It looks, like I have 4 root hubs - but whereever I plug the kinect
in, it is listed in the last one, containing 6 USB ports.
I'll buy a pci usb controller and plug the second kinect into this
device.
Does anyone know a PCI USB controller with more than one root hub, so
that I can plug in more than 2 kinects?

For example, I want to use 4 Kinects... Then I don't want to use 3 PCI
USB controller, but only one which can handle all the kinects.
Or maybe a USB3.0 controller can handle alle the bandwidth? Does
someone had experience with USB 3.0 and two Kinects?

Thanks in advice :)

On 29 Mrz., 21:01, blueskin <blueskin....@gmail.com> wrote:
> Hello Michael,
>
> It is possible that all your USBs are on the same bus. I had the same
> issue so I downloaded USBlyzer and found that I have different
> controllers i.e. Intel and NEC so I connected mykinectsto these
> different ones and they work perfectly.
>
> -CV
>
> On Mar 29, 5:40 am, Michael Kuzmin <email.kuz...@googlemail.com>
> wrote:
>
>
>
>
>
>
>
> > Hi guys,
>
> > when I try to connect twoKinectsto my USB ports, one of those two
> > Kinect Cameras get an explanation mark in the hardware setup of
> > windows. Someone wrote that each Kinect has to be connected to a
> > different USB root hub - is that true? In my hardware settings, there
> > are 5 USB root hubs listed - does that mean, that I can connect max. 5
> >Kinects? I tried sveral USB ports, but with no success :( Everytime
> > one of theKinectshas an yellow explanation mark...
>
> > One thing to the identification of severalKinects: Did you tried to
> > use the CL NUI driver for the motor and audio? There is a function, to
> > get the serial nuber. Didn't tried it yet, because I can't get them to
> > work, but maybe that works for you ;)
>
> > On Mar 29, 12:10 pm, david <davidaltim...@gmail.com> wrote:
>
> > > hi blueskin,
>
> > > yes, the last id obteined for bothkinectsis the same ... I am using a
> > > laptop and I connect the twokinectsto the only two usb ports that it

david

unread,
Apr 4, 2011, 9:53:20 PM4/4/11
to openn...@googlegroups.com
Felix, I have tried to create two user generators, each one of each kinect, but i have got the same problem you mentioned .. that both user generators, in order to do the tracking, take information from the same kinect... I have created different contexts, different callbacks funcions for each user generator, but still, the tracking come from the same kinect... I dont know if you have solved the problem or if you have an idea on how to do so... I have created a new topic in OpenNI group to see if someone knows how to solve it...

Actually, I still don't know how the library feeds data into the User Generator in order to do the processing, it seems that it is not explicity and that makes it not flexible ... It seems to me that is in

xn::SceneMetaData sceneMD;
 g_UserGenerator.GetUserPixels(0, sceneMD);

But, I havent seen anywhere any instructions to put your own data...

Cheers,

MichaelK

unread,
Apr 5, 2011, 8:54:01 AM4/5/11
to OpenNI
Today I installed a USB3.0 Card and plugged both Kinects into its
ports.
The result: it didn't worked :(
Still the same problem, that the Kinects have tto be on different
roots.
When I plug one Kinect into my onboard USB hub, I can work with both
Kinects!

My thoughts, that USB3.0 should handle the bandwidth of both Kinects
are wrong :(

The only way to connect multiple Kinects seems to be a PCI USB card,
which got more than one Controller on it.
Does anyone know one, which got more than one controller?

To buy a new controller card for every Kinect seems to be a bad
solution, when I think of a project with more than 5 Kinects :)

janboehm

unread,
Apr 7, 2011, 12:20:13 PM4/7/11
to OpenNI
Hi MicheleK.
Did you get at least one kinect to work on a USB 3.0 card?
I have tried a startech card with a NEC uPD720200 chipset on it. And
with that card I could not even start the (single) kinect USB device.
In case you have a working USB 3.0 card I would be very interested in
the maker and chipset, if you have the time please?

Cheers,
jan

blueskin

unread,
Apr 7, 2011, 5:13:06 PM4/7/11
to OpenNI
MichaelK,
I've connected a kinect to USB 3.0 and the other to USB 2.0 and it
worked, I was able to get depth and images. Am gonna try connecting
them both on a USB - PCI card and see what happens.

-CV

MichaelK

unread,
May 17, 2011, 8:48:39 AM5/17/11
to OpenNI
Well that works for me, too.
But I could not use 2 Kinects on one USB3.0 card.

@janboehm: I used this one:
http://www.amazon.de/Transcend-Schnittstellenkarte-Adapter-PCIe-Ports/dp/B003MVJG8Q/ref=sr_1_1?ie=UTF8&qid=1305636485&sr=8-1

m17

unread,
Mar 21, 2012, 10:17:42 PM3/21/12
to openn...@googlegroups.com
I found influences also. I have tested 3 kinect to capture small box on my desk,  the result is not good as just use single kinect. I can't aviod they are in the field of view of the others.   Does openni can shutdown  IR emitter just one frame, so I can  caputure the depth in 3 frame continuously but not simultaneously and not need to restart kinect slowly.
Reply all
Reply to author
Forward
0 new messages