Scripting Resources for DigitalMicrograph™ |
Example: Convolving and Deconvolving Image Blur |
|
Function |
An example script which shows how to convolve a blur vector with an image to create a blurred image and how to deconvolve said blur, to restore the image. |
Version |
version:20220614, v1.0 |
Author |
D. R. G. Mitchell |
Acknowledgements |
Thanks to Shixin Wang for tips on FFT division. |
Comments |
Convolution and deconvolution are done here in Fourier space. Convolution involves FFT multiplication, which is straightforward. However, deconvolution uses FFT division, which can lead to divide by zero errors and heightened noise, unless handled intelligently. This script takes the front-most image and convolves with it a linear vector describing a motion blur vector. This results in a blurred image. This blurred image is then deconvolved from said vector, in order to restore the original image. |
System Requirements |
Should be compatible with all recent versions of DigitalMicrograph. |
Known Issues |
This may have applications in recovering sharp images from blur caused by drift. However, in practice, a satisfactory result can only be obtained when the angle and length of the blur vector are known very precisely. To be centro-symmetric, the blur vector has to be mutliples of two in length, and so when attempting to find an appropriate angle/length of the blur vector to deblur images, I really couldn't get a satisfactory result. In this example code, an exact match can be found. The general usefulness of this particular script is in demonstrating how to carry out intelligent FFT deconvolution. If somebody comes up with a robust method of eliminating motion blur based on this or any other method, please let me know how you achieved it. |
Supported |
Yes |
Included Files |
Main script file. |
Source Code |
See attached script |