Resumé

Image Distortion Enhancements

Cristian Merighi () 5.00

Thanks to the contributions of Luke Jackson and Gilberto Carcano, I'm able to publish some enhancements to the quadrilateral distortion algorithm and image warping process via GDI+ APIs.
This article is obsolete. Some functionalities might not work anymore. Comments are disabled.

Hello everybody, I write this article to report feedbacks and adjustments adviced by some developers who got interested in my post about quad-point image distortion using GDI+ and its relevant algorithm.

I really appreciated the contributions from Luke Jackson of Lateral and Gilberto Carcano (a smart and passionate compatriot of mine).

Luke Jackson:
brought smoothness to the rendered image enhancing the process with bilinear interpolation.
I just want to quote an excerpt of the e-mail he sent me:
«...I have adapted your code to create 3D-style book covers for a website I am currently building. I have made some changes which you may be interested in:
1. the code does not produce a mirror image when drawing to an area outside of ABCD. therefore you don't need to mask them out after the loop.
2. the code uses bilinear interpolation when setting the value of the pixel. e.g. (0.2, 0.8) will do a weighted average of source pixels (0,0), (0, 1), (1, 0), (1, 1) instead of taking the pixel (0, 1) only.
3. the code uses alpha transparency around the edges of the image, to remove the jagged lines, and also allow the image to be placed over a background.
4. i fixed getintersection which would return a non-null point (with one of the coordinates set to + or - infinity) when two lines did not intersect...»


Here's the link to his distortion-enhanced website.

Gilberto Carcano:
he recently propounded me a more correct algorithm (see here for reference) which projects the original image onto the target quadrilateral in a perspective-respectful manner.
Veeery appreciated...

Let's see the results:

Original version:
original
Luke's version:
interpolated
Gilberto's version:
warped

Last, but not least, the pieces of code provided:

zip file « Luke's contribution (VB version included)
zip file « Gilberto's contribution

Take care. Bye.

Feedbacks

  • Re: Image Distortion Enhancements

    Josh Tuesday, September 01, 2009 5.00

    Wonderful work! Is it possible to use Gilberto's code to distort an image? The example source draws lines, and I've tried to modify it to skew an image but it only works in part. Thanks again for your great work. Superb site by the way!

feedback
 

Syndicate

Author

Cristian Merighi facebook twitter google+ youtube

Latest articles

Top rated

Archive

Where am I?

Author

Cristian Merighi facebook twitter google+ youtube

I'm now reading

Feeds