Created
April 4, 2014 09:58
-
-
Save kamend/9971557 to your computer and use it in GitHub Desktop.
This is how to generate point cloud mesh from the rawDepthPixels data, using Openframeworks and KinectCommonBridge
This file contains 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
mesh.clear(); | |
mesh.setMode(OF_PRIMITIVE_POINTS); | |
for(int x=0;x<640;x+=2) { | |
for(int y=0;y<480;y+=2) { | |
int index = x + y * 640; | |
short depth = kinect.getRawDepthPixelsRef().getPixels()[index]; | |
if(depth > minDistance && depth < maxDistance) { | |
Vector4 world = NuiTransformDepthImageToSkeleton(x,y,kinect.getRawDepthPixelsRef().getPixels()[index] << 3,NUI_IMAGE_RESOLUTION_640x480); | |
float scale = 500.0f; | |
mesh.addVertex(ofVec3f(world.x,world.y,-world.z)*scale); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment