Ejemplo n.º 1
0
        private void overlapping_Load(object sender, EventArgs e)
        {
            string img = ".../.../E_I-edge.bmp";

            //read image
            Bitmap bmp = new Bitmap(img);

            pictureBox4.Image = bmp;

            pictureBox1.Image = Extraction_overlapping.ConvolutionFilter(bmp, Extraction_overlapping.xSobel, Extraction_overlapping.ySobel, 1.0, 0, true);
        }
Ejemplo n.º 2
0
        private void scrollhaha(object sender, ScrollEventArgs e)
        {
            string img = ".../.../E_I-edge.bmp";

            //read image
            Bitmap bmp = new Bitmap(img);

            Bitmap bmp1 = new Bitmap(bmp.Width, bmp.Height);
            Bitmap bmp2 = new Bitmap(bmp.Width, bmp.Height);
            Bitmap bmp3 = new Bitmap(bmp.Width, bmp.Height);

            bmp1 = Extraction_overlapping.ConvolutionFilter(bmp, Extraction_overlapping.xSobel, Extraction_overlapping.ySobel, 1.0, 0, true);

            label5.Text = "Threshold Value:  " + (255 - Convert.ToInt32(e.NewValue));

            bmp2 = Extraction_overlapping.binarization(bmp1, 255 - Convert.ToInt32(e.NewValue));

            pictureBox2.Image = bmp2;



            // overlay
            int x, y;

            // Loop through the images pixels to reset color.
            for (x = 0; x < bmp.Width; x++)
            {
                for (y = 0; y < bmp.Height; y++)
                {
                    Color pixelColor = bmp2.GetPixel(x, y);
                    Color newColor   = Color.FromArgb(100, 0, pixelColor.G, 0);
                    bmp3.SetPixel(x, y, newColor); // Now greyscale
                }
            }

            // pictureBox3.Image = bmp3;
            //    Bitmap baseImage;
            //  Bitmap overlayImage;
            //  baseImage = (Bitmap)Image.FromFile(@"C:\temp\base.jpg");
            //  overlayImage = (Bitmap)Image.FromFile(@"C:\temp\overlay.png");

            var finalImage = new Bitmap(bmp.Width, bmp.Height, PixelFormat.Format32bppArgb);
            var graphics   = Graphics.FromImage(finalImage);

            graphics.CompositingMode = CompositingMode.SourceOver;
            graphics.DrawImage(bmp, 0, 0);
            graphics.DrawImage(bmp3, 0, 0);

            //show in a winform picturebox
            pictureBox3.Image = finalImage;
        }