/// <summary> /// DetectEdges /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button4_Click(object sender, EventArgs e) { byte[] imageBytes = File.ReadAllBytes("woman.jpg"); //KayyaliEdgeFilter filter = new KayyaliEdgeFilter(); //KirschEdgeFilter filter = new KirschEdgeFilter(); //Laplacian3X3EdgeFilter filter = new Laplacian3X3EdgeFilter(); //Laplacian5X5EdgeFilter filter = new Laplacian5X5EdgeFilter(); //LaplacianOfGaussianEdgeFilter filter = new LaplacianOfGaussianEdgeFilter(); //PrewittEdgeFilter filter = new PrewittEdgeFilter(); //RobertsCrossEdgeFilter filter = new RobertsCrossEdgeFilter(); //ScharrEdgeFilter filter = new ScharrEdgeFilter(); SobelEdgeFilter filter = new SobelEdgeFilter(); using (MemoryStream ms = new MemoryStream(imageBytes)) { using (MemoryStream outStream = new MemoryStream()) { using (ImageFactory factory = new ImageFactory()) { factory.Load(ms).DetectEdges(filter, false).Save(outStream); Image.FromStream(outStream).Save("imageProcessor\\DetectEdges_Sobel.jpg"); } } } }
private void buttonStart_Click(object sender, EventArgs e) { ImageFactory imageFactory = new ImageFactory(); imageFactory.Load(pictureBox1.BackgroundImage); IEdgeFilter edgeFilter = new SobelEdgeFilter(); imageFactory.DetectEdges(edgeFilter, true); pictureBox1.BackgroundImage = imageFactory.Image; }