python傅里叶变化双谱重构

python傅里叶变化双谱重构
import numpy as np
import cv2 as cv
from matplotlib import pyplot as plt

img=cv.imread(r"C:\Users\Administrator\Desktop\lena.bmp", 0)
f=np.fft.fft2(img)
f_shift=np.fft.fftshift(f)

res=np.log(np.abs(f_shift))
phase=np.log(np.angle(f_shift)180/np.pi)
restructure=np.fft.ifft2(np.exp(1j
(np.angle(f))))
restructure=np.real(restructure)#因为重构恢复的信号含有虚部,故只取实部

plt.figure()
plt.subplot(221), plt.title(‘img1’), plt.imshow(img, ‘gray’)
plt.axis(‘off’)
plt.subplot(222), plt.title(‘am spectrum’), plt.imshow(res, ‘gray’)
plt.axis(‘off’)
plt.subplot(223), plt.title(‘phase spectrum’), plt.imshow(phase, ‘gray’)
plt.axis(‘off’)
plt.subplot(224), plt.title(‘restructure’), plt.imshow(restructure, ‘gray’)
plt.axis(‘off’)

plt.show()

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值