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.

Images acquired by a vision system suffer from degradation that can generally 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 obtained from the “clean” image xx degraded through convolution with a PSF hh and, possibly, by a noise bb (considered to be additive):

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

Deconvolution aims to estimate a restored image x^\widehat{x} from the observation yy. We will consider only linear methods, thus deconvolution is implemented by filtering yy by gg:

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

Figure 3:Deconvolution model.

A knowledge about the degradation model (i.e. hh and bb) is necessary to perform deconvolution.

Inverse filter

The inverse filter is the simplest deconvolution method.

The degradation model y=h∗x+by = h*x + b becomes in the Fourier domain:

Y=HX+B⇔X=Y−BH.Y = HX + B \quad\Leftrightarrow\quad 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. Consequently, the deconvolved image is defined as:

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 usableand 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 approximating the noise to be zero. Indeed, according to the definition of x^\widehat{x} and considering Y=HX+BY = HX + B:

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]

This means that the deconvolved image x^\widehat{x} corresponds to xx with an additional term equals to the inverse Fourier transform of B/HB/H. The PSF HH being generally a low-pass filter, 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.
The truncation is set so that the restored image is visually the best one.

Figure 5:Result of the truncated inverse filter with very small noise. The truncation is set so that the restored image is visually the best one.

Wiener Filter

The image restored by the Wiener filter is given by:

x^=g∗y\widehat{x} = g * y

where the Wiener filter is defined as

g=F−1[H∗∣H∣2+K]g = \mathcal{F}^{-1} \Bigg[ \frac{H^*}{|H|^2 + K} \Bigg]

and KK is a constant set by the user.

The Wiener filter is typically implemented in the Fourier domain, yielding:

x^=F−1[H∗∣H∣2+KY].\widehat{x} = \mathcal{F}^{-1} \Bigg[ \frac{H^*}{|H|^2 + K} Y \Bigg].
Proof

The Wiener filter, denoted by gg and 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\mathrm{MSE}. 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 the identity matrix. Expanding the previous expression yields:

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

where ⋅∗\cdot^* denotes the conjugate of a variable. Since the expectation E\mathbb{E} is linear and because only XX and BB are random variables, we can write 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*}

The covariances E[X∗B]\mathbb{E}\big[X^*B\big] and E[B∗X]\mathbb{E}\big[B^*X\big] are zeros because XX and BB are independent. 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 of xx and $bb (the power spectral density is the expectation of the square of the modulus of the Fourier transform). The power spectral densities are now denoted:

Sx=E[X∗X]Sb=E[B∗B].S_x = \mathbb{E}\big[X^*X\big] \qquad S_b = \mathbb{E}\big[B^*B\big].

Then the mean squared error simplifies into:

MSE=(GH−I)∗(GH−I)Sx+G∗GSb\mathrm{MSE} = (GH-I)^*(GH-I) 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−I)∗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-I)^*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*}

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.

🥳

The result of the Wiener filter is illustrated Figure 6: it is clearly much better than the inverse filter, including its truncated variant!

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).

Note that where HH vanishes (typically in high frequencies), the issue of noise amplification observed with the inverse filter is mitigated, as the constant KK in the denominator prevents the denominator to tends to 0.

Moreover, Sb=0S_b = 0 in the absence of noise, so KK can be set to zero and the Wiener filter reduces to the inverse filter:

x^=F−1[H∗∣H∣2Y]=F−1[YH].\widehat{x} = \mathcal{F}^{-1} \Bigg[ \frac{H^*}{|H|^2} Y \Bigg] = \mathcal{F}^{-1} \Bigg[ \frac{Y}{H} \Bigg].