# How to restore an image from its filter output?

I'm wondering if there is a way that I can reconstruct an image, given the output vector obtained from the convolution with a certain filter.

For example I convolve my image with a filter from MR8 filter bank, so I got a feature vector v. Which is :

v = img ** filter


so can I define a function that takes v and filter as an input, and restores the img with a certain error ?

img_restored = reconstruct(filter,v);


## What have I tried

I searched for deconvolution, I found two things :

1. Wiener Deconvolution : But it only works for de-blurring (I guess)
2. deconv() function of MATLAB, but it takes two vectors as inputs, and gives one -complex- number as output.

## Edit

Another approach could be storing all feature vectors for pixels (centers of sliding windows) and try to restore only a single pixel, then obtain an image by concatenating these pixels.

Thanks for any help !

• In general, it is mathematically impossible to invert a filter like you're trying to do. – Aaron May 12 '14 at 18:58
• @Aaron I'm tolerating any type of error term. I think it should be possible to invert it with an error. Is it not ? – jeff May 13 '14 at 9:21

This type of problem is called deconvolution.

There are several approaches to tackle it, including Wiener filtering (another name for Wiener deconvolution), but there are many of them. Wiener filtering is not reserved to deblurring: it is to cancel linear degradation operators.

As remarked by Aaron, it is very often an ill-posed problem and additional knowledge is required to find a good solution. A classical approach very popular today is to use a regularized inverse problem approach. The problem is stated as the sum of two terms $E(x) = d(Ax, y) + \lambda r(x)$:

1. $x$ is the variable;
2. $A$ is the degradation operator (the forward convolution);
3. $d(Ax,y)$ is a distance (for example, Euclidean distance) between the degradation of the current solution with respect to the observation $y$. It is called a data term;
4. $r(x)$ is a prior or regularization term that penalizes solutions $x$ that have a bad shape (usually, solutions $x$ that are not regular enough);
5. $\lambda$ is some weight that balances the effect of the two constraints.

Then, a good solution $x^\star$ is found by minimizing the functional $E(x)$.

See for example this paper for an application of this approach to sparse approximations.

• Please, fix typo: $\lambda* => $\lambda\$. – Gluttton Aug 26 '16 at 17:47

Consider the sequences [2 0 2 0 2 0 2 0] and [1 1 1 1 1 1 1 1]. When you filter these with the filter [1/2 1/2] both become [1 1 1 1 1 1 1 1].

In general, there are many input sequences that all filter to the same output. If you want to invert it you need some way of choosing which of those inputs is the one you want.