inputdata.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:cnn-bnn 作者: jpdz 项目源码 文件源码
def rotate_save(path):
  filepath = os.path.join(os.getcwd(),path)
  images_files = os.listdir(filepath)
  num_img = 0
  for i,image in enumerate(images_files):
    image_file =  os.path.join(filepath,image)
    try:
      img = ndimage.imread(image_file)
      img = img[:,:,0]
      new_im = img.fromarray(img)
      for j in range(0,360,72):
        im = new_im.rotate(j)
        filename = "%s%05d.png"%(path,num_img)
        im.save(filename)
        num_img+=1
    except Exception as e:
      print('Could not read:', image_file, ':', e, '- it\'s ok, skipping.')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号