Kinect interacting with LED's (processing & Arduino)

#1

0

I use a neopixel 6x6 led matrix (ws2812) + Arduino Uno

I wrote a small code that uses Kinect to track movement in processing. It displays everything between the depth of 300 & 500 in pixels.

I want this to be displayed on a led matrix. (I haven’t gotten more out the matrix it displaying a rainbow). It will stay connected to my computer throughout so the video processing wouldn’t have to be done on the Arduino itself.

I am new to Arduino but I think for this I need to solve both these problems:

  1. I want to know how I can translate everything between the depth of 300 & 500 to values I can use in Arduino. to make the leds glow up when these values are met.
  2. And how would I make it so the right Leds light up? so it basically displays what processing captures.

basically the leds should display something like this: https://www.youtube.com/watch?v=cDIFTnPqY_M

but how would I go and do this? does anybody have any tips/articles/tutorials I could look at?

If someone can get me on the right track that would be greatly appreciated! do I need extra hardware or is this just code?

here is my processing code:

import org.openkinect.processing.*;

Kinect kinect;

PImage img; 

void setup() {



    size(6, 6); 
    kinect = new Kinect(this); 
    kinect.initDepth(); 
    img = createImage(kinect.width, kinect.height, RGB); 

}  

void draw() { 
    background(0); 

    img.loadPixels(); 

    int[] depth = kinect.getRawDepth(); 
int skip = 60;

    for (int x = 0; x < kinect.width; x+=skip) { 
        for (int y = 0; y < kinect.height; y+=skip) {
            int offset = x + y * kinect.width; 
            int d = depth[offset]; 




            if (d>300 && d < 500) {
              img.pixels[offset] = color(255, 255, 255);
            } else {
              img.pixels[offset] = color(0);
            }

        }
    }

    img.updatePixels(); 
    image(img, 0, 0);
}

thank you greatly for any tips or leads!

#2

What size is your led matrix, width * height?

What size is your kinect depth camera image?

One suggested approach:

  1. Start by sending an image the same size as your LED matrix to the matrix. Does it work? Then
  2. Try sending a simple image the size of your kinect camera (not the camera image itself), resizing it. Does it work? Now
  3. Send the unfiltered kinect image. Working? Next
  4. Filter the kinect image before sending it.