Beispiel #1
0
        /// <summary>
        /// Decode a shared encoded depth image to a shared depth image.
        /// </summary>
        /// <param name="sharedEncodedDepthImage">The shared encoded depth image to decode.</param>
        /// <returns>The decoded shared depth image.</returns>
        internal static Shared <DepthImage> Decode(this Shared <EncodedDepthImage> sharedEncodedDepthImage)
        {
            Shared <DepthImage> sharedDepthImage = null;

            if (sharedEncodedDepthImage.Resource != null)
            {
                sharedDepthImage = DepthImagePool.GetOrCreate(sharedEncodedDepthImage.Resource.Width, sharedEncodedDepthImage.Resource.Height);
                var decoder = new DepthImageFromStreamDecoder();
                decoder.DecodeFromStream(sharedEncodedDepthImage.Resource.ToStream(), sharedDepthImage.Resource);
            }

            return(sharedDepthImage);
        }
Beispiel #2
0
        private static Shared <DepthImage> Adapter(Shared <EncodedDepthImage> sharedEncodedDepthImage, Envelope envelope)
        {
            Shared <DepthImage> sharedDepthImage = null;

            if ((sharedEncodedDepthImage != null) && (sharedEncodedDepthImage.Resource != null))
            {
                sharedDepthImage = DepthImagePool.GetOrCreate(sharedEncodedDepthImage.Resource.Width, sharedEncodedDepthImage.Resource.Height);
                var decoder = new DepthImageFromStreamDecoder();
                decoder.DecodeFromStream(sharedEncodedDepthImage.Resource.ToStream(), sharedDepthImage.Resource);
            }

            return(sharedDepthImage);
        }
        /// <inheritdoc/>
        public override Shared <DepthImage> GetAdaptedValue(Shared <EncodedDepthImage> source, Envelope envelope)
        {
            Shared <DepthImage> sharedDepthImage = null;

            if (source != null && source.Resource != null)
            {
                sharedDepthImage = DepthImagePool.GetOrCreate(source.Resource.Width, source.Resource.Height);
                var decoder = new DepthImageFromStreamDecoder();
                decoder.DecodeFromStream(source.Resource.ToStream(), sharedDepthImage.Resource);
            }

            return(sharedDepthImage);
        }
Beispiel #4
0
        private static Shared <Image> Adapter(Shared <EncodedDepthImage> sharedEncodedDepthImage, Envelope envelope)
        {
            Shared <Image> sharedImage = null;

            if ((sharedEncodedDepthImage != null) && (sharedEncodedDepthImage.Resource != null))
            {
                var sharedDepthImage = DepthImagePool.GetOrCreate(sharedEncodedDepthImage.Resource.Width, sharedEncodedDepthImage.Resource.Height);
                sharedImage = ImagePool.GetOrCreate(sharedEncodedDepthImage.Resource.Width, sharedEncodedDepthImage.Resource.Height, PixelFormat.Gray_16bpp);
                var decoder = new DepthImageFromStreamDecoder();
                decoder.DecodeFromStream(sharedEncodedDepthImage.Resource.ToStream(), sharedDepthImage.Resource);
                sharedDepthImage.Resource.CopyTo(sharedImage.Resource);
            }

            return(sharedImage);
        }
Beispiel #5
0
        /// <inheritdoc/>
        public override Shared <Image> GetAdaptedValue(Shared <EncodedDepthImage> source, Envelope envelope)
        {
            Shared <Image> sharedImage = null;

            if ((source != null) && (source.Resource != null))
            {
                using var sharedDepthImage = DepthImagePool.GetOrCreate(source.Resource.Width, source.Resource.Height);
                sharedImage = ImagePool.GetOrCreate(source.Resource.Width, source.Resource.Height, PixelFormat.Gray_16bpp);
                var decoder = new DepthImageFromStreamDecoder();
                decoder.DecodeFromStream(source.Resource.ToStream(), sharedDepthImage.Resource);
                sharedDepthImage.Resource.CopyTo(sharedImage.Resource);
            }

            return(sharedImage);
        }