Shear image (numpy.ndarray)

Robert Kern robert.kern at gmail.com
Sat Apr 27 11:40:16 EDT 2013


On 2013-04-27 12:46, Radek Machulka wrote:
> Hi,
>
> I am looking for some function that would shear my 2D numpy.ndarray array. Since
> the numpy (probably) does not provide such a functionality (numpy.roll does not
> do what I need), I hope the PIL might do the trick.
>
> Google give me page that says: 'This function (im.transform) can be used to
> scale, translate, rotate, and shear the original image.', however I was not able
> to get it work.
>
> So could anybody give me a hand how to use it (or how to shear the image in
> different way)?

You should be able to use scipy.ndimage.affine_transform() to do the job:

http://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.interpolation.affine_transform.html#scipy.ndimage.interpolation.affine_transform

If you cannot get it to work, please show us what you tried, the results you 
got, and what you expected to get. You can find the scipy mailing lists here:

http://www.scipy.org/Mailing_Lists

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list