# 2D Deconvolution in matlab

I am trying to solve the following equation for h (an [MxM matrix]):

$$k[\tau_1,\tau_2]=\sum_{i_1=0}^M \sum_{i_2=0}^M h[i_1,i_2]x[\tau_1-i_1]x[\tau_2-i_2]$$

I have k, which is a 2D [MxM] symmetric matrix & I have x which is also a 2D [MxM] symmetric toeplitz (autocorrelation) matrix.

I know this is basically a 2D deconvolution problem, but this isnt my field and I cant figure out how to do it in MATLAB.

Also, if possible I would prefer a time domain solution, but frequency domain would also work!

## Attempted Solution #1: Division in frequency domain:

h_pred=ifft(fft2(k)./fft2(x));

I think this should work, but for some reason it keeps giving me an imaginary answer!

## Attempted Solution #2: Toeplitz matrix inversion:

h_pred=inv(x)*k;

This works better, however while the recovered h_pred is much closer to the true h, it is still very far off...

1) The first equation should look like: h_pred = ifft2 ( fft2(k) ./ fft2(x) ). You have a small typo there, I believe.

Make sure you first zero-pad the kernel to the size of image.

2) MATLAB also has a blind deconvolution function: http://www.mathworks.com/help/images/ref/deconvblind.html

I don't know if you are referencing to this one, but for Toeplitz approach, I would refer to:

[1] P. C. Hansen, “Deconvolution and Regularization with Toeplitz Matrices,” Numerical Algorithms, vol. 29, no. 4, pp. 323–378, 2002.

I figured it out. The correct answer is:

$$H=X^{-1}KX^{-1}$$