原始图像绝对路径的图像名存储在一个txt文件中,下面的程序实现的功能是按照txt文件的顺序,依次将图片读取然后进行处理,最后将处理之后的图像保存在指定的路径下:
# Read in the image to be detected
# 原始图像均保存在binaries.txt文件中,将包含绝对目录的图像名提取出来并写到txt文件的程序见上一篇博客
f = open("/home/shenruixue/image_test/binaries.txt")
line = f.readline()
while line:
count_times += 1
line = line[:-1] # 除去末尾的换行符
print line
print '***********************************************************'
image = caffe.io.load_image(line)
# start time
start = time.clock()
# 此处做一系列的处理
# 。。。。。。
# 。。。。。。
# 此处做一系列的处理
# end time
end = time.clock()
sum_time += (end - start)
# draw the image
plt.imshow(image)
print '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
# 指定处理之后的图像的保存目录
pre_savename = '/home/shenru