예제 #1
0
        private void SobelMagnitude_Click(object sender, EventArgs e)
        {
            if (img == null)
            {
                return;
            }
            tmp               = img.Clone();
            img2              = img.Clone();
            edged             = img.Clone();
            double[,] values1 = Mask.GetMask();
            double[,] values2 = Mask2.GetMask();
            Point origin1 = Mask.GetOrigin();
            Point origin2 = Mask2.GetOrigin();

            if (Mask.IsZero() == false)
            {
                MessageBox.Show("The Summition of Mask 1 is not equal 0", "Opps", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            tmp = ImageOperation.LinearFilter(img, values1, origin1.X, origin1.Y, ImageOperation.PostProcessing.ABSOLUTE);
            if (Mask2.IsZero() == false)
            {
                MessageBox.Show("The Summition of Mask 2 is not equal 0", "Opps", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            img2 = ImageOperation.LinearFilter(img, values2, origin2.X, origin2.Y, ImageOperation.PostProcessing.ABSOLUTE);

            edged             = ImageOperation.SobelEdgeMagnitude(tmp, img2, ImageOperation.PostProcessing.CUTOFF);
            pictureBox2.Image = edged.bitmap;
            generateHistogram(edged, chart2);
        }
예제 #2
0
        private void SobelHorizontal_Click(object sender, EventArgs e)
        {
            if (img == null)
            {
                return;
            }
            tmp = img.Clone();
            double[,] values = Mask.GetMask();
            Point origin = Mask.GetOrigin();

            if (Mask.IsZero() == false)
            {
                MessageBox.Show("The Summition of Mask is not equal 1 ", "Opps", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            tmp = ImageOperation.LinearFilter(img, values, origin.X, origin.Y, ImageOperation.PostProcessing.CUTOFF);
            pictureBox2.Image = tmp.bitmap;
            generateHistogram(tmp, chart2);
        }