[SciPy-User] Can I corner pin transform an image with scipy?

Zachary Pincus zachary.pincus at yale.edu
Sat Sep 19 17:15:43 EDT 2009


Hi Gustaf,

Look at the routines in scipy.ndimage (this is the top-level namespace  
containing everything), or in scipy.ndimage.interpolation (contains  
just the interpolation routines).

Specifically, there are affine transforms (which won't be useful here  
necessarily unless you can do it with like two successive skew  
operations or something, as Chris thought might be possible) as well  
as two more general tools:
geometric_transform, which takes an image and a callable that given a  
point in the output image, calculates the corresponding point in the  
input image, and (essentially equivalent, but faster and simpler once  
you grok the inputs), map_coordinates, which takes an input image and  
an array provides a mapping from output to input coordinates.

So, if you can calculate the reverse transform you need (like with the  
math Joe sent over), you can use ndimage to do the mapping. (I use  
map_coordinates all the time for nonlinear "warping" transformations  
too -- it's very general and useful.)

Zach


On Sep 18, 2009, at 6:22 PM, Gustaf Nilsson wrote:

> Hi
> Im working on a (python)scriptable image processing tool, and have  
> found good use of scipy already doing gaussian blurs and convolves.
> One function i hope to implement is a cornerpin transform. Is this  
> something i can use scipy for? Ive tried to google it but come up  
> with nothing. Maybe you scientific fellas have a different name for  
> it? (Im just a nerdy computer graphics guy)
>
> heres a picture showing what im trying to do:
> http://help.adobe.com/en_US/AfterEffects/9.0/images/ae_01pp.png
> As you can see, I want to be able to give each corner of the picture  
> arbitrary coordinates so that it is scewed like in the example.
>
> Can i do this with scipy?
>
> Cheers
> Gustaf
>
> -- 
> ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user




More information about the SciPy-User mailing list