import numpy as np
import matplotlib.pyplot as plt
import cv2
def Butterworth_Filter_Image():
img = cv2.imread(r'/Users/PycharmProjects/ImageProcess/Butterworth Filter Image/Pasted Graphic 31.png',0)
plt.imshow(img)
# ——————————————————————————————————————————————————————————————————————————————————
F_domain = np.fft.fft2(img)
F_shift = np.fft.fftshift(F_domain)
# ——————————————————————————————————————————————————————————————————————————————————
plt.figure(figsize=(8,10))
# plot loss
plt.subplot(2,2,1)
plt.imshow(np.log1p(np.abs(F_shift)), cmap='gray')
# plt.axis('off')
# plt.show()
M_shape, N_shape = img.shape
H = np.zeros((M_shape, N_shape), dtype=np.float32)
D0 = 40 # cut-off frequency
n = 2 # It is order for butterworth
for u in range(M_shape):
for v in range(N_shape):
D = np.sqrt((u -
Image process ----butterworth high pass 滤波器
最新推荐文章于 2024-08-18 12:00:23 发布