Image deblurring is the process of removing artifacts from images. An out of focus camera or movement during the exposure can cause these artifacts. This is often modeled as a convolution of the undistorted image with a point spread function. Deblurring is the inversion of this model. Inverse problems are often solved in an iterative manner. A simple example of this will be shown in this notebook.
If the point spread function is unknown, this problem is also known as blind deconvolution. Here we assume to know the point spread function. Therefore, this problem can be easily written as an optimization problem. The loss is the root mean square error of the predicted, convolved image with the blurred image. This value is minimized with regard to the predicted sharp image.
We use TensorFlow to solve this problem. TensorFlow is similar to numpy, since it is a package with math and scientific computation functionalities. The difference is, that TensorFlow is executed lazily. That means the computation graph is completely build before the computation is actually done. This allows TensorFlow to calculate the derivative of the computation graph, which is very handy for neural networks and complex problems in general, because manually deriving a complex function is tedious and error prone.
We try out the deblurring procedure on the astronaut image from skimage. It is resized by 1/3. This makes the execution much faster. However the algorithm can be applied on much larger images in the same way.