object enclosing bounding box

edited October 2014 in Kinect

Hi I have tried following code and I can be able to extract the silhouette of the person correctly. now I want to draw a object enclosing bounding box around the silhouette and returns the value of height and width of BB to text file. please help me to do this. I`m beginner to processing programming..

Thank you!

import SimpleOpenNI.*; SimpleOpenNI context; PImage userImage; int[] userMap; PImage rgbImage; color pixelColor; void setup(){

size(640,480); context=new SimpleOpenNI(this); context.enableRGB(); context.enableDepth(); context.enableUser();

userImage=createImage(640,480,RGB); } void draw(){

background(0); context.update(); rgbImage=context.rgbImage();

userMap=context.userMap(); for(int y=0;y<context.depthHeight();y++){ for(int x=0;x<context.depthWidth();x++){ int index=x+y*640; if(userMap[index]!=0){ pixelColor=rgbImage.pixels[index]; userImage.pixels[index]=color(0,255,0); }else{ userImage.pixels[index]=color(0); }

}

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

Sign In or Register to comment.