/// <summary> /// Decodes a specified encoded depth image with a specified decoder into the current depth image. /// </summary> /// <param name="encodedDepthImage">The encoded depth image to decode.</param> /// <param name="depthImageDecoder">The depth image decoder to use.</param> /// <remarks>The depth image width, height and pixel format must match. The method should not be called concurrently.</remarks> public void DecodeFrom(EncodedDepthImage encodedDepthImage, IDepthImageFromStreamDecoder depthImageDecoder) { if (encodedDepthImage.Width != this.Width || encodedDepthImage.Height != this.Height || encodedDepthImage.PixelFormat != this.PixelFormat) { throw new InvalidOperationException("Cannot decode from an encoded depth image that has a different width, height, or pixel format."); } depthImageDecoder.DecodeFromStream(encodedDepthImage.ToStream(), this); }
/// <summary> /// Decodes a specified encoded depth image with a specified decoder into the current depth image. /// </summary> /// <param name="encodedDepthImage">The encoded depth image to decode.</param> /// <param name="depthImageDecoder">The depth image decoder to use.</param> /// <remarks>The depth image width, height and pixel format must match. The method should not be called concurrently.</remarks> public void DecodeFrom(EncodedDepthImage encodedDepthImage, IDepthImageFromStreamDecoder depthImageDecoder) { if (encodedDepthImage.Width != this.Width || encodedDepthImage.Height != this.Height || encodedDepthImage.PixelFormat != this.PixelFormat || encodedDepthImage.DepthValueSemantics != this.DepthValueSemantics || encodedDepthImage.DepthValueToMetersScaleFactor != this.DepthValueToMetersScaleFactor) { throw new InvalidOperationException("Cannot decode from an encoded depth image that has a different width, height, pixel format, depth value semantics or depth value scale factor."); } depthImageDecoder.DecodeFromStream(encodedDepthImage.ToStream(), this); }