private void btnOpen_Click(object sender, EventArgs e) { textBox1.Text = "0"; textBox2.Text = "0"; try { OpenFileDialog openFileDialog1 = new OpenFileDialog(); if (openFileDialog1.ShowDialog() == DialogResult.OK) { //Open the browsed image and display it string OpenedFilePath = openFileDialog1.FileName; globalpathforimage = OpenedFilePath; ImageMatrix = ImageOperations.OpenImage(OpenedFilePath); ImageOperations.DisplayImage(ImageMatrix, pictureBox1); pictureBox1.Visible = true; } txtWidth.Text = ImageOperations.GetWidth(ImageMatrix).ToString(); txtHeight.Text = ImageOperations.GetHeight(ImageMatrix).ToString(); } catch { MessageBox.Show("Please Select a photo"); } }
private void btnOpen_Click(object sender, EventArgs e) { distColorsBox1.Text = ""; distinctColorsBox2.Text = ""; ClustersNumber.Text = ""; OpenFileDialog openFileDialog1 = new OpenFileDialog(); if (openFileDialog1.ShowDialog() == DialogResult.OK) { //Open the browsed image and display it string OpenedFilePath = openFileDialog1.FileName; ImageMatrix = ImageOperations.OpenImage(OpenedFilePath); ImageOperations.DisplayImage(ImageMatrix, pictureBox1); WhiteDistButton.Enabled = true; MstQtButton.Enabled = true; ClustersNumber.Enabled = true; } else { MessageBox.Show("please open an Image"); return; } txtWidth.Text = ImageOperations.GetWidth(ImageMatrix).ToString(); txtHeight.Text = ImageOperations.GetHeight(ImageMatrix).ToString(); distColorsBox1.Text = CalculateOriginalDistinctColors(ImageOperations.GetHeight(ImageMatrix), ImageOperations.GetWidth(ImageMatrix)).ToString(); }
private void btnOpen_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); if (openFileDialog1.ShowDialog() == DialogResult.OK) { //Open the browsed image and display it string OpenedFilePath = openFileDialog1.FileName; ImageMatrix = ImageOperations.OpenImage(OpenedFilePath); ImageOperations.DisplayImage(ImageMatrix, pictureBox1); long timeBefore = Environment.TickCount; Distinct_Colors = ImageUtilities.GetDistinctColors(ImageMatrix); MST = new EagerPrimMST(Distinct_Colors); double MST_SUM = MST.GetMst(); edges = MST.Edge_To; txtDistinctColours.Text = Distinct_Colors.ToString(); txtMSTSum.Text = MST_SUM.ToString(); long timeAfter = Environment.TickCount; txtTime.Text = (timeAfter - timeBefore).ToString(); } txtWidth.Text = ImageOperations.GetWidth(ImageMatrix).ToString(); txtHeight.Text = ImageOperations.GetHeight(ImageMatrix).ToString(); }
private void btnGaussSmooth_Click(object sender, EventArgs e) { Data.clear(); double sigma = double.Parse(txtGaussSigma.Text); int maskSize = (int)nudMaskSize.Value; var watch = System.Diagnostics.Stopwatch.StartNew(); ConstructGraph.Diffcolors(ImageMatrix); MST.getMST(); //ConstructGraph.CalcDist(); var k = ExtractClusters.getKK(); txtGaussSigma.Text = k.ToString(); ExtractClusters.extractClusters(maskSize); ExtractClusters.getClustersColors(); // outPut watch.Stop(); long elapsedMs = watch.ElapsedMilliseconds; timeTxt.Text = (elapsedMs / 1000).ToString(); MSTSum.Text = Math.Round(Data.sum, 3).ToString(); TimeM.Text = (elapsedMs % 1000).ToString(); txtDiffColors.Text = Data.colorsNum.ToString(); ImageOperations.DisplayImage(ColorMapping.NewColors(ImageMatrix), pictureBox2); }
private void button1_Click(object sender, EventArgs e) { if (ImageMatrix != null) { k = Convert.ToInt32(numericUpDown1.Value); //First Create the instance of Stopwatch Class Stopwatch sw = new Stopwatch(); // Start The StopWatch ...From 000 sw.Start(); newImage = ImageOperations.createGraph(ImageMatrix, k); //Stop the Timer sw.Stop(); //Writing Execution Time in label string ExecutionTimeTaken = string.Format("Minutes: {0}\nSeconds: {1}\n Miliseconds: {2}", sw.Elapsed.Minutes, sw.Elapsed.Seconds, sw.Elapsed.TotalMilliseconds); ExecutionTimeLabel.Text = ExecutionTimeTaken; ImageOperations.DisplayImage(newImage, pictureBox2); Quantized = true; } else { MessageBox.Show("Please Select An Image First!"); } }
} /// mst // clusters private void btnGaussSmooth_Click(object sender, EventArgs e) { try { if (txtKC.Text != "0") { int Kclusters = int.Parse(txtKC.Text); Result = ImageOperations.OpenImage(globalpathforimage); GraphOperations.Kcluster(Kclusters, DistinctColors, mst); ImageOperations.DisplayImage(Result, pictureBox2); pictureBox2.Visible = true; } else { MessageBox.Show("Clusers Can't be Zero"); } } catch { MessageBox.Show("Please Select a Photo"); } }
public void Encryption_Decryption(ref RGBPixel[,] img, long initial, int tap, int length_initialseed) { int img_Height = ImageOperations.GetHeight(img); int img_Width = ImageOperations.GetWidth(img); int Shift_Length = 1 << length_initialseed; int Shift_Tap = 1 << tap; for (int i = 0; i < img_Height; i++) { for (int j = 0; j < img_Width; j++) { long initial_seed_1 = LFSR(initial, tap, length_initialseed, Shift_Tap, Shift_Length); img[i, j].red = (Byte)(img[i, j].red ^ (initial_seed_1 & 255)); long initial_seed_2 = LFSR(initial_seed_1, tap, length_initialseed, Shift_Tap, Shift_Length); img[i, j].green = (Byte)(img[i, j].green ^ (initial_seed_2 & 255)); long initial_seed_3 = LFSR(initial_seed_2, tap, length_initialseed, Shift_Tap, Shift_Length); img[i, j].blue = (Byte)(img[i, j].blue ^ (initial_seed_3 & 255)); initial = initial_seed_3; } } ImageOperations.DisplayImage(img, pictureBox2); }
private void button3_Click(object sender, EventArgs e) { Stopwatch d1 = new Stopwatch(); LFSR obj1 = new LFSR(); obj1.TapPosIndx = (int)nudMaskSize.Value; if (textBox1.Text.Length > 10) { MessageBox.Show("please enter an initial seed less than 10 characters"); } else { string seed = ImageOperations.AlphanumericSeed(textBox1.Text); obj1.Seed = Convert.ToInt64(seed, 2); //5adet el string as bits where 2 means binary int SeedLength = (textBox1.Text.Length * 6); d1.Start(); ImageMatrix = ImageOperations.Encryption(ImageMatrix, ref obj1.Seed, obj1.TapPosIndx, SeedLength); d1.Stop(); ImageOperations.DisplayImage(ImageMatrix, pictureBox2); MessageBox.Show("RunTime = " + Convert.ToString(d1.Elapsed.TotalMinutes)); } }
private void btnOpen_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); if (openFileDialog1.ShowDialog() == DialogResult.OK) { //Open the browsed image and display it string OpenedFilePath = openFileDialog1.FileName; ImageMatrix = ImageOperations.OpenImage(OpenedFilePath); Graph constructed = new Graph(); //constructed = ALL_FUNCTIONS.construct_ALL(ImageMatrix); //Graph MST=ALL_FUNCTIONS.set_MST(constructed); ImageOperations.DisplayImage(ImageMatrix, pictureBox1); int rw = ImageMatrix.GetLength(0), cl = ImageMatrix.GetLength(1); ImageMatrix_Tmp = new RGBPixel[rw, cl]; } txtWidth.Text = ImageOperations.GetWidth(ImageMatrix).ToString(); txtHeight.Text = ImageOperations.GetHeight(ImageMatrix).ToString(); distinct_colors = ALL_FUNCTIONS.get_distinct(ref ImageMatrix); //ALL_FUNCTIONS.test(); ALL_FUNCTIONS.Set_Mst(); // to handl if user input more than one cluster in same image and make operation on original image ImageMatrix_Tmp = ImageMatrix.Clone() as RGBPixel[, ]; }
private void btnOpen_Click(object sender, EventArgs e) { // intialization the tools ClusterK.Value = 0; // -> O(1) FloyedFactorNum.Value = 1; // -> O(1) NonFloyedNum.Value = 1; // -> O(1) MedianNum.Value = 1; // -> O(1) SurfaceNum.Value = 1; // -> O(1) txtMST.Text = null; // -> O(1) txtDisColor.Text = null; // -> O(1) txtGaussSigma.Text = "1"; // -> O(1) nudMaskSize.Value = 3; // -> O(1) pictureBox2.Image = null; // -> O(1) TimeLable.Text = "0 Ms"; // -> O(1) OpenFileDialog openFileDialog1 = new OpenFileDialog(); // -> O(1) if (openFileDialog1.ShowDialog() == DialogResult.OK) // -> O(1) { //Open the browsed image and display it string OpenedFilePath = openFileDialog1.FileName; // -> O(1) ImageMatrix = ImageOperations.OpenImage(OpenedFilePath); // -> O(W*H) ImageOperations.DisplayImage(ImageMatrix, pictureBox1, 0); // -> O(W*H) } txtWidth.Text = ImageOperations.GetWidth(ImageMatrix).ToString(); // -> O(1) txtHeight.Text = ImageOperations.GetHeight(ImageMatrix).ToString(); // -> O(1) }
private void btnOpen_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); if (openFileDialog1.ShowDialog() == DialogResult.OK) { //Open the browsed image and display it string OpenedFilePath = openFileDialog1.FileName; ImageMatrix = ImageOperations.OpenImage(OpenedFilePath); ImageOperations.DisplayImage(ImageMatrix, pictureBox1); } txtWidth.Text = ImageOperations.GetWidth(ImageMatrix).ToString(); txtHeight.Text = ImageOperations.GetHeight(ImageMatrix).ToString(); // Call Get Distincit to get all distincit colors from ImageMatrix QuantizationProcess.GetDistinct(ImageMatrix); //****************** Test ************************* QuantizationProcess p = new QuantizationProcess(); p.TEST(); //enter K in the Gauss Sigma's textBox int k = Convert.ToInt16(txtGaussSigma.Text); p.Cluster(k); p.replaceWithPaletteColors(ImageMatrix); ImageOperations.DisplayImage(ImageMatrix, pictureBox2); // ******************** TEST TEST ******************** }
private void btnOpen_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); if (openFileDialog1.ShowDialog() == DialogResult.OK) { //Open the browsed image and display it string OpenedFilePath = openFileDialog1.FileName; ImageMatrix = ImageOperations.OpenImage(OpenedFilePath); ImageOperations.DisplayImage(ImageMatrix, pictureBox1); } txtWidth.Text = ImageOperations.GetWidth(ImageMatrix).ToString(); txtHeight.Text = ImageOperations.GetHeight(ImageMatrix).ToString(); string K = TextBoxK.Text; k = System.Convert.ToInt32(K); long timeBefore = System.Environment.TickCount; Nodes = ImageOperations.FillGraph(ImageMatrix); NewEdges = ImageOperations.MST(ImageOperations.Globals.distinct, Nodes); long timeAfter = System.Environment.TickCount; ImageOperations.Globals.Time = timeAfter - timeBefore; MST_txt.Text = ImageOperations.Globals.sum.ToString(); //k = ImageOperations.NumOfClusters(NewEdges); Distinct_txt.Text = ImageOperations.Globals.distinct.ToString(); }
private void btnOpen_Click(object sender, EventArgs e) { Stopwatch s = new Stopwatch(); s.Start(); OpenFileDialog openFileDialog1 = new OpenFileDialog(); if (openFileDialog1.ShowDialog() == DialogResult.OK) { //Open the browsed image and display it string OpenedFilePath = openFileDialog1.FileName; ImageMatrix = ImageOperations.OpenImage(OpenedFilePath); ImageOperations.DisplayImage(ImageMatrix, pictureBox1); txtWidth.Text = ImageOperations.GetWidth(ImageMatrix).ToString(); txtHeight.Text = ImageOperations.GetHeight(ImageMatrix).ToString(); } else if (ImageMatrix != null) { txtWidth.Text = ImageOperations.GetWidth(ImageMatrix).ToString(); txtHeight.Text = ImageOperations.GetHeight(ImageMatrix).ToString(); } else { MessageBox.Show(" Choose Image "); } s.Stop(); txtTime.Text = Convert.ToString(s.Elapsed); }
private void btnOpen_Click(object sender, EventArgs e) { total = 0; OpenFileDialog openFileDialog1 = new OpenFileDialog(); if (openFileDialog1.ShowDialog() == DialogResult.OK) { //Open the browsed image and display it string OpenedFilePath = openFileDialog1.FileName; ImageMatrix = ImageOperations.OpenImage(OpenedFilePath); ImageOperations.DisplayImage(ImageMatrix, pictureBox1); } txtWidth.Text = ImageOperations.GetWidth(ImageMatrix).ToString(); txtHeight.Text = ImageOperations.GetHeight(ImageMatrix).ToString(); //////// measuring time //////// var watch = System.Diagnostics.Stopwatch.StartNew(); double answer = ImageOperations.ConstructGraph(ImageMatrix); watch.Stop(); var elapsedSec = (watch.ElapsedMilliseconds) / 1000.0; total += elapsedSec; //////////////////////////////// Colors.Text = ImageOperations.numColors.ToString(); Costs.Text = answer.ToString(); }
private void btnGaussSmooth_Click(object sender, EventArgs e) { int.TryParse(ClustorBox.Text, out K); if (string.IsNullOrWhiteSpace(ClustorBox.Text)) { MessageBox.Show("Please enter number of cluster !"); } else if (int.Parse(ClustorBox.Text) > distinct_colors || int.Parse(ClustorBox.Text) < 1) { MessageBox.Show("Invalid number of clusters !"); } else { List <List <RGBPixel> > groups = new List <List <RGBPixel> >(); RGBPixel[, ,] Update = new RGBPixel[256, 256, 256]; double sigma = double.Parse(txtGaussSigma.Text); int maskSize = (int)nudMaskSize.Value; ALL_FUNCTIONS.Build_tree(); ALL_FUNCTIONS.buildAdjacencyList(); ALL_FUNCTIONS.CutEdges(K); groups = ALL_FUNCTIONS.cluster(K); ALL_FUNCTIONS.GetPalette(ref groups); Update = ALL_FUNCTIONS.UpdateColor(ref groups); ALL_FUNCTIONS.UpdatedMatrix(Update, ImageMatrix); ImageMatrix = ImageOperations.GaussianFilter1D(ImageMatrix, maskSize, sigma); ImageOperations.DisplayImage(ImageMatrix, pictureBox2); // Get the original image after make edition on it .. ImageMatrix = ImageMatrix_Tmp.Clone() as RGBPixel[, ]; } }
private void button1_Click(object sender, EventArgs e) { int Number = int.Parse(textBox1.Text); res = ImageOperations.Quazation_of_image(Number, ImageMatrix, textBox2, textBox3); ImageOperations.DisplayImage(res, pictureBox2); pictureBox2.Image.Save("D:\\itestcase.bmp", System.Drawing.Imaging.ImageFormat.Bmp); }
private void FloyedBtn_Click(object sender, EventArgs e) { int factor_ = (int)factor.Value; // -> O(1) RGBPixel[,] ImageFilltered; // -> O(1) ImageFilltered = FloyedDither.Floyed_Dithering(factor_, ImageMatrix); // ->>O(H * W) ImageOperations.DisplayImage(ImageFilltered, PostImage, 0); // ->>O(H * W) }
private void FloyedBtn_Click(object sender, EventArgs e) { int factor = (int)FloyedFactorNum.Value; // -> O(1) RGBPixel[,] ImageFilltered; // -> O(1) ImageFilltered = FloyedDither.Floyed_Dithering(factor, ImageMatrix); // ->>O(H * W) ImageOperations.DisplayImage(ImageFilltered, pictureBox2, 0); // ->>O(H * W) }
private void btnGaussSmooth_Click(object sender, EventArgs e) { double sigma = double.Parse(txtGaussSigma.Text); int maskSize = (int)nudMaskSize.Value; ImageMatrix = ImageOperations.GaussianFilter1D(ImageMatrix, maskSize, sigma); ImageOperations.DisplayImage(ImageMatrix, pictureBox2); }
private void NonFloyedBtn_Click(object sender, EventArgs e) { int factor = (int)NonFloyedNum.Value; // -> O(1) RGBPixel[,] ImageFilltered; // -> O(1) ImageFilltered = AtkinsonDither.Atkinson_Dithering(ImageMatrix, factor); // ->>O(H * W) ImageOperations.DisplayImage(ImageFilltered, pictureBox2, 0); // -> O(1) }
private void btnOpen_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); if (openFileDialog1.ShowDialog() == DialogResult.OK) { MST_value.Text = ""; li.Clear(); // Delete Old Distict Color for (int i = 0; i < 256; i++) // Set All Color False (255 , 255 , 255) { for (int j = 0; j < 256; j++) { for (int k = 0; k < 256; k++) { RGB[i, j, k] = new RGBPixel(255, 255, 255); } } } //Open the browsed image and display it string OpenedFilePath = openFileDialog1.FileName; ImageMatrix = ImageOperations.OpenImage(OpenedFilePath); int height = ImageOperations.GetHeight(ImageMatrix); int width = ImageOperations.GetWidth(ImageMatrix); RGBPixel False_cmp = new RGBPixel(255, 255, 255); bool check_false_cmp = false; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { // if Image Have Color (255 ,255,255) if (ImageMatrix[i, j].red == 255 && ImageMatrix[i, j].green == 255 && ImageMatrix[i, j].blue == 255) { if (!check_false_cmp) { check_false_cmp = true; RGB[ImageMatrix[i, j].red, ImageMatrix[i, j].green, ImageMatrix[i, j].blue] = new RGBPixel(ImageMatrix[i, j].red, ImageMatrix[i, j].green, ImageMatrix[i, j].blue); li.Add(ImageMatrix[i, j]); } } else if (RGB[ImageMatrix[i, j].red, ImageMatrix[i, j].green, ImageMatrix[i, j].blue] == False_cmp) { RGB[ImageMatrix[i, j].red, ImageMatrix[i, j].green, ImageMatrix[i, j].blue] = new RGBPixel(ImageMatrix[i, j].red, ImageMatrix[i, j].green, ImageMatrix[i, j].blue); li.Add(ImageMatrix[i, j]); } } } ImageOperations.DisplayImage(ImageMatrix, pictureBox1, RGB); txtWidth.Text = ImageOperations.GetWidth(ImageMatrix).ToString(); txtHeight.Text = ImageOperations.GetHeight(ImageMatrix).ToString(); txtDistinctColor.Text = li.Count.ToString(); txtGaussSigma.Text = "1"; } }
private void button1_Click(object sender, EventArgs e) { int position = Convert.ToInt32(this.textBox2.Text); string seed = Seed.Text; BitArray intSeed = ImageOperations.convert(seed); ImageOperations.EncodeAndDecode(ref ImageMatrix, intSeed, position); ImageOperations.DisplayImage(ImageMatrix, pictureBox2); }
private void btnGaussSmooth_Click(object sender, EventArgs e) { double sigma = double.Parse(txtGaussSigma.Text); // -> O(1) int maskSize = (int)nudMaskSize.Value; // -> O(1) RGBPixel[,] ImageFilltered = ImageMatrix; // -> O(1) ImageFilltered = ImageOperations.GaussianFilter1D(ImageMatrix, maskSize, sigma); //-> O(W*H) ImageOperations.DisplayImage(ImageFilltered, pictureBox2, 0); //-> O(W*H) }
private void btnGaussSmooth_Click(object sender, EventArgs e) { int tap = Int16.Parse(txtGaussSigma.Text); //ϴ(1) string seed = textBox1.Text; //ϴ(1) // start stopwatch Stopwatch stopWatch = new Stopwatch(); // ϴ(1) stopWatch.Start(); // ϴ(1) TimeSpan ts; // ϴ(1) string elapsedTime; // ϴ(1) RGBPixel[,] image3 = new RGBPixel[ImageMatrix.GetLength(0), ImageMatrix.GetLength(1)]; // ϴ(1) Array.Copy(ImageMatrix, image3, ImageMatrix.GetLength(0) * ImageMatrix.GetLength(1)); // ϴ(N^2) where n is the largest between width and height ImageMatrix = ImageOperations.encrypt(ImageMatrix, tap, seed); // ϴ(N^2) where n is the largest between width and height ImageOperations.DisplayImage(ImageMatrix, pictureBox2); // ϴ(N^2) where n is the largest between width and height ts = stopWatch.Elapsed; // ϴ(1) // Format and display the TimeSpan value. elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10); // ϴ(1) label10.Text = elapsedTime; // ϴ(1) PriorityQueue redQ = new PriorityQueue(); // ϴ(1) PriorityQueue greenQ = new PriorityQueue(); // ϴ(1) PriorityQueue blueQ = new PriorityQueue(); // ϴ(1) ImageOperations.getFrequency(ImageMatrix, redQ, greenQ, blueQ); // ϴ(N^2) where n is the largest between width and height Huffman huffmanRed = new Huffman(redQ); // ϴ(n log n) where n is the largest between width and height Huffman huffmanGreen = new Huffman(greenQ); // ϴ(n log n) where n is the largest between width and height Huffman huffmanBlue = new Huffman(blueQ); // ϴ(n log n) where n is the largest between width and height double originalSize = ImageMatrix.GetLength(0) * ImageMatrix.GetLength(1) * 8 * 3; // ϴ(1) double compressedSize = huffmanRed.getCompressedSize() + huffmanGreen.getCompressedSize() + huffmanBlue.getCompressedSize(); // ϴ(1) double compressionRatio = (compressedSize / originalSize) * 100; // ϴ(1) compressRatio.Text = compressionRatio + "%"; // ϴ(1) Compression.compress(ImageMatrix, huffmanRed, huffmanGreen, huffmanBlue, seed, short.Parse(txtGaussSigma.Text)); // ϴ(N^2) where n is the largest between width and height ts = stopWatch.Elapsed; // ϴ(1) // Format and display the TimeSpan value. elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10); // ϴ(1) label12.Text = elapsedTime; // ϴ(1) RGBPixel[,] ImageMatrix2 = Compression.decompress("compressEncode.bin"); // ϴ(N^2) where n is the largest between width and height ImageOperations.DisplayImage(ImageMatrix2, pictureBox3); // ϴ(N^2) where n is the largest between width and height ts = stopWatch.Elapsed; // ϴ(1) // Format and display the TimeSpan value. elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10); // ϴ(1) label11.Text = elapsedTime; // ϴ(1) stopWatch.Stop(); // ϴ(1) }
private void btnGaussSmooth_Click(object sender, EventArgs e) { double sigma = (double)factor.Value; // -> O(1) int maskSize_ = (int)maskSize.Value; // -> O(1) RGBPixel[,] ImageFilltered = ImageMatrix; // -> O(1) ImageFilltered = ImageOperations.GaussianFilter1D(ImageMatrix, maskSize_, sigma); //-> O(W*H) ImageOperations.DisplayImage(ImageFilltered, PostImage, 0); //-> O(W*H) }
private void metroButton2_Click(object sender, EventArgs e) { // Graph g = new Graph(); g = new Graph(); g.Costruct_MST(ImageMatrix); // DistinctColors.Text = g.Distinct.Count.ToString(); g.Clustering(int.Parse(Clusters.Text.ToString()), ref ImageMatrix); ImageOperations.DisplayImage(ImageMatrix, pictureBox2); // pictureBox2.Image.Save("D:\\Islamic\\[TEMPLATE] ImageQuantization\\My.bmp", ImageFormat.Bmp); }
private void Operations() { numberofcolor.Text = ImageOperations.Get_Number_of_color(ImageMatrix).ToString(); MST mst = ImageOperations.MST_Weight(ImageMatrix); MST_Sum.Text = mst.Weight.ToString(); RGBPixelD[,,] pallete = ImageOperations.Extract_color_palette(mst, Convert.ToInt32(clusterTxT.Text)); ImageOperations.Quntization(ImageMatrix, pallete); ImageOperations.DisplayImage(ImageMatrix, pictureBox2); }
private void button1_Click(object sender, EventArgs e) { long timeBefore = System.Environment.TickCount; ImageMatrix = ImageOperations.decompression("", ref isEncrypted, ref tap, ref Initial_seed); // MessageBox.Show(isEncrypted + " " + tap + " " + Initial_seed); long timeAfter = System.Environment.TickCount; textBox1.Text = (timeAfter - timeBefore).ToString(); ImageOperations.DisplayImage(ImageMatrix, pictureBox2); }
private void button1_Click(object sender, EventArgs e) { int K = Convert.ToInt32(textBox1.Text.ToString()); distinct_colors c = new distinct_colors(); c.get_colors(ImageMatrix); MessageBox.Show(c.count.ToString()); MST tree = new MST(c.count, c.colors); tree.MST_Construct(); tree.total_cost(); double d = tree.cost; MessageBox.Show(d.ToString()); Cluster cc = new Cluster(tree.L, c.colors, K); cc.function(); cc.Color_Pallette(); cc.Quantize_the_image(ImageMatrix); //---------------------------------------------------------- double sigma = double.Parse(txtGaussSigma.Text); int maskSize = (int)nudMaskSize.Value; //ImageMatrix = ImageOperations.GaussianFilter1D(ImageMatrix, maskSize, sigma); ImageOperations.DisplayImage(ImageMatrix, pictureBox2); //---------------------------------------------------------- //------------------------------------------------- var fd = new SaveFileDialog(); fd.Filter = "Bmp(*.BMP;)|*.BMP;| Jpg(*Jpg)|*.jpg"; fd.AddExtension = true; if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { switch (System.IO.Path.GetExtension(fd.FileName).ToUpper()) { case ".BMP": pictureBox2.Image.Save(fd.FileName, System.Drawing.Imaging.ImageFormat.Bmp); break; case ".JPG": pictureBox2.Image.Save(fd.FileName, System.Drawing.Imaging.ImageFormat.Jpeg); break; case ".PNG": pictureBox2.Image.Save(fd.FileName, System.Drawing.Imaging.ImageFormat.Png); break; default: break; } } //------------------------------------------------- }
private void btnOpen_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); if (openFileDialog1.ShowDialog() == DialogResult.OK) { //Open the browsed image and display it string OpenedFilePath = openFileDialog1.FileName; ImageMatrix = ImageOperations.OpenImage(OpenedFilePath); ImageOperations.DisplayImage(ImageMatrix, pictureBox1); } }