/// <summary> /// This method launches the creation of a QR Code. /// </summary> static public void LancementQRCode() { Fractale_image_cache testoune = new Fractale_image_cache(); Console.Write("Entrez votre message :"); string message = Console.ReadLine(); while (message.Length > 25) { Console.WriteLine(); Console.Write("C'est trop long ! Entrez votre message :"); message = Console.ReadLine(); } QRCode Test1QRCode = new QRCode("HELLO WORLD"); Pixel2[,] recupTest = Test1QRCode.TestFonctionnement(); Pixel2[,] recupTemp = new Pixel2[recupTest.GetLength(0), recupTest.GetLength(1)]; int a = recupTest.GetLength(0); for (int i = 0; i < recupTest.GetLength(0); i++) { for (int j = 0; j < recupTest.GetLength(1); j++) { recupTemp[i, j] = new Pixel2(recupTest[a - 1 - i, j].Blue, recupTest[a - 1 - i, j].Green, recupTest[a - 1 - i, j].Red); } } testoune.From_fractale_toFile(recupTemp, "./Images/TEST211.bmp"); Console.ReadKey(); }
static void Main(string[] args) { MyImage a = new MyImage("./Images/lena.bmp"); //Pixel2[,] Mat3 = a.negatif(); //Pixel2[,] Mat4 = a.Rotation180(); //Pixel2[,] Mat5 = a.Inverser_Image_axe_ordonnee(); //Pixel2[,] Mat6 = a.Rotation90(); //Pixel2[,] Mat7 = a.Inverser_Image_axe_abscisse(); //Pixel2[,] Mat8 = a.Rotation270(); Pixel2[,] Mat9 = a.Aggrandissement(2); Pixel2[,] Mat10 = a.rotate_with_angles(0); Pixel2[,] Mat11 = a.reduction(2); Pixel2[,] mat = new Pixel2[a.M.Matrix.GetLength(0), a.M.Matrix.GetLength(1)]; byte[,] convolution = new byte[3, 3] { { 0, 1, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }; Pixel2[,] Mat12 = a.bleutage(); for (int i = 0; i < a.M.Matrix.GetLength(0); i++) { for (int j = 0; j < a.M.Matrix.GetLength(1); j++) { mat[i, j] = new Pixel2(a.M.Matrix[i, j].Blue, a.M.Matrix[i, j].Green, a.M.Matrix[i, j].Red); } } a.From_Image_To_File(Mat9, "./Images/Test027.bmp"); Console.ReadLine(); }
/*/// <summary> * /// function which contains the first batch of test of bitmap * /// it is here to verify the result of every functions * /// </summary> * //static void bitmap_function_test() * //{ * * // Bitmap a = new Bitmap("Images\\coco.bmp"); * // Graphics h = Graphics.FromImage(a); * // h.TranslateTransform((float)a.Width / 2, (float)a.Height / 2); * // h.RotateTransform(90); * * // h.TranslateTransform(-(float)a.Width / 2, -(float)a.Height / 2); * // h.DrawImage(a, new Point(0, 0)); * // RectangleF rec = new RectangleF(10.0f, 10.0f, 100.0f, 100.0f); * // Bitmap Image2 = a.Clone(rec, PixelFormat.DontCare); * // Image2.Save("./Images/Test002_1.bmp"); * // for (int i = 0; i < a.Width; i++) * // for (int j = 0; j < a.Height; j++) * // { * // Color mycolor = a.GetPixel(i, j); * // a.SetPixel(i, j, Color.FromArgb(255 - mycolor.R, 255 - mycolor.R, 255 - mycolor.R)); * * // //Image2.SetPixel(i, j, Color.FromArgb(255 - mycolor.R, 255 - mycolor.R, 255 - mycolor.R)); * // } * * // //Image2.MakeTransparent(Color.Gray); * // //Image2.MakeTransparent(); * // a.Save("./Images/lenasortie3.bmp"); * * // Bitmap b = new Bitmap(a.Height, a.Width); * // Graphics g = Graphics.FromImage(b); * // g.TranslateTransform((float)a.Width / 2, (float)a.Height / 2); * // g.RotateTransform(90); * * // g.TranslateTransform(-(float)a.Width / 2, -(float)a.Height / 2); * // g.DrawImage(a, new Point(0, 0)); * * * // for (int i = 0; i < a.Width; i++) * // { * // for (int j = 0; j < a.Height; j++) * // { * // a.GetPixel(i, j); * // } * * * // } * // Console.WriteLine(); * // for (int i = 0; i < b.Width; i++) * // { * // for (int j = 0; j < b.Height; j++) * // { * // b.GetPixel(i, j); * // } * * * // } * // Console.Write(b.GetPixel(6, 7)); * * // //b.Save("Images\\Test002_1.bmp"); * // //Process.Start("Images\\lenasortie3.bmp"); * // //Process.Start("Images\\Test002_1.bmp"); * // Console.ReadLine(); * * //}*/ /// <summary> /// Function which gives an approximation of pi within a gap /// </summary> /// <param name="taille"></param> /// <returns></returns> static Pixel2[,] Approximation_PI(int taille) { int compteur_noir = 0; int compteur_noir_cercle = 0; Console.Write("Donner le nombre de points voulu : "); int nombre_iterations = verification(Console.ReadLine()); int px = taille / 2; Pixel2[,] mat = new Pixel2[taille, taille]; Random r = new Random(); int compteur = 1; for (int i = 0; i < 100; i++) { while (compteur <= nombre_iterations) { compteur++; int x = r.Next(0, taille); int y = r.Next(0, taille); if (Math.Pow(px - x, 2) + Math.Pow(px - y, 2) <= 40000) { mat[x, y] = new Pixel2(0, 0, 0); compteur_noir_cercle++; } else { mat[x, y] = new Pixel2(255, 255, 255); } compteur_noir++; } compteur = 0; } for (int i = 0; i < taille; i++) { for (int j = 0; j < taille; j++) { if (i == 0 || j == 0 || i == taille - 1 || j == taille - 1) { mat[i, j] = new Pixel2(255, 0, 0); } else { if (mat[i, j] == null) { mat[i, j] = new Pixel2(255, 255, 255); } } } } float a = 4 * ((float)(compteur_noir_cercle) / (compteur_noir)); Console.WriteLine("Nombre de points noirs total : " + compteur_noir); Console.WriteLine("Nombre de points noirs dans cercle : " + compteur_noir_cercle); Console.WriteLine("PI fist estimation : " + a); return(mat); }
public Pixel2[,] Attribution() { Pixel2[,] m = new Pixel2[1000, 1000]; return(m); }