http://zip.nvp.com.tw/forum.php?mod=viewthread&tid=2376&extra=page%3D13
![]() using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Drawing.Imaging; using AForge; using AForge.Imaging; using AForge.Imaging.Filters; namespace AForge_QuadrilateralTransformation_CSharp { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Bitmap sourceImage, filteredImage; Bitmap temp; List<IntPoint> corners = new List<IntPoint>(); QuadrilateralTransformation filter = new QuadrilateralTransformation(corners, 200, 200); corners.Add(new IntPoint(99, 99)); corners.Add(new IntPoint(156, 79)); corners.Add(new IntPoint(184, 126)); corners.Add(new IntPoint(122, 150)); sourceImage = (Bitmap)System.Drawing.Image.FromFile(Application.StartupPath + @"..\..\..\sample18.jpg"); if (pictureBox1.Image != null) { pictureBox1.Image.Dispose(); pictureBox1.Image = null; } if (pictureBox2.Image != null) { pictureBox2.Image.Dispose(); pictureBox2.Image = null; } temp = AForge.Imaging.Image.Clone(sourceImage, sourceImage.PixelFormat); sourceImage.Dispose(); sourceImage = temp; pictureBox1.Image = sourceImage; filteredImage = filter.Apply(sourceImage); pictureBox2.Image = filteredImage; } } } |