@@ -0,0 +1,1711 @@
+package com.haxademic.core.hardware.kinect;%0A%0Aimport java.util.ArrayList;%0A%0Aimport com.haxademic.core.data.FloatBuffer;%0A%0Apublic class KinectBufferedData %7B%0A%09%0A%09protected float _pixelSize;%0A%09protected float _kinectClose;%0A%09protected float _kinectFar;%0A%09protected ArrayList%3CFloatBuffer%3E _gridBuffer;%0A%09protected int%5B%5D _bufferedData;%0A%09%0A%09public KinectBufferedData( float pixelSize, float kinectClose, float kinectFar, int bufferSize ) %7B%0A%09%09_pixelSize = pixelSize;%0A%09%09_kinectClose = kinectClose;%0A%09%09_kinectFar = kinectFar;%0A%09%09buildGridBuffer(bufferSize);%0A%09%7D%0A%09%0A%09protected void buildGridBuffer(int bufferSize) %7B%0A%09%09_gridBuffer = new ArrayList%3CFloatBuffer%3E();%0A%09%09for ( int x = 0; x %3C KinectSize.WIDTH; x += _pixelSize ) %7B%0A%09%09%09for ( int y = 0; y %3C KinectSize.HEIGHT; y += _pixelSize ) %7B%0A%09%09%09%09_gridBuffer.add( new FloatBuffer(bufferSize) );%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%09%0A%09public void update( IKinectWrapper kinectWrapper ) %7B%0A%09%09if(_bufferedData == null) %7B%0A%09%09%09_bufferedData = kinectWrapper.getDepthData().clone();%0A%09%09%7D%0A%09%09%0A%09%09int gridIndex = 0;%0A%09%09float depth = 0;%0A%09%09%0A%09%09for ( int x = 0; x %3C KinectSize.WIDTH; x += _pixelSize ) %7B%0A%09%09%09for ( int y = 0; y %3C KinectSize.HEIGHT; y += _pixelSize ) %7B%0A%09%09%09%09depth = kinectWrapper.getMillimetersDepthForKinectPixel( x, y );%0A//%09%09%09%09if( depth %3E 0 ) %7B%0A%09%09%09%09%09_gridBuffer.get( gridIndex ).update( depth );%0A//%09%09%09%09%7D%0A%09%09%09%09%0A%09%09%09%09int offset = x + y * KinectSize.WIDTH;%0A%09%09%09%09if( offset %3C _bufferedData.length ) %7B%0A%09%09%09%09%09_bufferedData%5Boffset%5D = (int) _gridBuffer.get( gridIndex ).average();%0A%09%09%09%09%7D%0A%0A%09%09%09%09gridIndex += 1;%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%09%0A%09public int getBufferedDepthForKinectPixel( int x, int y ) %7B%0A%09%09int offset = x + y * KinectSize.WIDTH;%0A%09%09if( offset %3E= _bufferedData.length ) %7B%0A%09%09%09return 0;%0A%09%09%7D else %7B%0A%09%09%09return _bufferedData%5Boffset%5D;%0A%09%09%7D%0A%09%7D%0A%7D%0A

Add Kinect buffered data class