private void MultiReaderOnMultiSourceFrameArrived(object sender, MultiSourceFrameArrivedEventArgs e) { var multiFrame = e.FrameReference.AcquireFrame(); if (multiFrame != null) { var colorFrame = multiFrame.ColorFrameReference.AcquireFrame(); var bodyFrame = multiFrame.BodyFrameReference.AcquireFrame(); var depthFrame = multiFrame.DepthFrameReference.AcquireFrame(); var colorFrameOne = colorFrame == null ? null : new ColorFrameStreamOne.ColorFrame(colorFrame); var bodyFrameOne = bodyFrame == null ? null : new BodyFrameStreamOne.BodyFrame(bodyFrame); var depthFrameOne = depthFrame == null ? null : new DepthFrameStreamOne.DepthFrame(depthFrame); MultiFrameArrived?.Invoke(this, new MultiFrameReadyEventArgs(new MultiFrame(colorFrameOne, bodyFrameOne, depthFrameOne))); } }
private void KinectSensor_AllFramesReady(object sender, AllFramesReadyEventArgs e) { DepthFrameStream360.DepthFrame depthFrame360 = null; BodyFrameStream360.BodyFrame bodyFrame360 = null; ColorFrameStream360.ColorFrame colorFrame360 = null; if (FrameTypes.HasFlag(MultiFrameTypes.Color)) { var colorFrame = e.OpenColorImageFrame(); if (colorFrame == null) { return; } colorFrame360 = new ColorFrameStream360.ColorFrame(colorFrame); } if (FrameTypes.HasFlag(MultiFrameTypes.Body)) { var skeletonFrame = e.OpenSkeletonFrame(); if (skeletonFrame == null) { return; } bodyFrame360 = new BodyFrameStream360.BodyFrame(skeletonFrame); } if (FrameTypes.HasFlag(MultiFrameTypes.Depth)) { var depthFrame = e.OpenDepthImageFrame(); if (depthFrame == null) { return; } depthFrame360 = new DepthFrameStream360.DepthFrame(depthFrame); } MultiFrameArrived?.Invoke(this, new MultiFrameReadyEventArgs(new MultiFrame(colorFrame360, bodyFrame360, depthFrame360))); }