예제 #1
0
        private void manualToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null)             // verify if the image is already opened
            {
                return;
            }
            Cursor = Cursors.WaitCursor;             // clock cursor

            InputBox form = new InputBox("Input treshold (0-255)");

            form.ShowDialog();
            int threshold = int.Parse(form.ValueTextBox.Text);

            if (threshold < 0)
            {
                threshold = 0;
            }
            else if (threshold > 255)
            {
                threshold = 255;
            }

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

            ImageClass.ConvertToBW(img, threshold);

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

            Cursor = Cursors.Default;          // normal cursor
        }
예제 #2
0
        private void binarizaçãoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }


            //copy Undo Image
            imgUndo = img.Copy();
            Cursor  = Cursors.WaitCursor; // clock cursor

            InputBox form = new InputBox("Qual o valor de Threshold?");

            form.ShowDialog();
            //float scaleFactor = (float)Convert.ToDecimal(form.ValueTextBox.Text);
            int threshold = int.Parse(form.ValueTextBox.Text);



            //apply the zoom
            ImageClass.ConvertToBW(img, threshold);


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

            Cursor = Cursors.Default; // normal cursor
        }
예제 #3
0
        private void bWToolStripMenuItem_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();

            InputBox formbw = new InputBox("Threshold?");

            formbw.ShowDialog();
            string threshold = formbw.ValueTextBox.Text;
            bool   success   = int.TryParse(threshold, out int i);

            if (success && i >= 0 && i <= 255)
            {
                ImageClass.ConvertToBW(img, i);

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

                Cursor = Cursors.Default; // normal cursor
            }
            else
            {
                MessageBox.Show("Value must be an integer from 0 to 255.", "Error",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error); // for Error
            }
        }
예제 #4
0
        private void manualBinaryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // protege de executar a função sem ainda ter aberto a imagem
            {
                return;
            }

            Cursor = Cursors.WaitCursor; // cursor relogio
            //copy Undo Image
            imgUndo = img.Copy();
            InputBox form = new InputBox("Threshold?");

            form.ShowDialog();
            int threshold = Convert.ToInt32(form.ValueTextBox.Text);

            ImageClass.ConvertToBW(img, threshold);
            ImageViewer.Refresh(); // atualiza imagem no ecrã
            Cursor = Cursors.Default;
        }
        private void thresholdToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }
            Cursor = Cursors.WaitCursor; // clock cursor
            InputBox form = new InputBox("Threshold");

            form.ShowDialog();
            int tresh = Convert.ToInt32(form.textBoxBright.Text);

            ImageClass.ConvertToBW(img, tresh);

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

            Cursor = Cursors.Default; // normal cursor
        }
예제 #6
0
        private void bWOtsuToolStripMenuItem_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.ConvertToBW_Otsu(img);
            ImageClass.ConvertToBW(img, 50);
            ImageClass.Negative(img);


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

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

            InputBox input = new InputBox("Threshold:");

            input.ShowDialog();
            int threshold = Convert.ToInt32(input.ValueTextBox.Text);

            imgUndo = img.Copy();

            ImageClass.ConvertToBW(img, threshold);

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

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

            //input boxes
            InputBox form = new InputBox("threshold?");

            form.ShowDialog();
            int threshold = Convert.ToInt32(form.ValueTextBox.Text);

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

            ImageClass.ConvertToBW(img, threshold);

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

            Cursor = Cursors.Default; // normal cursor
        }