Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Usually, images acquired by a vision system suffer from degradation that can be modelled as a convolution. For example, some images present a camera shake effect (Figure 1) or a blur due to poor focus (Figure 2). The goal of deconvolution is to cancel the effect of a convolution.

An example of motion blur (the parliament of Budapest shot by a camera).

Figure 1:An example of motion blur (the parliament of Budapest shot by a camera).

Hubble’s view of Ganymede in 1996.

Figure 2:Hubble’s view of Ganymede in 1996.

The degradation phenomenon is modelled as in Figure 3: The observed image yy is degraded by the convolution with a PSF hh and, possibly, by a noise bb (considered to be additive).

y=h∗x+by = h*x + b

The deconvolution computes a deconvolved image x^\widehat{x} from the observation yy. We will consider only linear methods, thus deconvolution comes to filtering by gg:

x^=g∗y\widehat{x} = g*y
Deconvolution model.

Figure 3:Deconvolution model.

Deconvolution needs a degradation model, thus having knowledge about both hh and bb.

Inverse filter

The inverse filter is the simplest deconvolution method. Since the degradation is modelled y=h∗x+by = h*x + b, then this equation becomes in the Fourier domain:

Y=HX+BY = HX + B

so we can write:

X=Y−BH.X = \frac{Y-B}{H}.

We obtain xx by calculating the inverse Fourier transform of the previous expression:

x=F−1[Y−BH].x = \mathcal{F}^{-1} \left[ \frac{Y-B}{H} \right].

As the noise (and therefore its spectrum BB) is unknown, we can approximate the expression of xx by cancelling BB in the previous expression, and thus get the deconvolved image:

x^=F−1[YH]\widehat{x} = \mathcal{F}^{-1} \left[ \frac{Y}{H} \right]

The result of the inverse filter applied on an image is given Figure 4. The result is not usable, and yet the observed image is very little blurred with very little noise!

Result of the inverse filter.

Figure 4:Result of the inverse filter.

The catastrophic result of the inverse filter is due to the fact of having considered the noise to be zero. Indeed, according to the definition of x^\widehat{x} and considering Y=HX+BY = HX + B, then:

x^=F−1[YH]=F−1[X+BH]=x+F−1[BH]\widehat{x} = \mathcal{F}^{-1} \left[ \frac{Y}{H} \right] = \mathcal{F}^{-1} \left[ X + \frac{B}{H} \right] = x + \mathcal{F}^{-1} \left[ \frac{B}{H} \right]

Thus, the deconvolved image x^\widehat{x} corresponds to xx with an additional term which is the inverse Fourier transform of B/HB/H. The PSF HH is generally a low-pass filter, so the values of H(m,n)H(m,n) tend towards 0 for high frequencies (m,n)(m,n). Because HH is in the denominator, this tends to drastically amplify the high frequencies of the noise, and then the term B/HB/H quickly dominates XX. This explains the result of Figure 4.

One solution consists in considering only the low frequencies of Y/HY/H. This is equivalent to truncating the result given by the inverse filter by cancelling the high frequencies before calculating the inverse Fourier transform. The result of the deconvolution is much more acceptable, as shown by Figure 5, although the result is still far from perfect (there are many variations in intensity around objects, such as tree trunks)...

Result of the truncated inverse filter with very small noise.

Figure 5:Result of the truncated inverse filter with very small noise.

Wiener Filter

Wiener filter, denoted by gg (with Fourier transform GG), applies to the observation yy such that:

x^=g∗y⇔X^=GY.\widehat{x} = g * y \qquad\Leftrightarrow\qquad \widehat{X} = GY.

This filter is established in the statistical framework: the image xx and the noise bb are considered to be random variables. They are also assumed to be statistically independent. As a result, the observation yy and the estimate x^\widehat{x} are also random variables.

The calculations are done in the Fourier domain for simplicity (since convolutions become multiplications). The goal of Wiener filter is to find the image X^=F[x^]\widehat{X} = \mathcal{F}[\widehat{x}] closest to X=F[x]X = \mathcal{F}[x], in the sense of the mean squared error MSE=E[(X^−X)2]\mathrm{MSE} = \mathbb{E}\left[(\widehat{X}-X)^2\right]. Thereby :

MSE=E[(X^−X)2]=E[(GY−X)2]=E[(G(HX+B)−X)2]=E[((GH−I)X+GB)2]\begin{align*} \mathrm{MSE} &= \mathbb{E}\left[(\widehat{X}-X)^2\right] \\ &= \mathbb{E}\left[(GY-X)^2\right] \\ &= \mathbb{E}\left[\big(G(HX+B)-X\big)^2\right] \\ &= \mathbb{E}\left[\big((GH-I)X+GB\big)^2\right] \end{align*}

where II is an image filled with 1. So:

MSE=E[(GH−I)∗(GH−I)X∗X+(GH−I)∗GX∗B+G∗(GH−I)B∗X+G∗GB∗B]\mathrm{MSE} = \mathbb{E}\Big[ (GH-I)^*(GH-I)X^*X + (GH-I)^*GX^*B + G^*(GH-I)B^*X + G^*GB^*B \Big]

where ⋅∗\cdot^* denotes the conjugate of the variables. Since the expectation E\mathbb{E} is linear and only XX and BB are random variables, we can decompose the previous expression into four terms:

MSE=(GH−I)∗(GH−I) E[X∗X]+(GH−I)∗G E[X∗B]+G∗(GH−I) E[B∗X]+G∗G E[B∗B].\begin{align*} \mathrm{MSE} = & (GH-I)^*(GH-I) \,\mathbb{E}\big[X^*X\big]\\ & + (GH-I)^*G \,\mathbb{E}\big[X^*B\big]\\ & + G^*(GH-I) \,\mathbb{E}\big[B^*X\big]\\ & + G^*G \,\mathbb{E}\big[B^*B\big]. \end{align*}

Since XX and BB are independent, then the covariances E[X∗B]\mathbb{E}\big[X^*B\big] and E[B∗X]\mathbb{E}\big[B^*X\big] are zeros. Moreover, E[X∗X]\mathbb{E}\big[X^*X\big] and E[B∗B]\mathbb{E}\big[B^*B\big] are the power spectral densities denoted as SxS_x and SbS_b (the power spectral density is the expectation of the square of the modulus of the Fourier transform). So the mean squared error simplifies into:

MSE=(GH−1)∗(GH−1)Sx+G∗GSb\mathrm{MSE} = (GH-1)^*(GH-1) S_x + G^*G S_b

We look for the filter GG that minimizes the MSE, or equivalently, that cancels the derivative of MSE:

∂MSE∂G=(GH−1)∗HSx+G∗Sb=0⇔G∗H∗HSx−HSx+G∗Sb=0⇔G∗(H∗HSx+Sb)=HSx⇔G∗=HSxH∗HSx+Sb⇔G=H∗SxH∗HSx+Sb⇔G=H∗Sx∣H∣2Sx+Sb\begin{align*} & \frac{\partial \mathrm{MSE}}{\partial G} = (GH-1)^*H S_x + G^* S_b = 0 \\ \Leftrightarrow\quad &G^*H^*H S_x - H S_x + G^* S_b = 0 \\ \Leftrightarrow\quad &G^* ( H^*H S_x + S_b) = H S_x \\ \Leftrightarrow\quad &G^* = \frac{H S_x}{H^*H S_x + S_b} \\ \Leftrightarrow\quad &G = \frac{H^* S_x}{H^*H S_x + S_b} \\ \Leftrightarrow\quad &G = \frac{H^* S_x}{|H|^2 S_x + S_b} \end{align*}

Here we are, we get the expression of the Wiener filter GG! 🥳 Finally, the deconvolved image is the inverse Fourier transform of GYGY:

x^=F−1[H∗Sx∣H∣2Sx+SbY]\widehat{x} = \mathcal{F}^{-1} \Bigg[\frac{H^* S_x}{|H|^2 S_x + S_b} Y \Bigg]

We can consider that the power spectral densities SxS_x and SbS_b are constant (for SbS_b, it is necessary to assume white noise). Thus, the expression of the Wiener filter can be written

x^=F−1[H∗∣H∣2+Sb/SxY]\widehat{x} = \mathcal{F}^{-1} \Bigg[ \frac{H^*}{|H|^2 + S_b/S_x} Y \Bigg]

and the term Sb/SxS_b/S_x is replaced by a constant KK, which becomes the parameter of the method, to be set by the user.

Two remarks:

The result of Wiener filter is presented Figure 6: it is clearly much better than the inverse filter, even its truncated version!

Result of Wiener filter
(\lambda is set so that the estimation is the best in terms of MSE).

Figure 6:Result of Wiener filter (λ\lambda is set so that the estimation is the best in terms of MSE).