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?
Asked
Active
Viewed 773 times
2
-
What do you want to achieve with the 2D deconvolution? (e.g. template matching?) What toolbox do you use? IPD, SIVP? Did you check `conv`, `convol`, `convol2d` functions? – Attila Apr 17 '17 at 07:02
-
I need to perform deconvolution to obtain a blur kernel from a blurred and an approximate original image. I am using SIVP. I cannot seem to find IPD in scilab 5.5 atoms package manager. – xSooDx Apr 17 '17 at 07:36
-
1I use IPD with 5.4.1 & 5.5.1, but it is not available for 5.5.2 (Pleas note: this list is not exhaustive, just the versions I have installed on my machine right now). I recommend to try 5.4.1. – Attila Apr 18 '17 at 12:11
2 Answers
2
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).
-
I had tried this, but it doesn't work so well with noisy images. Also I realised that i need to use Richardson Lucy deconvolution for my project. – xSooDx Apr 25 '17 at 07:30
-
While I don't have experience using the RL algorithm, there is a function written for it in matlab, that looks to be applicable to scilab as well, here: http://stackoverflow.com/questions/9854312/how-does-richardson-lucy-algorithm-work-code-example – rob Apr 25 '17 at 11:33
0
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)

Dikshit kumar
- 39
- 1