Python 如何通过torch.fft分离图像的低频和高频分量?
我想通过Python 如何通过torch.fft分离图像的低频和高频分量?,python,numpy,pytorch,fft,Python,Numpy,Pytorch,Fft,我想通过torch.fft分离图像的低频和高频分量 最好给我一个这样的样品: import cv2 as cv import numpy as np img = cv.imread('messi5.jpg',0) f = np.fft.fft2(img) fshift = np.fft.fftshift(f) rows, cols = img.shape crow,ccol = rows/2 , cols/2 fshift[crow-30:crow+30, ccol-30:ccol+30]
torch.fft
分离图像的低频和高频分量
最好给我一个这样的样品:
import cv2 as cv
import numpy as np
img = cv.imread('messi5.jpg',0)
f = np.fft.fft2(img)
fshift = np.fft.fftshift(f)
rows, cols = img.shape
crow,ccol = rows/2 , cols/2
fshift[crow-30:crow+30, ccol-30:ccol+30] = 0
f_ishift = np.fft.ifftshift(fshift)
img_back = np.fft.ifft2(f_ishift)
img_back = np.abs(img_back)
为什么?在图像本身上使用LPF不是更简单吗?它不是很像拉普拉斯金字塔吗?为什么?在图像本身上使用LPF不是更简单吗?它不是很像拉普拉斯金字塔吗?