Beispiel #1
0
        private void nonUniformFiltersToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }

            //copy Undo Image
            imgUndo = img.Copy();

            WeightMatrix wm = new WeightMatrix();

            if (wm.ShowDialog() == DialogResult.OK)
            {
                float[,] mat = { { Convert.ToInt32(wm.topleft.Text),
                                   Convert.ToInt32(wm.top.Text),
                                   Convert.ToInt32(wm.topright.Text) },
                                 { Convert.ToInt32(wm.left.Text),
                                   Convert.ToInt32(wm.middle.Text),
                                   Convert.ToInt32(wm.right.Text) },
                                 { Convert.ToInt32(wm.bttmleft.Text),
                                   Convert.ToInt32(wm.bottom.Text),
                                   Convert.ToInt32(wm.bttmright.Text) } };
                ImageClass.NonUniform(img, img.Copy(), mat, Convert.ToInt32(wm.weight.Text));
            }
            else
            {
                return;
            }
            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh(); // refresh image on the screen
        }
Beispiel #2
0
        private void MeanToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form1 Gui = new Form1();

            Gui.ShowDialog();

            float[,] matrix = Gui.matrix;
            float weight = Gui.weight_T;



            if (img == null) // verify if the image is already opened
            {
                return;
            }

            //copy Undo Image
            imgUndo = img.Copy();

            Image <Bgr, Byte> imgCopy = img.Clone();

            ImageClass.NonUniform(img, imgCopy, matrix, weight);

            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();    // refresh image on the screen

            Cursor = Cursors.Default; // normal cursor
        }
Beispiel #3
0
        private void nonUniformToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }
            Cursor = Cursors.WaitCursor; // clock cursor

            WeightForm weightForm = new WeightForm();

            weightForm.ShowDialog();
            bool okay = weightForm.getFormStatus();

            //copy Undo Image
            imgUndo = img.Copy();
            Image <Bgr, Byte> imgCopy = img.Copy();

            if (okay)
            {
                ImageClass.NonUniform(img, imgCopy, weightForm.getMatrix(), weightForm.getMatrixWeight());
            }

            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();    // refresh image on the screen

            Cursor = Cursors.Default; // normal cursor
        }
        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);
        }
Beispiel #5
0
        private void nonUniformToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Weight_Matrix Matrix = new Weight_Matrix();

            Matrix.ShowDialog();



            ImageClass.NonUniform(img, img, Matrix.matrix, Matrix.matrixWeight);
        }
Beispiel #6
0
        private void nonUniformMeanToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null)
            {
                return;
            }
            Cursor          = Cursors.WaitCursor;
            imgCopy         = img.Copy();
            float[,] matrix = new float[3, 3];

            InputForm inputForm = new InputForm();

            inputForm.b1.Value = 1;

            inputForm.ShowDialog();
            float b1           = (float)(inputForm.b1.Value);
            float b2           = (float)(inputForm.b2.Value);
            float b3           = (float)(inputForm.b3.Value);
            float b4           = (float)(inputForm.b4.Value);
            float b5           = (float)(inputForm.b5.Value);
            float b6           = (float)(inputForm.b6.Value);
            float b7           = (float)(inputForm.b7.Value);
            float b8           = (float)(inputForm.b8.Value);
            float b9           = (float)(inputForm.b9.Value);
            float matrixWeight = (float)(inputForm.weightB.Value);


            matrix[0, 0] = b1;
            matrix[1, 0] = b2;
            matrix[2, 0] = b3;
            matrix[0, 1] = b4;
            matrix[1, 1] = b5;
            matrix[2, 1] = b6;
            matrix[0, 2] = b7;
            matrix[1, 2] = b8;
            matrix[2, 2] = b9;

            ImageClass.NonUniform(img, imgCopy, matrix, matrixWeight);

            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();

            Cursor = Cursors.Default;
        }
        private void nonUniformToolStripMenuItem_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();
            Matrix form = new Matrix();

            form.ShowDialog();

            float matrixWeight;



            float [,] matrix = new float[3, 3];
            if ((matrixWeight = Convert.ToInt64(form.textBox10.Text)) != 0)
            {
                matrix[0, 0] = Convert.ToInt32(form.textBox1.Text);
                matrix[0, 1] = Convert.ToInt32(form.textBox2.Text);
                matrix[0, 2] = Convert.ToInt32(form.textBox3.Text);
                matrix[1, 0] = Convert.ToInt32(form.textBox4.Text);
                matrix[1, 1] = Convert.ToInt32(form.textBox5.Text);
                matrix[1, 2] = Convert.ToInt32(form.textBox6.Text);
                matrix[2, 0] = Convert.ToInt32(form.textBox7.Text);
                matrix[2, 1] = Convert.ToInt32(form.textBox8.Text);
                matrix[2, 2] = Convert.ToInt32(form.textBox9.Text);
                matrixWeight = Convert.ToInt64(form.textBox10.Text);

                ImageClass.NonUniform(img, imgUndo, matrix, matrixWeight);


                ImageViewer.Image = img.Bitmap;
                ImageViewer.Refresh(); // refresh image on the screen
            }
            Cursor = Cursors.Default;  // normal cursor
        }
Beispiel #8
0
        private void NonUniformToolStripMenuItem_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();

            Form1 form = new Form1();

            form.ShowDialog();

            ImageClass.NonUniform(img, imgUndo, form.matrix, form.weight);

            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();    // refresh image on the screen

            Cursor = Cursors.Default; // normal cursor
        }