On 2 Apr., 08:28, "Terry Duell" <[email protected]> wrote:

> To see just what one could expect if one had correctly aligned blurred and  
> sharp images, I concocted a sharp image, used gimp to add motion blur and  
> then used Octave to find the psf and then apply it to sharpen the blurred  
> test image.

> The results are not good, and may well be due to errors in my process.
> For those interested in exploring this a bit further, I have attached some  
> small (10x10) test images and result of the attempt to de-blur, and also  
> the Octave script file.

I have some thoughts on the matter, not sure if they're helpful, but
have them anyway. Pardon me for not having read the octave script (I'd
have to learn octave first...)

your test image is 10x10. This is an unusual choice for a matrix to be
subjected to an FFT, and the underlying algorithm may well pad it with
zeroes up to the next power of two (16x16). Maybe feed a 16x16 in?

Your test image has sharp discontinuities which seem to jump from zero
to maximum. This may be asking too much. Did you try to recover the
original image doing an IFFT after the FFT to make sure the double
transform keeps all information?

When I did stuff along these lines, I found it more instructive not to
do the convolution in the frequency domain (so, don't do the FFT, just
do the convolution). A 10 square or 16 square image is peanuts, you
can go quite a bit larger and it'll still take next to no time.
Another advantage of not going to the frequency domain is that you can
use any input matrix size. Once you've established a functioning
method, you can try and use it in the frequency domain. Best to add
one complication at a time - FFT/IFFT can be quite temperamental and
may do stuff you haven't anticipated, neat as the theory may sound.

Rather than trying to reconstruct the PSF that gimp has put on the
image by adding motion blur, pick a PSF yourself. You should be able
to construct one simply by taking an image all zeroes with a one in
the center and applying motion blut to it. Or you might start with
something simple like a row of ones between rows of zeroes, for a
strictly horizontal motion blur (you may need to do some normalizing).
Once you have the PSF (or, the convolution kernel), you can use it to
blur your test image and then try and deconvolve the blurred image
with it. Since you know the PSF, the blurred image, and the fact that
you used the PSF for the blur, if your deconvolution doesn't produce
the original image, then you know you have a technical problem.

If I'm not mistaken, deconvolving is an iterative process (i.e. you
have to do it repeatedly), and recovery of the source image is never
complete. Don't expect miracles. There's only so much you can do with
bad data.

To get 'real world' source and target images once you've established
the maths, I'd try and align both images (the blurred and the
unblurred one) in hugin with as many CPs as possible and optimize
well. Do a photometric optimization as well. Crop to your area of
interest and have hugin output individual wraped images. These should
be as close as they get and you can try and extract the PSF from them.

Good luck ;-)

Kay

-- 
You received this message because you are subscribed to the Google Groups 
"Hugin and other free panoramic software" group.
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/hugin-ptx

Reply via email to