joshuajnoble / ofxKinectCommonBridge

A wrapper for the simple Kinect for Windows library developed at Microsoft in partnership with myself & James George
Other
90 stars 36 forks source link

getDepthPixelsRed() depth buffer strange behavior #6

Open teemWerk opened 10 years ago

teemWerk commented 10 years ago

I don't know what the deal is, maybe I'm missing something, but every time I try to manipulate the pixels in the depth buffer, I don't end up working with the image I think I am. I end up manipulating three smaller copies of the depth frame that don't match at all what I think.

If I load the depth pixels into a texture that the library says it should be, e.g.

tex.loadData(kinect.getDepthPixelsRef(), GL_R8);

I get three small copies when I try to draw it, but if I do

tex.loadData(kinect.getDepthPixelsRef(), GL_LUMINANCE);

I get the image I expect. The format is GL_R8 because it's using the programmable renderer. I don't know how to get the actual pixels I am expecting from kinect.getDepthPixelsRef().

proalias commented 10 years ago

Be aware that Kinect depth buffer image data is .... strange. It's not your standard RGB image buffer.

tex.loadData(kinect.getDepthPixelsRef(), GL_LUMINANCE); There's extra data that needs to be trimmed off in the upper 4 bytes of each pixel, YUV conversion might accomplish that, but it's hard to say from your example. Can you post more code? Maybe a picture of your output?