public void SaveSkeletonFrame(BodyFrameWrapper bfw) { if (jList == null) { jList = new List <JointRow>(); trackedBody = bfw.TrackedBodies[0]; } foreach (var bw in bfw.TrackedBodies) { foreach (var jw in bw.Joints) { var jr = new JointRow(jw, bfw.RelativeTimeString, this.frameCounter, bw.TrackingId, jw.TrackingState); jList.Add(jr); } } this.frameCounter++; }
private void Reader_MultiSourceFrameArrived(object sender, MultiSourceFrameArrivedEventArgs e) { WriteableBitmap depthWBitmap = null; WriteableBitmap colorWBitmap = null; Bitmap colorBitmap = null; Bitmap depthBitmap = null; MultiSourceFrame frame = e.FrameReference.AcquireFrame(); if (frame != null) { using (DepthFrame depthFrame = frame.DepthFrameReference.AcquireFrame()) { if (depthFrame != null) { _frameParser.ParseToBitmaps(depthFrame, out depthBitmap, out depthWBitmap); if (_selectedCamera == ECameraType.Depth) { if (_selectedCamera == ECameraType.Depth) { bodyViewer.UpdateFrameCounter(); bodyViewer.KinectImage = depthWBitmap; } } } } if (_selectedCamera == ECameraType.Color) { using (ColorFrame colorFrame = frame.ColorFrameReference.AcquireFrame()) { if (colorFrame != null) { _frameParser.ParseToBitmaps(colorFrame, out colorBitmap, out colorWBitmap); if (_selectedCamera == ECameraType.Color) { bodyViewer.UpdateFrameCounter(); bodyViewer.KinectImage = colorWBitmap; } } } } using (BodyFrame bodyFrame = frame.BodyFrameReference.AcquireFrame()) { if (bodyFrame != null) { BodyFrameWrapper bodyFrameWrapper = new BodyFrameWrapper(bodyFrame); if (bodyFrameWrapper.TrackedBodies.Any()) { bodyViewer.RenderBodies(bodyFrameWrapper.TrackedBodies, _selectedCamera); if (_recordingStarted) { _recordedBodyFrames.Add(bodyFrameWrapper); if (depthWBitmap != null) { _depthVideoWriter.WriteVideoFrame(depthBitmap); //writing colorframes does work but should be deactivated by default //_colorVideoWriter.WriteVideoFrame(colorBitmap); } else { Logger.Instance.LogMessage("DepthVideoFrame missing at: " + _recordedBodyFrames.Count.ToString()); } } } } else { bodyViewer.DeleteUntrackedBodies(null); } } } }