public Form1() { InitializeComponent(); /*int x = 800; * int y = 400; * Bitmap HEIGHT = new Bitmap(x,y); * for(int i=0;i<x;i++) * { * Console.WriteLine(i); * for (int j = 0; j < y; j++) * { * double r = (Math.Max(0, perlin(new double[] { i, j }, 42, TypeInterpolation.C2, 7, 0.01, 0.5, 4,1.2))); * HEIGHT.SetPixel(i, j, Color.FromArgb((int)(r * 255.0), (int)(r * 255.0), (int)(r * 255.0))); * } * } * HEIGHT.Save("C:/Users/benja/Desktop/cartes/rnd.bmp"); */ //Bitmap alt = (Bitmap)Bitmap.FromFile("C:/Users/benja/Desktop/cartes/resize/Alea/rndTerre.bmp"); //voisinageEau(ref alt).Save("C:/Users/benja/Desktop/cartes/resize/Alea/voisinage.bmp"); /** * string Path = "C:/Users/benja/Desktop/cartes/resize/terre/"; * Bitmap rgb = (Bitmap)Image.FromFile(Path + "couleur.jpg"); * int x = rgb.Width; * int y = rgb.Height; * Bitmap r = new Bitmap(x, y); * Bitmap g = new Bitmap(x, y); * Bitmap b = new Bitmap(x, y); * for (int i = 0; i < x; i++) * { * for (int j = 0; j < y; j++) * { * Color C = rgb.GetPixel(i, j); * r.SetPixel(i, j,Color.FromArgb(C.R,C.R,C.R)); * g.SetPixel(i, j, Color.FromArgb(C.G, C.G, C.G)); * b.SetPixel(i, j, Color.FromArgb(C.B, C.B, C.B)); * } * } * r.Save(Path + "rouge.jpg"); * g.Save(Path + "vert.jpg"); * b.Save(Path + "bleu.jpg"); **/ string Path = "C:/Users/benja/Desktop/cartes/resize/terre/"; System.IO.FileInfo[] Files = new System.IO.DirectoryInfo(@Path).GetFiles("*.jpg"); List <Bitmap> lbp = new List <Bitmap>(); foreach (System.IO.FileInfo file in Files) { lbp.Add((Bitmap)Image.FromFile(Path + file.Name)); } int x = lbp.ElementAt(0).Width; int y = lbp.ElementAt(0).Height; using (System.IO.StreamWriter file = new System.IO.StreamWriter(Path + "valeurs.csv")) { string str = ""; for (int k = 0; k < lbp.Count; k++) { str = str + System.IO.Path.GetFileNameWithoutExtension(Files.ElementAt(k).Name) + ";"; } file.WriteLine(str); for (int i = 0; i < x; i++) { for (int j = 0; j < y; j++) { str = ""; for (int k = 0; k < lbp.Count; k++) { str = str + lbp.ElementAt(k).GetPixel(i, j).R + ";"; } file.WriteLine(str); } } } }