import os
import mahotas
from PIL import Image
from pylab import *
path='all_images'
for file in os.listdir(path):
current = os.path.join(path, file)
extension = os.path.splitext(current)[-1]
fileType = extension.upper()
if os.path.isfile(current):
im = array(Image.open(current).convert('L'))
# create a new figure
figure()
# show contours with origin upper left corner
contour(im, origin='image')
axis('equal')
show() # This is showing contour image, I want to save this in the next line
mahotas.imsave(current+'.png',im)
show() 命令显示转换后的图像的图形。但之后该数字无法保存在下一行中。我想从 show 命令中保存图形。任何人都可以在这方面提供帮助吗?