private short[] extractDepthImage(NuiImageBuffer buf) { DepthBuffer db = (DepthBuffer)Marshal.PtrToStructure(buf.m_pBuffer,typeof(DepthBuffer)); return db.pixels; }
private Color32[] extractColorImage(NuiImageBuffer buf) { int totalPixels = buf.m_Width * buf.m_Height; Color32[] colorBuf = colorImage; ColorBuffer cb = (ColorBuffer)Marshal.PtrToStructure(buf.m_pBuffer,typeof(ColorBuffer)); for (int pix = 0; pix < totalPixels; pix++) { colorBuf[pix].r = cb.pixels[pix].r; colorBuf[pix].g = cb.pixels[pix].g; colorBuf[pix].b = cb.pixels[pix].b; } return colorBuf; }