图像与卷积神经网络技术详解
1. 图像频域处理与模式识别
1.1 快速傅里叶变换中的高通滤波
高通滤波是一种去除图像低频分量的技术,通过这种方式可以得到包含图像边缘的锐化图像,从而帮助我们找到图像中的边缘。以下是实现高通滤波的具体代码:
rows, cols = imBlur.shape
crow, ccol = round(rows/2), round(cols/2)
# remove low frequencies with a rectangle size of 10
fshift[crow-10:crow+10, ccol-10:ccol+10] = 0
f_ishift = np.fft.ifftshift(fshift)
img_back = np.fft.ifft2(f_ishift)
img_back = np.abs(img_back)
plt.figure(figsize=([20, 20]))
plt.subplot(131), plt.imshow(imBlur, cmap = 'gray')
plt.title('Input Image'), plt.xticks([]), plt.yticks([])
plt.subplot(132), plt.imshow(img_back, cmap = 'gray')
plt.title('Image after HPF'), plt.xticks([]), plt.yticks([])
plt.show()
这段代码首先获取图像的行数和列数,然后找到图像的中心位置。接着,将中心附近的低频分量置为 0,再进行逆快速傅里叶变
超级会员免费看
订阅专栏 解锁全文
1万+

被折叠的 条评论
为什么被折叠?



