Ejemplo n.º 1
0
        /// <summary>
        ///   Converts an image from one representation to another.
        /// </summary>
        ///
        /// <param name="input">The input image to be converted.</param>
        /// <param name="output">The converted image.</param>
        ///
        public void Convert(BitmapSource input, out float[,,] output)
        {
            var c      = new FormatConvertedBitmap(input, PixelFormats.Rgba128Float, null, 1.0);
            int width  = c.PixelWidth;
            int height = c.PixelHeight;
            int stride = c.GetStride();

            output = new float[width, height, 4];
            c.CopyPixels(output);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///   Converts an image from one representation to another.
        /// </summary>
        ///
        /// <param name="input">The input image to be converted.</param>
        /// <param name="output">The converted image.</param>
        ///
        public void Convert(BitmapSource input, out byte[] output)
        {
            var c      = new FormatConvertedBitmap(input, PixelFormats.Gray8, null, 1.0);
            int width  = c.PixelWidth;
            int height = c.PixelHeight;
            int stride = c.GetStride();

            output = new byte[width * height];
            c.CopyPixels(output, stride, 0);
        }