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