婆罗门
精华
|
战斗力 鹅
|
回帖 0
注册时间 2011-11-24
|
邮局港剧
知道参数的高斯模糊用Wiener Hunt deconvolution可以做到非常好的效果
- import numpy as np
- import matplotlib.pyplot as plt
- import scipy.signal
- from skimage import color, data, restoration
- im_orig = color.rgb2gray(data.imread(r'R:\0.bmp'))
- gauss_sig = 20
- inp = np.zeros((gauss_sig * 6 + 1, gauss_sig * 6 + 1))
- inp[gauss_sig * 3, gauss_sig * 3] = 1
- gauss_kernel = scipy.ndimage.filters.gaussian_filter(inp, gauss_sig)
- im_gaussed = scipy.signal.convolve2d(im_orig, gauss_kernel, 'same')
- im_deconvolved = restoration.wiener(im_gaussed, gauss_kernel, 0.)
- plt.imshow(im_deconvolved,cmap=plt.cm.gray)
- plt.imsave(r'r:\orig.png', im_orig, cmap=plt.cm.gray)
- plt.imsave(r'r:\gaussed.png', im_gaussed, cmap=plt.cm.gray)
- plt.imsave(r'r:\deconvolved.png', im_deconvolved, cmap=plt.cm.gray)
复制代码
σ=20pixel的高斯滤波:
deconvolved后的图基本和原图没有区别:
仅限知道确切的高斯模糊数据,艺高人胆大的情况
不然deconvolve的时候σ设成19.9(差0.5%)都只能得到这种结果:
或是更离谱的这种
这里夸张了些,毕竟用的模糊本身就太暴力 |
|