예제 #1
0
        private void closingToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (imageGrayScale == null)
            {
                return;
            }

            int repeat = 1;

            int objectColor = 0;

            input = new FormMorphology();
            input.ShowDialog();
            if (input.DialogResult == DialogResult.OK)
            {
                repeat      = int.Parse(input.txtMatrixSize.Text);
                objectColor = int.Parse(input.txtObjectColor.Text);
            }


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

            for (int i = 0; i < repeat; i++)
            {
                imageDest = morphology.MorphologyDilation(temp, objectColor);
                temp      = (Bitmap)imageDest.Clone();
            }
            for (int i = 0; i < repeat; i++)
            {
                imageDest = morphology.MorphologyErosion(temp, objectColor);
                temp      = (Bitmap)imageDest.Clone();
            }
            pbDest.Image = imageDest;
        }
예제 #2
0
        private void Morphology(MorphologyHandler morphology, Bitmap srcImage)
        {
            if (imageGrayScale == null)
            {
                return;
            }

            int repeat = 1;

            int objectColor = 0;

            input = new FormMorphology();
            input.ShowDialog();
            if (input.DialogResult == DialogResult.OK)
            {
                repeat      = int.Parse(input.txtMatrixSize.Text);
                objectColor = int.Parse(input.txtObjectColor.Text);
            }

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

            for (int i = 0; i < repeat; i++)
            {
                imageDest = morphology(temp, objectColor);
                temp      = (Bitmap)imageDest.Clone();
            }
        }