private void FixFramesLenght() { if (Frames.Count > windowFixedSize) { Frames.Dequeue(); //Console.WriteLine(Frames.Dequeue().HiararchicalQuaternions[JointType.KneeLeft].W); } }
public override void saveNextFrame() { var frame = Frames.Dequeue(); var indexFramePath = Path.Combine(CurrentDirectory, CurrentFrame.ToString() + ".uint8"); File.WriteAllBytes(indexFramePath, frame.Resource); frame.Free(); }
public override void saveNextFrame() { var frame = Frames.Dequeue(); var colorFramePath = Path.Combine(CurrentDirectory, CurrentFrame.ToString() + ".uint8"); File.WriteAllBytes(colorFramePath, frame.Resource); frame.Free(); Debug.Log("Color frame saved count: " + Frames.Count); }
private void FMV_Load(object sender, EventArgs e) { /*double ticks = 10000000.0 / (Video.Header.FrameRate / 256.0); * float exp = (float)(ticks - Math.Floor(ticks)); * if (exp != 0) * { * int i = 0; * float result; * do * { * i++; * result = exp * i; * } * while((float)(result - Math.Floor(result)) != 0); * }*/ //TODO: Calculate timing based on fps if ((Video.Header.Flags & 4) == 4) { AudioConverter = new IMAADPCMDecoder(); AudioBuffer = new NAudio.Wave.BufferedWaveProvider(new NAudio.Wave.WaveFormat((int)Video.Header.AudioRate, 16, 1)); AudioBuffer.DiscardOnBufferOverflow = true; AudioBuffer.BufferLength = 8192 * 16; Player = new NAudio.Wave.WaveOut(); Player.DesiredLatency = 150; Player.Init(AudioBuffer); Player.Play(); } new System.Threading.Thread(new System.Threading.ThreadStart(delegate { int state = 0; while (!stop) { if (Frames.Count != 0) { pictureBox1.Image = Frames.Dequeue(); switch (state) { case 0: System.Threading.Thread.Sleep(TimeSpan.FromTicks(666666)); break; case 1: System.Threading.Thread.Sleep(TimeSpan.FromTicks(666667)); break; case 2: System.Threading.Thread.Sleep(TimeSpan.FromTicks(666667)); break; } state = (state + 1) % 3; } } System.Threading.Thread.CurrentThread.Abort(); })).Start(); backgroundWorker1.RunWorkerAsync(); }
public override void saveNextFrame() { var frame = Frames.Dequeue(); var depthFramePath = Path.Combine(CurrentDirectory, CurrentFrame.ToString() + ".uint16"); using (FileStream fs = new FileStream(depthFramePath, FileMode.CreateNew, FileAccess.Write)) { using (BinaryWriter bw = new BinaryWriter(fs)) { var res = frame.Resource; foreach (short value in res) { bw.Write(value); } } } frame.Free(); }
public override void saveNextFrame() { var entry = Frames.Dequeue(); var colorEntry = ColorFrames.Dequeue(); var colorFrame = colorEntry.Resource; mapper.MapDepthFrameToColorSpace(entry.Resource, points); Array.Clear(output, 0, output.Length); for (var y = 0; y < Recorder.DEPTH_HEIGHT; y++) { for (var x = 0; x < Recorder.DEPTH_WIDTH; x++) { int depthIndex = x + (y * Recorder.DEPTH_WIDTH); var cPoint = points[depthIndex]; int colorX = (int)Math.Floor(cPoint.X + 0.5); int colorY = (int)Math.Floor(cPoint.Y + 0.5); if ((colorX >= 0) && (colorX < Recorder.COLOR_WIDTH) && (colorY >= 0) && (colorY < Recorder.COLOR_HEIGHT)) { int colorIndex = ((colorY * Recorder.COLOR_WIDTH) + colorX) * 4; int displayIndex = depthIndex * 4; output[displayIndex + 0] = colorFrame[colorIndex]; output[displayIndex + 1] = colorFrame[colorIndex + 1]; output[displayIndex + 2] = colorFrame[colorIndex + 2]; output[displayIndex + 3] = 0xff; } } } var trackedFramePath = Path.Combine(CurrentDirectory, CurrentFrame.ToString() + ".uint8"); File.WriteAllBytes(trackedFramePath, output); entry.Free(); colorEntry.Free(); }