#实现了如下简单的功能
#1:从一个文件夹中将现有的图片的路径做成一个list
#2:根据上述做出的list,生成一个目标对象的路径以及名称并保存为list
#3:通过一个统一的操作,将现有的图片做了操作后的结果保存到我定义的路径中,并根据自己的要求进行命名
·
#- * - utf -8 -*-
# 实现了如下简单的功能
#1:从一个文件夹中将现有的图片的路径做成一个list
#2:根据上述做出的list,生成一个目标对象的路径以及名称并保存为list
#3:通过一个统一的操作,将现有的图片做了操作后的结果保存到我定义的路径中,并根据自己的要求进行命名
import numpy as np
from PIL import Image
import tensorlayer as tl
import os
import glob
def read_imagepath_to_list(imagepath):
if tl.global_flag['mode'] == "train":
#filename = os.listdir(imagepath)
data_dir = os.path.join(os.getcwd(), imagepath)
elif tl.global_flag['mode'] == "test":
pass
else:
print("mode is run, we need 'test' or 'train' ")
data = sorted(glob.glob(os.path.join(data_dir, "*.bmp"))) #in fun glob.glob() * represent everything