def printcoords(): File = filedialog.askopenfilename(parent=root, initialdir="C:/", title='Choose an image.') pic = func.hw1(File) pic.Roberts() filename = ImageTk.PhotoImage(Image.open('result/Roberts.gif')) canvas.image = filename # <--- keep reference of your image canvas.create_image(0, 0, anchor='nw', image=filename)
def printcoords(): l1.config(text='PLS WAIT') # l2.config(text='PLS WAIT') global kernal_size global sigma File = filedialog.askopenfilename(title='Choose an image.') pic = func.hw1(File) pic.Median_filter(kernal_size) filename = ImageTk.PhotoImage(Image.open('result/Median.gif')) canvas.image = filename # <--- keep reference of your image canvas.create_image(0, 0, anchor='nw', image=filename) l1.config(text='Pls input kernal_size')
def xz(): filenames = tkinter.filedialog.askopenfilenames() if len(filenames) != 0: string_filename = "" for i in range(0, len(filenames)): string_filename += str(filenames[i]) lb.config(text="please wait for a moment") hw = func.hw1(string_filename) hw.Gaussian() img = cv2.imread('result/Gaussian.png') cv2.imshow('Gaussian Filter', img) lb.config(text="The File hase been shown" + string_filename) else: lb.config(text="您没有选择任何文件")