# How can I link multiple Kinects in one processing sketch?

**URL:** <https://discourse.processing.org/t/how-can-i-link-multiple-kinects-in-one-processing-sketch/10169>\
**Category:** Libraries\
**Created:** [April 10, 2019, 7:53pm UTC](https://discourse.processing.org/t/how-can-i-link-multiple-kinects-in-one-processing-sketch/10169 "2019-04-10T19:53:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicoles](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@nicoles](https://discourse.processing.org/u/nicoles)\
**Post date:** [April 10, 2019, 7:53pm UTC](https://discourse.processing.org/t/how-can-i-link-multiple-kinects-in-one-processing-sketch/10169/1 "2019-04-10T19:53:32Z")

</div>

I am having trouble connecting multiple Kinects within one Processing sketch. I want to be able to use the data from multiple Kinects to create one extended image. Is there any way to do this?

---

<div class="post-metadata">

**Author:** ![zenemig](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/zenemig/32/4418_2.png) [@zenemig](https://discourse.processing.org/u/zenemig)\
**Post date:** [April 12, 2019, 5:18pm UTC](https://discourse.processing.org/t/how-can-i-link-multiple-kinects-in-one-processing-sketch/10169/2 "2019-04-12T17:18:04Z")

</div>

Hi,  
Same as your other post about using [kinect](https://discourse.processing.org/t/how-do-you-expand-a-kinects-window-to-match-the-size-of-the-canvas/10168)

- What kinect are you using?
- What operative system are you using?
- What library are you using for the kinect connection?

---

<div class="post-metadata">

**Author:** ![nicoles](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@nicoles](https://discourse.processing.org/u/nicoles)\
**Post date:** [April 12, 2019, 6:53pm UTC](https://discourse.processing.org/t/how-can-i-link-multiple-kinects-in-one-processing-sketch/10169/3 "2019-04-12T18:53:57Z")

</div>

I’m using a Kinect v2. My operating system is MacOS Sierra version 10.12.6. The library I’m using is Open Kinect.

---

<div class="post-metadata">

**Author:** ![zenemig](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/zenemig/32/4418_2.png) [@zenemig](https://discourse.processing.org/u/zenemig)\
**Post date:** [April 13, 2019, 1:44am UTC](https://discourse.processing.org/t/how-can-i-link-multiple-kinects-in-one-processing-sketch/10169/4 "2019-04-13T01:44:55Z")

</div>

Ok. I guess you are talking about this [Open Kinect](https://github.com/shiffman/OpenKinect-for-Processing).  
If that is the case, there is an example for using more than one Kinect v2. Is included in the library and look like this:

```auto
/*
Thomas Sanchez Lengeling
http://codigogenerativo.com/
How to use multiple Kinects v2 in the same sketch.
Should work up n number of Kinects v2 connected to the USB 3.0 port.
https://github.com/shiffman/OpenKinect-for-Processing
http://shiffman.net/p5/kinect/
*/

import org.openkinect.processing.*;

Kinect2 kinect2a;
Kinect2 kinect2b;

void setup() {
  size(1536, 848, P2D);

  kinect2a = new Kinect2(this);
  kinect2a.initDepth();
  kinect2a.initVideo();
  kinect2a.initIR();

  kinect2b = new Kinect2(this);
  kinect2b.initDepth();
  kinect2b.initVideo();
  kinect2b.initIR();

  //Start tracking each kinect
  kinect2a.initDevice(0); //index 0
  kinect2b.initDevice(1); //index 1

  background(0);
}

void draw() {
  background(0);

  image(kinect2a.getDepthImage(), 0, 0);
  image(kinect2a.getIrImage(), 512, 0);
  image(kinect2a.getVideoImage(), 512*2, 0, 512, 424);

  image(kinect2b.getDepthImage(), 0, 424);
  image(kinect2b.getIrImage(), 512, 424);
  image(kinect2b.getVideoImage(), 512*2, 424, 512, 424);
}

```

I cant test it so, let us know if that help.
