We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Im new with processing, im trying to make a fade background and as the user move the movement will stay on the grid.
So i have made a grid, where i move the can see my body movement on the grid.
1) how do i make the movement stay in grid after i move.
2) how do i make ... example = player 1 = red, player 2 = green.
3)background color fade random rgb.
import processing.serial.*;
import KinectPV2.*;
Serial myPort;
KinectPV2 kinect;
boolean foundUsers = false;
int matrixSizeWidth = 14;
int matrixSizeHeight = 18;
void setup() {
size(1024, 424);
frameRate(200);
//String portName = "COM5";
// myPort = new Serial(this, portName, 115200);
kinect = new KinectPV2(this);
//kinect.enableDepthImg(true);
kinect.enableBodyTrackImg(true);
kinect.init();
delay(6000);
}
void draw() {
clear();
background(255);
PImage kinectImg = kinect.getBodyTrackImage();
image(kinectImg, 512, 0);
int [] rawData = kinect.getRawBodyTrack();
foundUsers = false;
//iterate through 1/5th of the data
for(int i = 0; i < rawData.length; i+=5){
if(rawData[i] != 255){
//found something
foundUsers = true;
break;
}
}
// print(rawData);
int totalPixels = 0;
//if (foundUsers)
//{
// myPort.clear();
int row = 0;
//color toColor = -(int)random(255*255*255);
color thatColor = -(int)random(255*255*255);
for (int y = 10; y < 414; y += matrixSizeHeight){
int col = 0;
for (int x = 10; x < 500; x += matrixSizeWidth) {
color c = kinectImg.pixels[x + y*kinectImg.width];
// print(c);
if(c < -1)
{
//c = toColor;
}
else{
c = thatColor;
}
print(c);
fill(c);
stroke(0);
strokeWeight(1);
rect(x, y, matrixSizeWidth, matrixSizeHeight);
//if (totalPixels < 105)
//{
if (c != -1)
{
//print(1);
// myPort.write("H");
totalPixels++;
//myPort.write(totalPixels);
}
else
{
//print(0);
// myPort.write("L");
}
//}
col++;
}
row++;
}
// myPort.write("C");
fill(0);
textSize(14);
text(kinect.getNumOfUsers(), 10, 30);
text("Found User: "+foundUsers, 10, 50);
text(frameRate, 10, 70);
text("Total Pixels: " + totalPixels, 10, 90);
}
Answers
Format your code above. Edit your post, select your code and hit ctrl+o. Ensure one empty line above and below your code block.
Kf
Sorry bout that, shall make the changes
Please describe your problem. You need to be specific, as most ppl will not be able to reproduce your problem because they will lack a kinetic unit.
Kf
Update : i have a fading background behind my grid, how can i make the grid transparent but still see user moving?