void ReplayAllFramesReady(ReplayAllFramesReadyEventArgs e) { //Console.WriteLine("isStreaming replay" + IsStreaming.ToString()); var color = e.AllFrames.ColorImageFrame; var skeleton = e.AllFrames.SkeletonFrame; var depth = e.AllFrames.DepthImageFrame; if (color != null && skeleton != null && depth != null) { _frame.synchronize(depth, color, skeleton, _isPaused); if(FrameReady!=null) FrameReady(this, _frame); } }
private void ReplayAllFramesReady(ReplayAllFramesReadyEventArgs replayAllFramesReadyEventArgs) { if ((_replay.Options & KinectRecordOptions.Audio) != 0 && !_startedAudio) { _soundPlayer = new SoundPlayer(_replay.AudioFilePath); _soundPlayer.Play(); _startedAudio = true; } ProcessSpeechCommands(); var colorImageFrame = replayAllFramesReadyEventArgs.AllFrames.ColorImageFrame; if (colorImageFrame != null) ProcessColorImageFrame(colorImageFrame); var depthImageFrame = replayAllFramesReadyEventArgs.AllFrames.DepthImageFrame; if(depthImageFrame!=null) ProcessDepthImageFrame(depthImageFrame); var skeletonFrame = replayAllFramesReadyEventArgs.AllFrames.SkeletonFrame; if (skeletonFrame != null) ProcessSkeletonFrame(skeletonFrame); }
void ReplayAllFramesReady(ReplayAllFramesReadyEventArgs e) { if ((replay.Options & KinectRecordOptions.Audio) != 0 && !_startedAudio) { _soundPlayer = new SoundPlayer(replay.AudioFilePath); _soundPlayer.Play(); _startedAudio = true; } var colorImageFrame = e.AllFrames.ColorImageFrame; if (colorImageFrame != null) UpdateColorFrame(colorImageFrame); var skeletonFrame = e.AllFrames.SkeletonFrame; if (skeletonFrame != null) UpdateSkeletons(skeletonFrame); }
//write .avi and store data in .xml for a certain frame private void writeFrame(ReplayAllFramesReadyEventArgs e) { //colour frame BitmapImage bitmapImage_currentframe = new BitmapImage(); Bitmap bitmap_currentframe = new Bitmap(640, 480); var colorImageFrame = e.AllFrames.ColorImageFrame; if (colorImageFrame != null) { if (isfirst) { initialframenumber = colorImageFrame.FrameNumber; System.Console.WriteLine("initialFramenumber = " + initialframenumber); isfirst = false; } lastframenumber = colorImageFrame.FrameNumber; //write xml xmlwriter.storeframe(e.AllFrames.SkeletonFrame, colorImageFrame.FrameNumber, replay.CoordinateMapper); //write avi var pixelData = new byte[colorImageFrame.PixelDataLength]; colorImageFrame.CopyPixelDataTo(pixelData); var stride = colorImageFrame.Width * PixelFormats.Bgr32.BitsPerPixel / 8; //converision to bitmap imagesource.WritePixels(new Int32Rect(0, 0, colorImageFrame.Width, colorImageFrame.Height), pixelData, stride, 0); bitmapImage_currentframe = ConvertWriteableBitmapToBitmapImage(imagesource); bitmap_currentframe = ConvertBitmapImageToBitmap(bitmapImage_currentframe); videoWriter.AddFrame(bitmap_currentframe); framecounter++; } }
void ReplayAllFramesReady(ReplayAllFramesReadyEventArgs e) { if (IsGenerating) { //indicate missing frame CurrentFramenumber++; if (CurrentFramenumber != e.AllFrames.ColorImageFrame.FrameNumber) { missingFrameCount++; System.Console.WriteLine("color framenumber = " + e.AllFrames.ColorImageFrame.FrameNumber); CurrentFramenumber = e.AllFrames.ColorImageFrame.FrameNumber; } writeFrame(e); //return; } var colorImageFrame = e.AllFrames.ColorImageFrame; if (colorImageFrame != null) UpdateColorFrame(colorImageFrame); var skeletonFrame = e.AllFrames.SkeletonFrame; if (skeletonFrame != null) UpdateSkeletons(skeletonFrame); }