Пример #1
0
        public MemoryBitmap GetDisplayBitmap()
        {
            var(min, max) = SpanBitmap.MinMax(_Depth);

            var rgb = new MemoryBitmap <Byte>(_Depth.Width, _Depth.Height, Pixel.Luminance8.Format);

            SpanBitmap.CopyPixels(_Depth, rgb, (-min, 255.0f / (max - min)), (0, 255));

            return(rgb);
        }
Пример #2
0
        public MemoryBitmap <Byte> GetGrayBitmap()
        {
            var minmax = SpanBitmap.MinMax(_Depth);

            var gray = new MemoryBitmap <Byte>(_Depth.Width, _Depth.Height, Pixel.Luminance8.Format);

            SpanBitmap.CopyPixels(_Depth, gray, (0, 255), (0, 255));

            return(gray);
        }
Пример #3
0
        public void Update(SpanBitmap <Vector3> newImage)
        {
            // var minmax = SpanBitmap.MinMax(newImage);

            if (_Image.Width != newImage.Width || _Image.Height != newImage.Height)
            {
                _Image = new MemoryBitmap(newImage.Width, newImage.Height, Pixel.BGR24.Format);
            }

            SpanBitmap.CopyPixels(newImage, _Image, (0, 255), (0, 255));

            _SpriteAsset = null;
        }
Пример #4
0
        public static void SetGrayPixels(SpanTensor2 <Single> dst, PointerBitmap src, Single offset, Single scale)
        {
            if (src.Size != dst.BitmapSize)
            {
                throw new ArgumentException(nameof(dst.BitmapSize));
            }

            var dstSpan = dst.AsSpanBitmap();
            var srcSpan = src.AsSpanBitmap();

            if (srcSpan.PixelFormat.ByteCount == 1)
            {
                SpanBitmap.CopyPixels(srcSpan.OfType <Byte>(), dstSpan, (offset, scale), (0, 1));
            }
        }