private void nonUniformToolStripMenuItem_Click(object sender, EventArgs e) { NonUniform form = new NonUniform(); form.ShowDialog(); float matrix1 = float.Parse(form.textBox1.Text); float matrix2 = float.Parse(form.textBox2.Text); float matrix3 = float.Parse(form.textBox3.Text); float matrix4 = float.Parse(form.textBox4.Text); float matrix5 = float.Parse(form.textBox5.Text); float matrix6 = float.Parse(form.textBox6.Text); float matrix7 = float.Parse(form.textBox7.Text); float matrix8 = float.Parse(form.textBox8.Text); float matrix9 = float.Parse(form.textBox9.Text); float weight = float.Parse(form.textBox10.Text); float[,] matrix = new float[, ] { { matrix1, matrix2, matrix3 }, { matrix4, matrix5, matrix6 }, { matrix7, matrix8, matrix9 } }; if (img == null) // verify if the image is already opened { return; } Cursor = Cursors.WaitCursor; // clock cursor //copy Undo Image imgUndo = img.Copy(); switch (form.comboBox1.Text) { case "Mean 3x3": ImageClass.Mean(img, imgUndo); form.textBox1.Text = "1"; break; case "NonUniform": ImageClass.NonUniform(img, imgUndo, matrix, weight); break; case "Sobel": ImageClass.Sobel(img, imgUndo); break; } ImageViewer.Image = img.Bitmap; ImageViewer.Refresh(); // refresh image on the screen Cursor = Cursors.Default; // normal cursor //NonUniform(Image<Bgr, byte> img, Image<Bgr, byte> imgCopy, float[,] matrix, float matrixWeight); }
private void MeanToolStripMenuItem_Click(object sender, EventArgs e) { if (img == null) // verify if the image is already opened { return; } Cursor = Cursors.WaitCursor; // clock cursor //copy Undo Image imgUndo = img.Copy(); ImageClass.Mean(img, imgUndo); ImageViewer.Image = img.Bitmap; ImageViewer.Refresh(); // refresh image on the screen Cursor = Cursors.Default; // normal cursor }
private void x3MediaToolStripMenuItem_Click(object sender, EventArgs e) { if (img == null) // verify if the image is already opened { return; } //copy Undo Image imgUndo = img.Copy(); Image <Bgr, Byte> imgCopy = img.Clone(); ImageClass.Mean(img, imgCopy); ImageViewer.Image = img.Bitmap; ImageViewer.Refresh(); // refresh image on the screen Cursor = Cursors.Default; // normal cursor }