# Estimating an Image Filter from Examples

I am sure this question must be fairly easy and could have been answered on this site but perhaps I am not finding the right keywords to search for it.

I would like to know what are the common techniques to estimate an image filter from a set of input (unfiltered) and post-filtered images. From a machine learning point of view, this seems easy to do under some assumptions and constraints. Assuming the filters are linear, we might have to estimate the parameters of a convolution kernel using an optimization algorithm such as gradient descent. A similar approach may be done for non-linear kernels assuming a suitable non-linear model. However, I have still not found lots of literature discussing this.

As such, my questions are the following: How I can perform this operation in practice, how it is typically referenced in the image processing literature, and where can I find more information about it?

• This problem is generally called model identification. It starts with a model, of course; how is the output related to the input? In the particular case of convolution filters, your problem is called deconvolution.
– Emre
Jul 20 '15 at 0:31
• What are the assumptions on the filter? Only linearity? Is it Spatial Invariant?
– Royi
Sep 19 '15 at 10:47
• @Drazick linear and spatial invariant would be a good start, and I would definitely like to know how it could be done in this case. However, I was wondering if this couldn't be cast as a learning problem for something much more general, like a convolutional network. Sep 19 '15 at 11:39

I will talk about the Linear Spatially Invariant (LSI) Model.

Since the Filter (System) is LSI it can be described in the domain of Fourier Transform:

$$Y \left( \omega \right) = H \left( \omega \right) X \left( \omega \right)$$

Where $Y \left( \omega \right)$ is the Blurred (Output) Image, $X \left( \omega \right)$ is the Input Image and $H \left( \omega \right)$ is the filter model.

Now, assuming the filter doesn't vanish in the Fourier Domain, then:

$$H \left( \omega \right) = \frac{Y \left( \omega \right)}{X \left( \omega \right)}$$

Now, to practical issues with this model:

• Noise.
• Vanishing Frequencies.

There are many methods to deal with those issues (Pseudo Inverse, Wiener Filter, Lucy Richardson) all are having different assumptions (White Noise, Gaussian Noise, Linear Model, Poisson Noise, etc...).

Till now I described the classic "Signal Processing" Model.

What you can do is build this model in the Spatial Domain.
The Filtering Operator will be a very large Toeplitz Matrix which you can estimate using LS Model or any solver for any cost function you'd want.

Practically in the world of Image Processing, the quality is in the regularization yo enforce.

P.S. There is a new community proposal in the SE network:

http://area51.stackexchange.com/proposals/86832

It would be great if you could follow, up vote question with less than 10 points and propose your own questions.

Thank You.

This question is not easy at all, and I believe that you posed it in a very understandable way.

In the first place, please take a look at the deconvolution literature.

In certain special cases, where you know that your filter is some sort of a blur kernel, you might also consider estimating point spread functions (PSF), which would make your life easier. One way to estimate the PSF is Richardson–Lucy deconvolution, which is an intuitive iterative procedure.

Photoshop's motion de-blur filters are for example based on PSFs.

Entropy minimization methods are also common approaches to this problem. There is a MATLAB example here.

I hope that these give you certain guidelines and keywords to further investigate the topic.