IPSDK 4.2
IPSDK : Image Processing Software Development Kit
Richardson-Lucy 2D deconvolution
imagerichardsonLucyDeconvolution2dImg (inRealImg,inKnlXY,nbIter)
imagerichardsonLucyDeconvolution2dImg (inRealImg,inKnlXY,nbIter,bStaturateImg)
imagerichardsonLucyDeconvolution2dImg (inRealImg,inKnlXY,nbIter,epsilonValue)
imagerichardsonLucyDeconvolution2dImg (inRealImg,inKnlXY,nbIter,epsilonValue,bStaturateImg)

Detailed Description

Richardson-Lucy deconvolution algorithm.

This algorithm removes iteratively blur from an image according to a given point spread function. The implementation is inspired from https://scikit-image.org/docs/dev/api/skimage.restoration.html#skimage.restoration.richardson_lucy.

Note
The input image must be normalized.

For a given iteration $n$, the deconvolution result is given by :

\[ f^{n+1} = f^n \left( \left( \frac{f^0}{f^n * H} \right) * H^F \right) \]

Where $f^n$ is the deconvolved image at iteration $n$, $H$ is the input PSF, $H^F$ is the flipped (mirrored along every directions) PSF and $*$ is the convolution operator.

Contrary to Richardson-Lucy deblur 2d, the input PSF is an IPSDK kernel, which offers more flexibility. It is also possible to define an epsilon value to determine from which value $f^n * H$ is considered as 0. In that case, $f^0 / (f^n * H) $ is set to 0. Finally, by saturating the output image, all values below -1 and higher than 1 are saturated in the range [-1, 1].

Here is a result of Richardson-Lucy deconvolution with 20 iterations a 15x15 mean kernel:

richardsonLucyDeconvolution2d.png
See also
https://en.wikipedia.org/wiki/Richardson%E2%80%93Lucy_deconvolution

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLFiltering as filter

Code Example

# opening of input images
geom = PyIPSDK.geometry2d(PyIPSDK.eImageBufferType.eIBT_Real32, 510, 509)
inImg = PyIPSDK.loadRawImageFile(inputImgPath, geom)
# create a processing kernel
inKnl = PyIPSDK.rectangularKernelXY(1, 1, [1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9])
# deconvolution filter 2d computation without normalization
outImg = filter.richardsonLucyDeconvolution2dImg(inImg, inKnl, 50)
# deconvolution filter 2d computation with normalization
outNormalizedImg = filter.richardsonLucyDeconvolution2dImg(inImg, inKnl, 50, True)

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLFiltering/Processor/RichardsonLucyDeconvolution2dImg/RichardsonLucyDeconvolution2dImg.h>

Code Example

// opening input image
ImagePtr pInImg = loadRawImageFile(inputImgPath, *pGeometry);
// compute un-normalized deconvolution on input image
ImagePtr pOutImg = richardsonLucyDeconvolution2dImg(pInImg, pInKnlXY, 50);
ImagePtr pOutImg_normalized = richardsonLucyDeconvolution2dImg(pInImg, pInKnlXY, 50, true);