Landweber iteration¶
| Fact | Value |
|---|---|
| Also called | Landweber deconvolution, Van Cittert-Landweber iteration |
| Status | Implemented and tested |
| Family | Restoration and reconstruction |
| Engine | Browser |
| Type | Linear, iterative, gradient descent on the least squares error |
| Output | Image |
| Operator shown as | iterative (exact) |
| Support radius | global |
| Code | web/src/core/filters/restoration/iterative.ts, landweberFilter |
| Operator code | web/src/core/filters/restoration/iterative.ts, iterate |
| Channels | RGB, Brightness only |
Overview¶
Landweber iteration undoes a known blur step by step. It moves the estimate a small step against the gradient of the squared error between the blurred estimate and the image. The number of iterations sets how much is restored, so it works as the only regularization.
How it works¶
- Start with the blurred image as the estimate.
- Blur the estimate and subtract it from the image.
- Blur the difference with the PSF turned by a half turn, and add tau times it.
- Repeat for the chosen number of iterations.
Mathematical foundation¶
The formula shows the default parameter values.
where
- \(g\): The blurred image extended with the border mode
- \(f_k\): The estimate after k steps
- \(K\): The number of steps
- \(h, h'\): The PSF and the PSF turned by a half turn
- \(\tau\): The step size
Each step blurs the estimate and takes the residual g - h * f_k. It blurs the residual with h', the PSF turned by a half turn, and adds tau times the result. This is gradient descent on |h * f - g|^2, from Landweber's iteration for integral equations. A normalized PSF has |H| at most 1, so steps tau below 2 converge. After K steps, each frequency has covered 1 - (1 - tau |H|^2)^K of the way from g to the inverse filter result. So the iteration count acts as a smooth cutoff. The first estimate is the image itself. The PSF is the kernel of the Gaussian filter cut at 4 sigma, of the motion blur filter, or of the disk averaging filter.
The update is gradient descent on |h * f - g|^2. In the frequency domain each step multiplies the error at frequency f by 1 - tau |H|^2. A PSF that adds up to 1 has |H| at most 1, so steps tau below 2 converge. After K steps each frequency has covered 1 - (1 - tau |H|^2)^K of the way from g to the inverse filter result. Frequencies where H is strong come back fast and weak ones slowly, so stopping early holds back noise.
Kernel or operator¶
The Inspector shows the update rule, tau and the number of iterations. The Iteration viewer in the Learn panel shows the estimate after a few iterations and the residual at every iteration.
Algorithm¶
- Extend the image with the border mode by half its size, at most 256 pixels, on each side.
- Start with the estimate f equal to the extended image g.
- Blur f with h through the FFT and subtract it from g.
- Blur the residual with h' and add tau times it to f.
- Repeat for the chosen number of iterations.
- Crop the last estimate to the image.
Parameters¶
| Parameter | Default | Values | Meaning |
|---|---|---|---|
Blur psf |
Gaussian | Gaussian, Motion, Defocus | The point spread function, the picture a single bright point turns into. |
Sigma sigma |
2 | 0.3 to 10 px | The standard deviation of the Gaussian blur. The PSF ends at 4 sigma. |
Motion length length |
9 | 1 to 51 px | The length of the straight motion, for motion blur. |
Motion angle angle |
0 | 0 to 180 deg | The direction of the motion, counterclockwise from the x axis, as for motion blur. |
Defocus radius radius |
3 | 0.5 to 15 px | The radius of the defocus disk. |
Iterations iterations |
30 | 1 to 200 | How many update steps to run. |
Step size tau |
1.5 | 0.05 to 1.95 | The step size tau of each update. The PSF adds up to 1, so steps below 2 converge. |
Border mode border |
Reflect | Reflect 101 (default), Reflect, Replicate, Constant (zero), Wrap | How pixels outside the image are filled when the window reaches past the edge. |
Channels channelScope |
RGB | RGB, Brightness only | Which part of the color image the filter changes. |
Implementation¶
landweberFilter in web/src/core/filters/restoration/iterative.ts runs iterate. The image is extended with the border mode by half its size, at most 256 pixels, on each side, and every convolution runs through the FFT of the extended grid. The filter needs the whole image, so it always runs on the whole image, and a selection is cut out of the result. It is slow, so its preview runs on request.
Worked example¶
| Iterations | 1 | 5 | 10 | 20 | 50 | 100 |
|---|---|---|---|---|---|---|
| PSNR (dB) | 26.37 | 27.34 | 27.73 | 28.06 | 28.33 | 28.26 |
The PSNR against the clean disks for the image of the figure, 25.27 dB before the filter, with step size 1.5. The value rises while the iterations restore detail. When it falls again, the iterations have started to raise the noise, so stopping early acts as regularization.
Complexity¶
- Time: \(O(K N log N)\)
- Memory: \(O(N)\)
N is the number of pixels of the extended image and K the number of iterations. Each iteration takes four FFTs.
Artifacts and limitations¶
Limitations
- Slow to restore frequencies where |H| is small.
- Values can go below 0 or above 255. Projected Landweber keeps them at 0 or above.
Artifacts
- Ringing near strong edges after many iterations.
Tests¶
The reference runs the same iteration with numpy.fft on the plane extended with numpy.pad. Before the cases are written, the script checks that 30 iterations bring a blurred plane closer to the original in the center of the image. A unit test checks that the residual never grows with step size 1.
web/src/core/filters/filters.test.tsweb/src/core/filters/run.test.tsweb/src/core/filters/restoration/restoration.test.ts
References¶
- Landweber, L. An iteration formula for Fredholm integral equations of the first kind. American Journal of Mathematics 73(3), 615 to 624, 1951. DOI 10.2307/2372313.