Reputation: 1326
There is an 2D array representing an image a
and a kernel representing a pointspread function k
. scipy.signal.deconvolve
returns "objects too deep for desired array", from the internally called lfilter
function. 1D arrays are working flawlessly. How can this be fixed?
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)
Upvotes: 3
Views: 8762
Reputation: 74154
Well, that would be because scipy.signal.deconvolve()
only supports 1D deconvolution! Unfortunately the docs aren't clear on this fact.
Take a look at this answer for frequency-domain 2D deconvolution.
Upvotes: 4