private void ColorReader_FrameArrived(MediaFrameReader sender, MediaFrameArrivedEventArgs args) { var subscribers = FrameArrived; if (subscribers != null) { Task.Run(() => { var frame = sender.TryAcquireLatestFrame(); if (frame != null) { Sensor.GetCoordinateMapper().UpdateFromColorFrame(frame.CoordinateSystem); var bitmap = frame.VideoMediaFrame.SoftwareBitmap; if (ReaderConfiguration.HasFlag(ReaderConfig.HalfResolution)) { var original = bitmap; bitmap = bitmap.Downsize(); original.Dispose(); } var colorArgs = new ColorFrameArrivedEventArgs( this, bitmap, new CameraIntrinsics(frame.VideoMediaFrame.CameraIntrinsics)); subscribers(this, colorArgs); frame.Dispose(); } }); } }
private void NetworkClient_ColorFrameArrived(object sender, ColorFramePacket e) { var subscribers = FrameArrived; if (subscribers != null) { Sensor.GetCoordinateMapper().ColorToDepth = e.ColorToDepthTransform; var colorArgs = new ColorFrameArrivedEventArgs( this, e.Bitmap, e.CameraIntrinsics); subscribers(this, colorArgs); } }
private void ColorReader_FrameArrived(MediaFrameReader sender, MediaFrameArrivedEventArgs args) { var subscribers = FrameArrived; if (subscribers != null) { var frame = sender.TryAcquireLatestFrame(); if (frame != null) { Sensor.GetCoordinateMapper().UpdateFromColor(frame.CoordinateSystem); var colorArgs = new ColorFrameArrivedEventArgs( this, frame.VideoMediaFrame.SoftwareBitmap, new CameraIntrinsics(frame.VideoMediaFrame.CameraIntrinsics)); subscribers(this, colorArgs); } } }