public static WriteableBitmap MakeBitmap(RGB8Map image) { var bmp = new WriteableBitmap(image.Width, image.Height, 96, 96, PixelFormats.Rgb24, null); bmp.WritePixels(new Int32Rect(0, 0, image.Width, image.Height), image.Rgb, image.Stride, 0); return(bmp); }
private static RGB8Map ApplyCurve(ColorMap <ushort> map, byte[][] curve) { var result = new RGB8Map(map.Width, map.Height); Parallel.For(0, result.Height, y => { var input = map.GetRow(y); var output = result.GetRow(y); for (var x = 0; x < result.Width; x++) { output.SetAndMoveNext(curve[0][input.R], curve[1][input.G], curve[2][input.B]); input.MoveNext(); } }); return(result); }
private static RGB8Map ConvertToRGB(VectorMap map, VectorToColorFilter <byte> filter) { var result = new RGB8Map(map.Width, map.Height); Parallel.For(0, map.Height, y => { var input = map.GetRow(y); var output = result.GetRow(y); for (var x = 0; x < map.Width; x++) { filter.ProcessColor(input, output); input.MoveNext(); output.MoveNext(); } }); return(result); }