public short[] CreateModeDepthArray(short[] depthArray) { // This is a method of Weighted Moving Average per pixel coordinate across several frames of depth data. // This means that newer frames are linearly weighted heavier than older frames to reduce motion tails, // while still having the effect of reducing noise flickering. short[] modeDepthArray = new short[depthArray.Length]; modeQueue.Push(depthArray); if (modeQueue.Count < modeFrameCount) { depthArray.CopyTo(modeDepthArray, 0); } else { //recorremos for (int q = 0; q < modeFrameCount; q++) { for (int i = 0; i < depthArray.Length; i++) { //por cada pixel //coger del 0, 1 y 2... short depth = Convert.ToInt16(modeQueue.ElementAt <short[]>(q)[i] / 10); frecuencies[i].frecs[q] = depth; } } ; } //resolvemos frecuencias for (int i = 0; i < depthArray.Length; i++) { modeDepthArray[i] = Convert.ToInt16(frecuencies[i].GetMode() * 10 + 5); } return(modeDepthArray); }