Quantcast
Channel: Kinect - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 530

Kinect Projection Masking - How to enlarge image to fit a person?

$
0
0

Hi,

I'm currently working on an end of year project for university called 'motion tracking projection mapping'.

I'm currently looking into 'projection masking' using the kinect depth image. Basically i'm wanting to project some imagery through a projector and onto a moving person. I have some example code from another site which creates a depth image mask. He later adds the video function to have a video loop onto the person's silhouette. Basically all i'm wanting to do is make the size(); of the window bigger so i can project an enlarged image. However when i'm trying to change the size of the window it doesn't let me as it's something to do with the values being out of bounds of the array. The code im trying to use is in a screenshot attached. Am i able to enlarge the size of the window or is not not possible with kinect 1's 640x480 limitation?

Any help anyone could give me would be greatly appreciated. The code i'm using is below:

Thank you!

import SimpleOpenNI.*; SimpleOpenNI kinect;

int distance = 1500; int distance2 = 3000;

PImage liveMap;

void setup() {
size(640, 480); kinect = new SimpleOpenNI(this); kinect.setMirror(false); kinect.enableDepth(); liveMap = createImage(640, 480, RGB); }

void draw() { background(color(0,0,0));
kinect.update(); int[] depthValues = kinect.depthMap(); liveMap.width = 640; liveMap.height = 480; liveMap.loadPixels(); for (int y=0; y<480; y++) { for (int x=0; x<640; x++) { int i= x+(y*640); int currentDepthValue = depthValues[i]; if (currentDepthValue>distance&&currentDepthValue<distance2) { liveMap.pixels[i] = color(255,255,255);
} else { liveMap.pixels[i] = color(0,0,0);
} }
} liveMap.updatePixels(); image(liveMap,0,0); }


Viewing all articles
Browse latest Browse all 530

Trending Articles