Skip to content

Instantly share code, notes, and snippets.

@atduskgreg
Created June 28, 2011 16:29
Show Gist options
  • Save atduskgreg/1051537 to your computer and use it in GitHub Desktop.
Save atduskgreg/1051537 to your computer and use it in GitHub Desktop.
upsidedown_point_cloud.pde
import processing.opengl.*;
import SimpleOpenNI.*;
SimpleOpenNI kinect;
void setup() {
size(1024, 768, OPENGL);
kinect = new SimpleOpenNI(this);
kinect.enableDepth();
}
float rot = 0;
void draw() {
background(0);
kinect.update();
translate(width/2, height/2, 1000);
// WHY IS THIS NEEDED?
rotateX(radians(180));
stroke(255);
// get the depth data as 3D points
PVector[] depthPoints = kinect.depthMapRealWorld();
for(int i = 0; i < depthPoints.length; i++){
// get the current point from the point array
PVector currentPoint = depthPoints[i];
// draw the current point
point(currentPoint.x, currentPoint.y, currentPoint.z);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment