المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Image Interpolation



C# Programming
02-24-2010, 08:31 PM
Hi I've been working on making a quadrilateral image distortion algorithm and I have managed to make it distort any image into the shape specified but I cant manage to work out how to apply even bilinear interpolation. I would like some help if anyone can, to add interpolation to my algorithm. I have included the distortion code below:

private Bitmap DistortImage(Image sourceImage,Point TopLeft, Point TopRight, Point BottomLeft, Point BottomRight)
{
int width, height; //The destination bitmap size
width = Convert.ToInt32(Math.Max(p2.X, p4.X));
height = Convert.ToInt32(Math.Max(p3.Y, p4.Y));

Bitmap dest = new Bitmap(width, height);
Bitmap src = new Bitmap(sourceImage);

//Start the loop
//Loop down the left border
for (int yStart = TopLeft.Y; yStart <span class="code-keyword">