Created
June 28, 2011 16:29
-
-
Save atduskgreg/1051537 to your computer and use it in GitHub Desktop.
upsidedown_point_cloud.pde
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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