Ich habe folgendes Problem. Ich möchte aus einem Ordner in dem mehrere Bilder enthalten sind alle in die unten dargestellte Funktion übernhemen, und dann den Namen ändern.
Ich kann aber mit dem geschriebenen Code die NAmen nicht ändern und es wird nach der Erstellung des ersten Plots, ohne abspeichern abgebrochen.
Die Fehlermeldung:
TypeError: can only concatenate list (not "str") to list
Jedoch hab ich grade keine Ahnung wie ich dieses Problem lösen kann.
Hier mein Code:
Code: Alles auswählen
import sys
sys.path.append('/usr/lib/python2.7/dist-packages/')
import cv2
from matplotlib import pyplot as plt
import glob
import multiprocessing as multi
def create_histogramm_plots(images):
#reading the image
for i in images:
img = cv2.imread(i,0)
#create the plots with subplots; first the histogramm on the left
plt.subplot(1,2,1)
plt.hist(img.ravel(),256,[0,256])
#the image on the right
plt.subplot(1,2,2)
plt.imshow(img,cmap=plt.cm.binary )
#image plot without axis
plt.axis('off')
#save the plot
outname = images[:-4]+ "_hist.png"
plt.savefig(outname)
image_list =[]
for png_file in glob.glob('/home/simon/Daten/test_10nm_10us/*.png'):
print png_file
image_list.append(png_file)
pool=multi.Pool(processes=1)
pool.map(create_histogramm_plots(image_list))
Grüße
Simon