Re: Image warping in Python or PIL

Oliver Tonnhofer <[email protected]>
Newsgroups gmane.comp.python.image
Message-ID <[email protected]>
On 08.05.2010, at 13:49, Fredrik Lundh wrote:
> The transform(MESH) operation might be what you need.
> 
>    http://effbot.org/tag/PIL.Image.Image.transform
> 
> Instead of mapping between individual pixels, cover the output image
> with a grid, and calculate the source pixels for the corners of each
> grid rectangle (forming a quadrilateral area).  Pass in the resulting
> list of (grid rectangle, quadrilateral) pairs to transform(MESH), and
> it'll take care of the rest.

That's what I used to transform maps/aerial images from one coordinate system to another. 
http://bitbucket.org/olt/mapproxy/src/142/mapproxy/core/image.py#cl-553 

> The result is (usually) an approximation, with the maximum error
> controlled by the grid resolution.

I did tests with 1500x1500px and there where no improvements beyond 8x8. The performance is really great. Even faster than GDAL which is a C library for exactly this kind of image processing.

Regards,
Oliver
_______________________________________________
Image-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/image-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.