static void Main(string[] args) { Console.WriteLine(properties.ToString()); pixels = new int[properties.Width * properties.Height]; domain = new double[properties.Width, properties.Height, 2]; for (int x = 0; x < properties.Width; x++) { double mx = Auxiliary.MapDouble(x, 0, properties.Width, -2 * properties.AspectRatio, 2 * properties.AspectRatio); for (int y = 0; y < properties.Height; y++) { double my = Auxiliary.MapDouble(y, 0, properties.Height, -2, 2); domain[x, y, 0] = mx; domain[x, y, 1] = my; } } UI(); GCHandle bitsHandle = GCHandle.Alloc(pixels, GCHandleType.Pinned); Bitmap image = new Bitmap(properties.Width, properties.Height, properties.Width * 4, PixelFormat.Format32bppArgb, bitsHandle.AddrOfPinnedObject()); Console.WriteLine(properties.TimeStamp + " - Saving " + properties.Name + "..."); string text_path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Output", properties.Name + ".txt"); string image_path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Output", properties.Name + ".png"); //Console.WriteLine(text_path); //Console.WriteLine(image_path); File.WriteAllLines(text_path, properties.ToStringArray()); image.Save(image_path, ImageFormat.Png); }
public static int[] Log10Color(int[] exposure, Properties p) { Console.WriteLine(p.TimeStamp + " - Colorizing using a Log_10 algorithm."); string temp = p.Highest.ToString(); int numZeroes = temp.Length - 1; _ = Parallel.For(0, exposure.Length, i => { if (exposure[i] > 0) { double mLog = Math.Log(exposure[i], 10) / numZeroes; //dividend is the number of zeroes in the highest value in the histogram int r = (int)Math.Clamp(Auxiliary.MapDouble(mLog, 0, 1, p.From.R, p.To.R), 0, 255); int g = (int)Math.Clamp(Auxiliary.MapDouble(mLog, 0, 1, p.From.G, p.To.G), 0, 255); int b = (int)Math.Clamp(Auxiliary.MapDouble(mLog, 0, 1, p.From.B, p.To.B), 0, 255); exposure[i] = 255 << 24 | r << 16 | g << 8 | b << 0; } else { exposure[i] = 255 << 24 | 0 << 16 | 0 << 8 | 0 << 0; } }); return(exposure); }