Processsing 3 Kinect v1
Basically, i've stripped down my code so it's just this, atm it only shows the user when you're in the correct threshold. You go pink as I have made it that color. I want to know how to only show the RGB pixels for the bits that are pink.
Could I also just lay over a black shape where the threshold is not?
Many thanks for reading, any feedback is much appreciated
` import org.openkinect.freenect.*; import org.openkinect.freenect2.*; import org.openkinect.processing.*; import org.openkinect.tests.*;
Kinect kinect;
int kinectWidth = 640;
int kinectHeight = 480;
PImage cam = createImage(640, 480, RGB);
int minThresh = 300;
int maxThresh = 700;
float reScale;
void setup() {
size(640, 480, P3D);
kinect = new Kinect(this);
kinect.enableMirror(true);
kinect.initDepth();
reScale = (float) width / kinectWidth;
}
void draw() {
cam.loadPixels();
int[] depth = kinect.getRawDepth();
for (int x = 0; x < kinect.width; x++) {
for (int y = 0; y < kinect.height; y++) {
int offset = x + y * kinect.width;
int d = depth[offset];
if (d > minThresh && d < maxThresh) {
cam.pixels[offset] = color(255,0,200);
} else{
cam.pixels[offset] = color(0);
}
}
}
cam.updatePixels();
background(255);
image(cam,0,0);
}
`