The code is pretty close. The main problem is that the FFT of the PSF contains zeros, therefore when you divide in the deconvolution, you're dividing by zero all over the place, and you end up just looking at the noise! This is a well known issue, so when you go looking for articles or books on deconvolution, they should cover this. The easiest solution is to add a weighting factor - essentially a very small number - to the zeroes - this process is know by the term Weiner deconvolution (because the weight is often based on a Weiner filter). The downside is that it essentially blurs the result, so you need to carefully choose this value.
I've modifed your code a bit further - mostly to simplify and demonstrate how you might do an iterative Weiner deconvolution. I've done this just with LV arrays rather than Vision modules - chiefly because it's now a simple extension to move it to 3D. The left hand side of the diagram is essentially the same (except you need to normalise the PSF to sum to 1), and then I've created an event loop so you can play with the values of alpha, and the number of iterations to perform. The Weiner deconvolution is put in a separate VI (see the attached PNG). I've added code to iteratively deconvolve - basically this subtracts the result from the original image, and then performs a subsequent deconvolution on that "error" times the PSF, to improve the solution. The Swap Quadrants at the end just repositions the result.
Start with "alpha=0" and you'll see essentially the same result as you had. Now increase alpha slightly (0.00001 say) - notice the noise is eliminated, and the result begins to appear. If you keep increasing alpha, the noise keeps reducing, but the result gets more blurred. Now with alpha around 0.005, try increasing the number of iterations - even up to 5 or 50 - for the right values, you'll get a sharp image with perhaps a little ringing - this might be reduced if you zero-padded your arrays to eliminate wrap-around.
Hope this helps you get started - this is still the simplest deconvolution that "works" - look up Richardson-Lucy algorithms if you need something "better".
Cheers ~ Greg
Message Edited by GregS on 10-12-2006 07:16 PM