Exemplo n.º 1
0
        private void mntsFilterReplicate(FilterReplicateHandler filterReplicate)
        {
            if (imageGrayScale == null)
            {
                return;
            }

            int             level = 3;
            FormInputFilter input = new FormInputFilter();

            input.label1.Text = "Matrix size";
            if (filterReplicate == filter1.FilterWeightedAverageReplicate || filterReplicate == filter2.FilteringLaplacianReplicate ||
                filterReplicate == filter2.FilteringSobelReplicate)
            {
                input.textBox1.Text    = "3";
                input.textBox1.Enabled = false;
            }
            input.label2.Hide();
            input.textBox2.Hide();
            input.textBox1.Text = level.ToString();
            input.ShowDialog();
            if (input.DialogResult != DialogResult.OK)
            {
                return;
            }

            int.TryParse(input.textBox1.Text, out level);

            Bitmap temp = (Bitmap)imageGrayScale.Clone();

            imageDest    = (Bitmap)imageGrayScale.Clone();
            imageDest    = filterReplicate(temp, imageDest, level);
            pbDest.Image = imageDest;
        }
Exemplo n.º 2
0
        private void mntsFilterWrapAround(FilterWrapAroundHandler filterWrapAround)
        {
            if (imageGrayScale == null)
            {
                return;
            }

            int level = 3, color = 0;
            var input = new FormInputFilter();

            input.label1.Text = "Matrix size";
            if (filterWrapAround == filter1.FilterWeightAverageWrapAround)
            {
                input.textBox1.Text    = "3";
                input.textBox1.Enabled = false;
            }
            input.textBox1.Text = level.ToString();
            input.label2.Text   = "Boder Color";
            input.textBox2.Text = color.ToString();
            input.ShowDialog();
            if (input.DialogResult != DialogResult.OK)
            {
                return;
            }

            int.TryParse(input.textBox1.Text, out level);
            int.TryParse(input.textBox2.Text, out color);

            imageDest = (Bitmap)imageGrayScale.Clone();
            Bitmap temp = (Bitmap)imageGrayScale.Clone();

            imageDest    = filterWrapAround(temp, imageDest, level, color);
            pbDest.Image = imageDest;
        }