I got a problem to transfer the filename from the dialog box into my Python code.I intend to do the histogram for the filename in the code
This is my code:
from SimpleCV import Image
import numpy as np
import matplotlib.pyplot as plt
from tkFileDialog import askopenfilename
filename = Image(askopenfilename(filetypes = (("Gambar", ".jpg",),("Gambar", ".png",),("Semua Fail","*.*",))))
img=Image(filename)
histogram = img.histogram(256)
len(histogram)
plt.plot(histogram)
plt.show()
should be the img=Image(filename) will call the selected file from the opened dialog box, and then it will create histogram for the selected file. But its not happening. But,If I do "print filename" then the location of the file is written in the console. Can somebody help? Thank you very much for your help.