2
我想將numpy數組轉換爲PIL格式,然後將其顯示爲標籤!我可以爲我的原始圖像執行此操作,但是在採用fft和fftshift後,我無法正確顯示。!ImageTk.PhotoImage無法正常顯示圖像
image1=Image.open('sam.jpg')
image1 = image1.resize((120, 120), Image.ANTIALIAS)
Labe(image=photo1).grid(row=0, column=7, columnspan=3, rowspan=2, padx=5, pady=5)
ipx1=np.array(image1)
(w,h)=ipx1.shape #120x20
現在我做一些東西與我的形象:但
img_fft=np.fft.fft2(image1)
img_shift=np.fft.fftshift(image1_fft)
img_plot1=np.log10(1+abs(img_shift))
foto=Image.fromarray((img_plot1*255.999).round().astype(np.uint8),mode='L')
photo=ImageTk.PhotoImage(foto)
Label(image=photo).grid(row=0, column=10, columnspan=4, rowspan=2, padx=5, pady=5)
代替:
我越來越:
什麼想法?
非常感謝。重新調整幫助了我! – Moj