Matplotlib rotate image file by X degrees

后端 未结 4 1143
野的像风
野的像风 2020-12-19 06:19

How can I rotate an image file and plot it in matplotlib?

I know I can open it using PIL and rotate it, but this seems way too much for this simple function, that I\

4条回答
  •  忘掉有多难
    2020-12-19 06:48

    you could use the following code, which I found here:

    How can I rotate a matplotlib plot through 90 degrees?

    from matplotlib import pyplot, image
    import scipy
    
    img = scipy.misc.lena()
    tr = scipy.ndimage.rotate(img,45)
    imshow(tr)
    

提交回复
热议问题