I am playing with the Kinect and when I enlarge the size of the canvas, the Kinect window stays the same size and does not expand to match the size of the canvas. How can I enlarge it?
import processing.serial.;
import KinectPV2.;
Serial myPort;
KinectPV2 kinect;
boolean foundUsers = false;
PImage img;
int matrixSizeWidth = 14;
int matrixSizeHeight = 18;
void setup() {
size(1920, 1080);
frameRate(200);
//String portName = “COM5”;
// myPort = new Serial(this, portName, 115200);
kinect = new KinectPV2(this);
//kinect.enableDepthImg(true);
kinect.enableBodyTrackImg(true);
img = createImage(512, 424, RGB);
kinect.init();
// delay(6000);
}
void draw() {
clear();
background(255);
PImage kinectImg = kinect.getBodyTrackImage();
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);
img.loadPixels();
for (int y = 0; y < 424; y += matrixSizeHeight){
int col = 0;
for (int x = 20; x < 512; x += matrixSizeWidth) {
color c = kinectImg.pixels[x + y*kinectImg.width];
// print(c);
if(c < -1)
{
//c = toColor;
//img.pixels[x + (y)*kinectImg.width] = thatColor;
}
else{
c = thatColor;
//img.pixels[x + (y)*kinectImg.width] = 255;
}
// 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++;
}
img.updatePixels();
// myPort.write(“C”);
image(kinect.getDepthImage(), 0,0,1920,1080);
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);
}