Ejemplo n.º 1
0
        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();
                    }
                });
            }
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        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);
                }
            }
        }