On Sun, 20 Mar 2011 03:44:50 +1100, JohnG <[email protected]> wrote:
Hi all. I get really annoyed when my beautifully sharp panorama is sullied and spoilt by a bit of camera-motion-blur in just one or two of the source images ... :-(
I can't get my head around the deconvolution algorithms by which the blurred pixel values are rebuilt into not-blurred pixel, but the method may help pave the way toward support for resolution up-sampling by combining data from overlapping images ...
I have been trying to understand how one might use the overlapped portions of a blurred and sharp image to correct the blurred image. The following outlines the trials and tribulations that I have encountered. At this point of proceedings, I suspect that either I don't have a good enough understanding of the maths needed, or it is unlikely that there is a reasonable solution...or maybe even both! Firstly some background. Anyone who sees flaws in this please speak up. Like JohnG the deconvolution stuff has been troublesome.
It seems that one can describe the process, in the time domain, thus;
blur = sharp * psf
where blur = the blurred image
sharp = the sharp image
and psf = point spread function describing the blurring process, and
the * represents convolution.
Much, or all, that is writ on the subject, assumes that the sharp image is
unknown and required to be found, and hence talk of the 'latent' image
rather than the 'sharp' image as I have described it. They also add in
some noise, but given that we have both sharp and blurred images, I
believe that the noise is in both, and hence can be ignored.
It also seems that one can solve for the psf in the frequency domain, by
taking the fft (fast fourier transform) of each and simply solving as per
normal algebra.
hence, psf = ifft (fft(blur)/fft(sharp)) The ifft is the inverse fast
fourier transform.
Once one has the psf, one can (in the frequency domain) simply apply the
psf to the blur to sharpen it, so to speak.
OK, that's the theory, as I understand it. JohnG sent me some overlapping images which demonstrated his problem.The first thing that caused me trouble is that I wasn't able to get good enough alignment of even a small rectangular area of the overlap to be confident that any analysis would produce a sensible point spread function. If one can't be sure that one has pixel for pixel alignment, the resulting psf is probably not going to make a very good fist of correcting the blurred image. That's the first, and main problem, as I see it.
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.
test-image.pgm is sharp input. test-image-blur.pgm is the blurred image input test-newsharp.pgm is the result oct-do-deblurr is the Octave script file (text)The pgm are Portable Grey Map format images, which any self respecting image viewer should display. The '.'txt' versions of these files are simply the .pgm files with the header removed. The file test-newsharp.pgm has been 'normalised' to adjust the values to be between 0 and 255, to be consistent with the inputs. (I would not have expected this to have been needed, and may be an indication that the method is incorrect).
As I said, if my sums are on the right track, I doubt that a good result can be obtained. I will be interested to see comments from those that better understand this business.
Cheers, -- Regards, Terry Duell -- 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
test-image.pgm
Description: Binary data
test-image-blur.pgm
Description: Binary data
test-newsharp.pgm
Description: Binary data
oct-do-deblurr
Description: Binary data
