有一个表示图像的二维数组a
和一个表示点扩展函数的内核k
。从内部调用的函数scipy.signal.deconvolve
返回“对于所需数组来说对象太深” 。lfilter
一维阵列工作完美。如何解决这个问题?
import numpy as N
import scipy.signal as SS
# working
# taken from:
# http://stackoverflow.com/questions/17063775/convolution-and-deconvolution-in-python-using-scipy-signal
a = N.array([ 0.5, 2.5, 6. , 9.5, 11. , 10. , 9.5, 11.5, 10.5,
5.5, 2.5, 1. ])
k= N.array([0.5, 1.0, 0.5])
res1,res2 = SS.deconvolve(a, k)
# not working
a = N.ones((10,10))
k = N.array([[1,2],[2,1]])
res1, res2 = SS.deconvolve(a,k)