Reputation: 493
I want to perform a 2D deconvolution in Scilab on an Image. I can't seem to find an inbuilt function for it. Can anyone point me in the right direction?
Upvotes: 2
Views: 864
Reputation: 39
for the Deconvolution in the Scilab the Code is:-
y=[4,2,7,11,18,19,10,11,12,9,8]
h=[2,3,1,4,5,2,1]
subplot(3,1,2)
plot2d3(h)
z=%z
a=4*z^10+2*z^9+7*z^8+11*z^7+18*z^6+19*z^5+10*z^4+11*z^3+12*z^2+9*z^1+8
b=2*z^10+3*z^9+1*z^8+4*z^7+5*z^6+2*z^5+1*z^4
x=ldiv(a,b,7)
x=x'
N1=length(x)
n1=0:N1-1
subplot(3,1,3)
plot2d3(n1,x)
Upvotes: 0
Reputation: 105
This post, albeit using Matlab, provides an example of deconvolution using 2D Fourier transforms.
The general idea is the following. Zero extend both images – in case of m x m and n x n images, both should be zero padded to m+n-1 x m+n-1. Take the 2D Fourier transform of each zero extended image, divide elementwise, then take the inverse 2D Fourier transform.
The zero padding is required to prevent circular convolution.
For 2D forward transform one can use either fft2(m) or fftw(m,-1), where m is the image matrix, while for the inverse transform (called ifft2 in Matlab), one can use fftw(M,1).
Upvotes: 2