3

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)
Jolta
  • 2,620
  • 1
  • 29
  • 42
Faultier
  • 1,296
  • 2
  • 15
  • 21

1 Answers1

4

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.

Community
  • 1
  • 1
ali_m
  • 71,714
  • 23
  • 223
  • 298