图片旋转 90、180、270
#scipy的版本为1.0.0
import scipy
from scipy import misc
import os
import time
import glob
from scipy import ndimage
def get_image_paths(folder):
return glob.glob(os.path.join(folder, '*.jpg'))
def create_read_img(filename):
im = misc.imread(filename)
img_rote_90 = ndimage.rotate(im, 90)
scipy.misc.imsave(filename[:-4]+'_90.jpg',img_rote_90)
img_rote_180 = ndimage.rotate(im, 180)
scipy.misc.imsave(filename[:-4]+'_180.jpg',img_rote_180)
img_rote_270 = ndimage.rotate(im, 270)
scipy.misc.imsave(filename[:-4]+'_270.jpg',img_rote_270)
print(filename)
img_path = 'USA' #这个路径是所有图片在的位置
imgs = get_image_paths(img_path)
print (imgs)
for i in imgs:
create_read_img(i)
文章来源: wanghao.blog.csdn.net,作者:AI浩,版权归原作者所有,如需转载,请联系作者。
原文链接:wanghao.blog.csdn.net/article/details/105368158
- 点赞
- 收藏
- 关注作者
评论(0)