# Richardson–Lucy deconvolution

The Richardson–Lucy algorithm, also known as Lucy–Richardson deconvolution, is an iterative procedure for recovering an underlying image that has been blurred by a known point spread function. It was named after William Richardson and Leon Lucy, who described it independently.[1][2]

## Description

When an image is produced using an optical system and detected using photographic film or a charge-coupled device (CCD) for instance, it is inevitably blurred, with an ideal point source not appearing as a point but being spread out into what is known as the point spread function. Extended sources can be decomposed into the sum of many individual point sources, thus the observed image can be represented in terms of a transition matrix p operating on an underlying image:

${\displaystyle d_{i}=\sum _{j}p_{i,j}u_{j}\,}$

where ${\displaystyle u_{j}}$  is the intensity of the underlying image at pixel ${\displaystyle j}$  and ${\displaystyle d_{i}}$  is the detected intensity at pixel ${\displaystyle i}$ . In general, a matrix whose elements are ${\displaystyle p_{i,j}}$  describes the portion of light from source pixel j that is detected in pixel i. In most good optical systems (or in general, linear systems that are described as shift invariant) the transfer function p can be expressed simply in terms of the spatial offset between the source pixel j and the observation pixel i:

${\displaystyle p_{i,j}=P(i-j)}$

where P(Δi) is called a point spread function. In that case the above equation becomes a convolution. This has been written for one spatial dimension, but of course most imaging systems are two dimensional, with the source, detected image, and point spread function all having two indices. So a two dimensional detected image is a convolution of the underlying image with a two dimensional point spread function P(Δx,Δy) plus added detection noise.

In order to estimate ${\displaystyle u_{j}}$  given the observed ${\displaystyle d_{i}}$  and a known P(Δix,Δjy) we employ the following iterative procedure in which the estimate of ${\displaystyle u_{j}}$  which we call ${\displaystyle {\hat {u}}_{j}^{(t)}}$  for iteration number t is updated as follows:

${\displaystyle {\hat {u}}_{j}^{(t+1)}={\hat {u}}_{j}^{(t)}\sum _{i}{\frac {d_{i}}{c_{i}}}p_{ij}}$

where

${\displaystyle c_{i}=\sum _{j}p_{ij}{\hat {u}}_{j}^{(t)}.}$

It has been shown empirically that if this iteration converges, it converges to the maximum likelihood solution for ${\displaystyle u_{j}}$ .[3]

Writing this more generally for two (or more) dimensions in terms of convolution with a point spread function P:

${\displaystyle {\hat {u}}^{(t+1)}={\hat {u}}^{(t)}\cdot \left({\frac {d}{{\hat {u}}^{(t)}\otimes P}}\otimes P^{*}\right)}$

where the division and multiplication are element wise, and ${\displaystyle P^{*}}$  is the flipped point spread function.

In problems where the point spread function ${\displaystyle p_{ij}}$  is not known a priori, a modification of the Richardson–Lucy algorithm has been proposed, in order to accomplish blind deconvolution.[4]

## Derivation

In the context of fluorescence microscopy, the probability of measuring a set of number of photons (or digitalization counts proportional to detected light) ${\displaystyle \mathbf {m} =[m_{0},...,m_{K}]}$  for expected values ${\displaystyle \mathbf {E} =[E_{0},...,E_{K}]}$  for a detector with K pixels is given by

${\displaystyle P(\mathbf {m} \vert \mathbf {E} )=\prod _{i}^{K}\mathrm {Poisson} (E_{i})=\prod _{i}^{K}{\frac {{E_{i}}^{m_{i}}e^{-E_{i}}}{m_{i}!}}}$

it is convenient to work with ${\displaystyle \ln(P)}$  since in the context of maximum likelihood estimation we want to find the position of the maximum of the likelihood function and we are not interested in its absolute value.

${\displaystyle \ln(P(m\vert E))=\sum _{i}^{K}\left[(m_{i}\ln E_{i}-E_{i})-\ln(m_{i}!)\right]}$

Again since ${\displaystyle \ln(m_{i}!)}$  is a constant, it will not give any additional information regarding the position of the maximum, so let's consider

${\displaystyle \alpha (m\vert E)=\sum _{i}^{K}\left[m_{i}\ln E_{i}-E_{i}\right]}$

where ${\displaystyle \alpha }$  is something that shares the same maximum position as ${\displaystyle P(m\vert E)}$ . Now let's consider that ${\displaystyle E}$  comes from a ground truth ${\displaystyle x}$  and a measurement ${\displaystyle \mathbf {H} }$  which we assume to be linear. Then

${\displaystyle \mathbf {E} =\mathbf {H} \mathbf {x} }$

where a matrix multiplication is implied. We can also write this in the form

${\displaystyle E_{m}=\sum _{n}^{K}H_{mn}x_{n}}$

where we can see how ${\displaystyle H}$ , mixes or blurs the ground truth.

It can also be shown that the derivative of an element of ${\displaystyle \mathbf {E} }$ , ${\displaystyle (E_{i})}$  with respect to some other element of ${\displaystyle x}$  can be written as:

${\displaystyle {\frac {\partial E_{i}}{\partial x_{j}}}=H_{ij}}$

(1)

Tip: it's easy to see this by writing a matrix ${\displaystyle \mathbf {H} }$  of say (5 x 5) and two arrays ${\displaystyle \mathbf {E} }$  and ${\displaystyle \mathbf {x} }$  of 5 elements and check it. This last equation can interpreted as how much one element of ${\displaystyle \mathbf {x} }$ , say element ${\displaystyle i}$  influences the other elements ${\displaystyle j\neq i}$  (and of course the case ${\displaystyle i=j}$  is also taken into account). For example in a typical case an element of the ground truth ${\displaystyle \mathbf {x} }$  will influence nearby elements in ${\displaystyle \mathbf {E} }$  but not the very distant ones (a value of ${\displaystyle 0}$  is expected on those matrix elements).

Now, the key and arbitrary step: we don't know ${\displaystyle x}$  but we want to estimate it with ${\displaystyle {\hat {\mathbf {x} }}}$ , let's call ${\displaystyle {\hat {\mathbf {x} _{old}}}}$  and ${\displaystyle {\hat {\mathbf {x} _{new}}}}$  the estimated ground truths while we are using the RL algorithm, where the hat symbol is used to distinguish ground truth from estimator of the ground truth

${\displaystyle {\hat {x}}_{new}={\hat {x}}_{old}+\lambda {\frac {\partial \ \alpha (m\vert E(x))}{\partial x}}|_{{\hat {x}}_{old}}}$

(2)

Where ${\displaystyle {\frac {\partial }{\partial x}}}$  stands for a ${\displaystyle K}$ -dimensional gradient. If we work on the derivative of ${\displaystyle \alpha (m\vert E(x))}$  we get

${\displaystyle {\frac {\partial \ \alpha (m\vert E(x))}{\partial x_{j}}}={\frac {\partial }{\partial x_{j}}}\sum _{i}^{K}\left[m_{i}\ln E_{i}-E_{i}\right]=\sum _{i}^{K}\left[{\frac {m_{i}}{E_{i}}}{\frac {\partial }{\partial x_{j}}}E_{i}-{\frac {\partial }{\partial x_{j}}}E_{i}\right]=\sum _{i}^{K}{\frac {\partial E_{i}}{\partial x_{j}}}\left[{\frac {m_{i}}{E_{i}}}-1\right]}$

and if we now use (1) we get

${\displaystyle {\frac {\partial \ \alpha (m\vert E(x))}{\partial x_{j}}}=\sum _{i}^{K}H_{ij}\left[{\frac {m_{i}}{E_{i}}}-1\right]}$

But we can also note that ${\displaystyle {H}_{ji}^{T}=H_{ij}}$  by definition of transpose matrix. And hence

${\displaystyle {\frac {\partial \ \alpha (m\vert E(x))}{\partial x_{j}}}=\sum _{i}^{K}{H}_{ji}^{T}\left[{\frac {m_{i}}{E_{i}}}-1\right]}$

(3)

Then if we consider ${\displaystyle j}$  spanning all the elements from ${\displaystyle 1}$  to ${\displaystyle K}$  this equation can be rewritten in its vectorial form

${\displaystyle {\frac {\partial \ \alpha (m\vert \mathbf {E} (x))}{\partial x}}={\mathbf {H} ^{T}}\left[{\frac {\mathbf {m} }{\mathbf {E} }}-\mathbf {1} \right]}$

where ${\displaystyle \mathbf {H} ^{T}}$  is a matrix and ${\displaystyle m}$ , ${\displaystyle E}$  and ${\displaystyle \mathbf {1} }$  are vectors. Let's now propose the following arbitrary and key step

${\displaystyle \lambda ={\frac {{\hat {\mathbf {x} }}_{old}}{\mathbf {H} ^{T}\mathbf {1} }}}$

(4)

where ${\displaystyle \mathbf {1} }$  is a vector of ones of size ${\displaystyle K}$  (same as ${\displaystyle m}$ , ${\displaystyle E}$  and ${\displaystyle x}$ ) and the division is element-wise. Using (3) and (4) we can rewrite (2) as

${\displaystyle {\hat {\mathbf {x} }}_{new}={\hat {\mathbf {x} }}_{old}+\lambda {\frac {\partial \alpha (\mathbf {m} \vert \mathbf {E} (x))}{\partial x}}={\hat {\mathbf {x} }}_{old}+{\frac {{\hat {\mathbf {x} }}_{old}}{{\mathbf {H} ^{T}}\mathbf {1} }}{\mathbf {H} ^{T}}\left[{\frac {\mathbf {m} }{\mathbf {E} }}-\mathbf {1} \right]={\hat {\mathbf {x} }}_{old}+{\frac {{\hat {\mathbf {x} }}_{old}}{\mathbf {H} ^{T}\mathbf {1} }}\mathbf {H} ^{T}{\frac {\mathbf {m} }{\mathbf {E} }}-{\hat {\mathbf {x} }}_{old}}$

which yields

${\displaystyle {\hat {\mathbf {x} }}_{new}={\hat {\mathbf {x} }}_{old}\mathbf {H} ^{T}\left({\frac {\mathbf {m} }{\mathbf {E} }}\right)/\mathbf {H} ^{T}\mathbf {1} }$

(5)

Where division refers to element-wise matrix division and ${\displaystyle \mathbf {H} ^{T}}$  operates as a matrix but the division and the product (implicit after ${\displaystyle {\hat {\mathbf {x} }}_{old}}$ ) are element-wise. Also, ${\displaystyle \mathbf {E} =E({\hat {\mathbf {x} }}_{old})=\mathbf {H} {\hat {x}}_{old}}$  can be calculated because we assume

- The initial guess ${\displaystyle {\hat {\mathbf {x} }}_{0}}$  is known (and is typically set to be the experimental data)

- The measurement function ${\displaystyle \mathbf {H} }$  is known

On the other hand ${\displaystyle \mathbf {m} }$  is the experimental data. Therefore, equation (5) applied successively, provides an algorithm to estimate our ground truth ${\displaystyle \mathbf {x} _{new}}$  by ascending (since it moves in the direction of the gradient of the likelihood) in the likelihood landscape. It has not been demonstrated in this derivation that it converges and no dependence on the initial choice is shown. Note that equation (2) provides a way of following the direction that increases the likelihood but the choice of the log-derivative is arbitrary. On the other hand equation (4) introduces a way of weighting the movement from the previous step in the iteration. Note that if this term was not present in (5) then the algorithm would output a movement in the estimation even if ${\displaystyle \mathbf {m} =E({\hat {\mathbf {x} }}_{old})}$ . It's worth noting that the only strategy used here is to maximize the likelihood at all cost, so artifacts on the image can be introduced. It is worth noting that no prior knowledge on the shape of the ground truth ${\displaystyle \mathbf {x} }$  is used in this derivation.