Algorithmadvanced
Ayers-Dainty blind deconvolution
Also called iterative blind deconvolution.
Recover the image and the PSF together by alternate Fourier domain fits of each, with positivity and support constraints in the image domain. Simple, but with no convergence proof.
- Solves
- Image deblurring
- Time
- Θ(K N log N) worst · average · best
- Space
- Θ(N) extra
- Where
- K = the number of passes; N = the number of pixels
- Model
- Real RAM
- Properties
- not convergence proofdeterministiciterativenot linearneeds good startnonnegative
- Evidence
- Proof sketchCode in 1 languages
- Origin
- G. R. Ayers, J. C. Dainty, B. L. K. Davey, R. G. Lane, R. H. T. Bates, 1988
Ayers-Dainty blind deconvolution, also called iterative blind deconvolution, recovers both the sharp image and the point spread function from one blurred image . G. R. Ayers and J. C. Dainty proposed it in 1988. It borrows the idea of the error reduction algorithm of phase retrieval: go to the Fourier domain to fit the data, go back to the image domain to apply what you know, and repeat. Here the data fit in the Fourier domain is a division, because convolution becomes a product, . So with the current image the method estimates the PSF by dividing the data spectrum by the image spectrum, makes the PSF nonnegative, zero outside its known support and of sum 1, then estimates the image from the new PSF in the same way and makes it nonnegative. The divisions are done as Wiener filters, so small values do not blow up. The method is short and works on some problems, but it has no convergence proof. It can stall, it can cycle, and it has a trivial fixed point, "the image is the data and there is no blur".
In plain words
You have one blurred photo and you do not know the blur. Guess a sharp picture, for example a flat gray one. Ask: which blur would turn this guess into the photo? That question has a direct answer in the frequency domain, where blurring is multiplication. Take the answer, and fix it with what every blur must obey: no negative values, small size, and total weight 1. Now ask the opposite question: which sharp picture, blurred by this blur, gives the photo? Fix that answer too: no negative brightness. Go back and forth. On a good day the two guesses settle on the true picture and the true blur. On a bad day they wander or get stuck, and nothing in the method tells you which day it is.
The problem
The grid is periodic with pixels, and with indices modulo the grid. The PSF is stored with its center at index . The data are with unknown , unknown and noise . The prior knowledge is:
- , and outside a set (optional; is the whole grid when nothing is known);
- , outside a known small set around the origin, and .
The goal is a pair that satisfies the constraints and fits the data. Some ambiguities can never be resolved (a theorem, Claim 3 of the proof). The pairs and give the same data as . The sum constraint fixes , and the support of limits . In one dimension there are far more ambiguities: the transform of is a polynomial, it splits into linear factors, and each way to share the factors gives another pair. For example , and every factor is positive. A polynomial in two variables has, in general, no factors, so for images the answer is unique up to the shift and the scale (Lane and Bates, 1987). This is why blind deconvolution is a problem for images more than for signals.
The algorithm
Let be the DFT of the data, and let be a small weight. For a spectrum define the Wiener-type division , frequency by frequency, with where the divisor is .
AYERS-DAINTY(y, f0, h0, S_h, S_f, alpha, K)- 1
f ← P_F(f0); h ← P_H(h0) - 2
C ← DFT(y) - 3
repeat K times - 4
H ← W(C, DFT(f)) ▷ the PSF that best explains y for this f - 5
h ← P_H(IDFT(H)) ▷ real part, h ≥ 0, h = 0 outside S_h, sum 1 - 6
F ← W(C, DFT(h)) ▷ the image that best explains y for this h - 7
f ← P_F(IDFT(F)) ▷ real part, f ≥ 0, f = 0 outside S_f - 8
return f, h
sets negative values and values outside to . does the same with and then divides by the sum; if nothing positive is left, it keeps the previous PSF. Line L4 is the minimizer of over all , and line L6 is the same for (a theorem, Claim 1 of the proof). So each half step is a regularized least squares fit for one unknown with the other held fixed, followed by the constraints. An optional relaxation replaces each new spectrum by times the old one plus times the new one. The code is a version for images; a signal is an image with one row.
In the original paper the Fourier step is an inverse filter, , mixed with the previous estimate, with a separate rule for the frequencies where the divisor is small. Davey, Lane and Bates (1989) replaced it with the Wiener form above, which is the form most later descriptions use.
Example
The trivial fixed point. Start with and , and suppose that has no zero. Line L4 gives at every frequency, so , whatever the start PSF was. Line L6 gives , so . The method is stuck at "no blur" after one pass (Claim 5). So the start image must not be the data. A positive start with no structure, for example the mean of the data with small random changes, is a common choice.
The true pair is also a fixed point. If exactly, the pair satisfies the constraints and neither spectrum has a zero, then one pass with returns unchanged (Claim 4). So the method has at least two fixed points, and which one it reaches, if any, depends on the start.
A measured run. On a periodic grid, the object has random values in on about half of the pixels of the square of rows and columns to , and elsewhere. The PSF has random values in on a square around the origin, scaled to sum 1. The data have no noise. The run uses , no object support, the PSF support , a flat start PSF, and a start image whose pixels are the mean of the data times random factors in . (A flat start image has a spectrum that is zero away from frequency 0, so the first division would divide by rounding errors.) The table gives the relative error of , , after passes, for the shift of up to 2 pixels that makes it smallest, and the relative error of for the same shift. These are measurements, with the generators of the tests.
| seed | PSF error at | |||
|---|---|---|---|---|
| 1 | 0.50 | 0.18 | 0.19 | 0.11 |
| 2 | 0.28 | 5.4e-4 | 5.7e-15 | 3.6e-15 |
| 3 | 0.22 | 0.16 | 0.79 | 0.63 |
| 4 | 0.34 | 0.28 | 0.28 | 0.22 |
| 5 | 0.88 | 0.79 | 4.4e-3 | 1.6e-3 |
| 6 | 0.48 | 0.40 | 0.35 | 0.28 |
| 7 | 0.86 | 0.75 | 0.49 | 0.31 |
| 8 | 0.12 | 0.089 | 0.085 | 0.052 |
For comparison, the trivial pair has an image error between 0.69 and 0.81 on these eight problems. On seed 2 the method finds the exact pair to rounding error. On seed 5 it wanders for 200 passes and then comes close. On seeds 4, 6 and 8 it stops at a pair that fits the data only roughly. On seed 3 it is at 0.16 after 100 passes and then moves away, to 0.79, which is worse than the blurred data. With the eight runs stagnate within about 100 passes, at image errors between 0.15 and 0.71; on seed 2 the error stays at 0.15 instead of falling to rounding level.
Correctness
The full proof is in the proofs file. It shows that lines L4 and L6 are regularized least squares fits (Claim 1), that the output always satisfies the constraints (Claim 2), that the shift and scale ambiguities are exact (Claim 3), and that both the true pair and the trivial pair are fixed points (Claims 4 and 5). It does not show convergence, because there is no known result of that kind. The model is bilinear, so the set of pairs that fit the data is not convex, and each half step can undo part of the progress of the other. No quantity is known to fall from pass to pass. The tests check the five claims, check that the misfit rises between some passes on seed 1, and record the recovery on seed 2 as a measurement.
Proof: Each Ayers-Dainty pass solves two regularized least squares problems, keeps the constraints, and has the true pair and the trivial pair as fixed pointsfull
Setting. Images live on a periodic grid with pixels. The blur is with indices taken modulo the grid, and the DFT is unnormalized, , where means . So (the convolution theorem) and (Parseval). The data are with . The constraint sets are
One pass of lines L4 to L7, with , maps to :
where , with where the denominator is . takes the real part, sets negative values and values outside to . does the same with and then divides by the sum.
Claim 1 (each Fourier step is a least squares fit). Let and be real images and . Then is real, and it is the unique minimizer over all images of
With , minimizes , and it is the minimizer of least norm.
Proof. By the convolution theorem and Parseval, with , , . The sum splits into one term per frequency. Each term is a strictly convex quadratic in the complex number when . Its derivative with respect to is , which is exactly at . So gives the unique minimizer. Since and are real, and , so and is real. With the term is . Where it is only at , which is what gives. Where every gives the same value, and picks , which has the least modulus. By Parseval the least norm in the Fourier domain is the least norm in the image domain.
So line L4 fits the PSF to the data for the current object, and line L6 fits the object to the data for the current PSF. The fit ignores the constraints; the constraints come after.
Claim 2 (the constraints hold after every pass). For every input, . If the clipped PSF has a positive sum, ; otherwise the code keeps the previous , which is in from the pass before (or from line L1).
Proof. returns real values that are at least and are outside , so its output is in . For the PSF, after the clip the values are real, at least and outside . If their sum is positive, dividing by keeps these properties and makes the sum . Line L1 applies the same maps to the start, with the delta PSF as the fallback, and the delta PSF is in when .
is the Euclidean projection onto the closed convex cone (each pixel is projected onto or onto on its own). The clip and divide of is not the Euclidean projection onto , which would subtract a common constant before the clip. The method only needs a map into , and the scaling keeps the shape of the PSF.
Claim 3 (the blind problem has exact ambiguities). For every pair , every integer shift and every , the pairs and give the same data . Inside the scale is fixed. A shift survives when both shifted images still satisfy the support constraints.
Proof. is the sum for at after the change of index . The scale cancels in the product. fixes .
In one dimension there are many more ambiguities. Write the data, the object and the PSF as polynomials in (their transforms, with finite support). The data polynomial is the product of the other two. By the fundamental theorem of algebra it splits into linear factors, and each way to share these factors between two groups gives another pair with the same data. Positivity removes only some of these splits. In two dimensions a polynomial in two variables has, in general, no nontrivial factors, so the factorization is unique up to Claim 3. This is the reason why blind deconvolution is better posed for images than for signals; the implementation therefore works on images.
Claim 4 (the true pair is a fixed point). Let , with and , and suppose that and for every . Then one pass maps to itself.
Proof. . Line L4 gives at every frequency, so the inverse DFT is . It is real, at least , outside and sums to , so leaves it unchanged. Line L6 gives , and leaves unchanged.
Claim 5 (the trivial pair is a fixed point, and it attracts the start ). Let , , and for every . Then the pair , with the delta PSF, is a fixed point. Moreover, from the start and any start PSF, the first pass already returns .
Proof. With , line L4 gives at every frequency, whose inverse DFT is , whatever was. , so . Line L6 gives , whose inverse DFT is , so .
The trivial pair explains the warning that the start object must not be the data: the method then reports "no blur" and stops. With the pair moves a little, but the same pull is there.
What is not proved. A pass is two regularized least squares fits, each followed by a map onto a constraint set. Each fit uses the other unknown as fixed, and the map after it can undo part of the fit. The model is bilinear, so the set of pairs that fit the data is not convex, and the theory of alternating projections onto convex sets does not apply. No quantity is known to decrease along the passes, and there is no general convergence proof; the tests record a run where the misfit rises between passes. The tests check Claims 1 to 5 and record, as measurements, one run that recovers the true pair to in 110 passes.
Complexity
Each pass takes four DFTs of pixels and other work. With the FFT a pass costs , so passes cost , and the extra space is for the spectra. The code here uses a direct DFT along rows and then along columns, which costs per transform and is enough for small tests. The number of passes needed is not bounded by any theory; in the measured runs it ranges from about 100 to "never".
Properties
- Nonlinear and not monotone. No objective is known to fall along the passes.
- The output satisfies the constraints after every pass: , , both zero outside their supports, and .
- Both the true pair and the trivial pair are fixed points for .
- The result depends on the start, on , on and on the number of passes.
- Each half step is a Tikhonov fit of one unknown, so the method is a form of alternating minimization in which the constraint step is not part of the objective.
Variants and improvements
- Inverse filter with averaging. The original method of Ayers and Dainty used the plain division and averaged the new and the old spectra; the relaxation of the code is in this spirit.
- Wiener-type steps. Davey, Lane and Bates (1989) used , with set from the noise level. This is the form in the code.
- Blind Richardson-Lucy. Replace each Fourier step by a few Richardson-Lucy steps, first for the PSF with the image fixed and then for the image with the PSF fixed. The multiplicative steps keep both nonnegative without a clip, and for Poisson data each half step does not decrease the likelihood. This variant was proposed by Fish and coworkers in 1995.
- More images. With several frames of the same object behind different blurs, as in speckle imaging, the object is shared and the problem is much better posed. Phase diversity adds a known aberration to make the blurs different.
- Priors instead of hard constraints. Variational Bayes blind deconvolution puts a prior on the image and estimates the PSF while it averages over the image, which avoids the trivial solution of joint fitting.
When to use it
Use it as a first try when the object is positive and sits on a dark background, the PSF is small and nonnegative, the noise is low and you can afford to restart from several starts and check the results. Typical cases are star fields and small objects behind atmospheric or optical blur. Do not use it when the PSF must be known reliably, for example for photometry, or when the data are noisy; there use a method with a noise model, or a calibrated PSF from a star in the field.
Pitfalls
- Starting the image at the data sends the method to the trivial pair in one pass.
- A start image that is exactly flat has a spectrum that is zero away from frequency 0. With the first division then divides by rounding errors, and the run depends on them.
- The result is not unique up to shift and scale in one dimension, and positivity does not fix this. A Gaussian blur on a signal can be split into two narrower Gaussians in many ways.
- No convergence proof: the misfit can rise, the method can cycle, and a pass count that works on one image fails on the next one. Watch the misfit and stop at a good value, not at a fixed count.
- A PSF support that is too large lets the PSF absorb part of the image; one that is too small makes the true PSF infeasible. Both give wrong answers without a warning.
- With and noise, the divisions amplify the noise at frequencies where the spectrum is small. With a large the method stalls early.
- The error must be measured up to a shift, because a shifted image and an opposite shift of the PSF fit the same data.
Implementations
Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/ayers-dainty-blind-deconvolution/. The authors are listed in prov/MB6VNZ.jsonl.
"""Iterative blind deconvolution in the style of Ayers and Dainty (1988).
Images are lists of rows on a periodic n1 x n2 grid. The data are
y = h * f (+ noise) with the PSF h stored with its center at index (0, 0)
(wrapped around). Both f and h are unknown. The method alternates two
Fourier domain estimates,
H <- conj(F) C / (|F|^2 + alpha) (the PSF from the data and the object)
F <- conj(H) C / (|H|^2 + alpha) (the object from the data and the PSF)
with C = DFT(y). After each estimate it goes back to the image domain and
applies the constraints there: the object is real, nonnegative and zero
outside an optional support; the PSF is real, nonnegative, zero outside a
known support and sums to 1. Each Fourier estimate is the per frequency
minimizer of |C - A B|^2 + alpha |B|^2, the Wiener-type form of Davey, Lane
and Bates (1989). An optional relaxation beta mixes the new spectrum with
the old one, in the spirit of the averaging step of the original method.
There is no convergence proof.
"""
import cmath
import math
def _roots(n, sign):
return [cmath.exp(sign * 2j * math.pi * k / n) for k in range(n)]
def _dft1(x, w):
n = len(x)
return [sum(x[j] * w[(j * k) % n] for j in range(n)) for k in range(n)]
def _rows_cols(img, sign, scale):
n1, n2 = len(img), len(img[0])
w1, w2 = _roots(n1, sign), _roots(n2, sign)
rows = [_dft1(r, w2) for r in img]
cols = [_dft1([rows[i][j] for i in range(n1)], w1) for j in range(n2)]
return [[cols[j][i] * scale for j in range(n2)] for i in range(n1)]
def dft2(img):
"""X[k1][k2] = sum x[j1][j2] exp(-2 pi i (j1 k1 / n1 + j2 k2 / n2)), unnormalized."""
return _rows_cols(img, -1, 1.0)
def idft2(img):
"""The inverse of dft2, with the factor 1 / (n1 n2)."""
return _rows_cols(img, 1, 1.0 / (len(img) * len(img[0])))
def conv2(x, h):
"""(h * x)[i1][i2] = sum h[j1][j2] x[(i1 - j1) mod n1][(i2 - j2) mod n2]."""
n1, n2 = len(x), len(x[0])
out = [[0.0] * n2 for _ in range(n1)]
for j1 in range(n1):
for j2 in range(n2):
v = h[j1][j2]
if v == 0:
continue
for i1 in range(n1):
xr, orow = x[(i1 - j1) % n1], out[i1]
for i2 in range(n2):
orow[i2] += v * xr[(i2 - j2) % n2]
return out
def wiener_update(c, a, alpha):
"""Per frequency minimizer B of |C - A B|^2 + alpha |B|^2, that is conj(A) C / (|A|^2 + alpha).
With alpha = 0 and A = 0 at a frequency every B fits equally well; 0 is returned there.
"""
out = []
for crow, arow in zip(c, a):
row = []
for ck, ak in zip(crow, arow):
den = abs(ak) ** 2 + alpha
row.append(ak.conjugate() * ck / den if den > 0 else 0j)
out.append(row)
return out
def project_object(z, support=None):
"""Real part, negative values set to 0, and zero outside the support if one is given."""
if support is None:
return [[max(v.real, 0.0) for v in row] for row in z]
return [[max(v.real, 0.0) if s else 0.0 for v, s in zip(row, srow)] for row, srow in zip(z, support)]
def project_psf(z, support, fallback):
"""Real part, zero outside the support, negative values set to 0, scaled to sum 1.
If nothing positive is left, the previous PSF (fallback) is kept.
"""
h = project_object(z, support)
total = sum(sum(row) for row in h)
if total <= 0:
return [list(row) for row in fallback]
return [[v / total for v in row] for row in h]
def _mix(old, new, beta):
return [[(1 - beta) * o + beta * v for o, v in zip(ro, rn)] for ro, rn in zip(old, new)]
def misfit(y, f, h):
"""||y - h * f|| / ||y||."""
hf = conv2(f, h)
num = sum((a - b) ** 2 for ra, rb in zip(y, hf) for a, b in zip(ra, rb))
den = sum(a * a for ra in y for a in ra)
return math.sqrt(num / den)
def ayers_dainty(y, f0, h0, support=None, obj_support=None, alpha=1e-3, beta=1.0, iters=50, callback=None):
"""Alternate Fourier estimates of the PSF and the object with image domain constraints.
y: the blurred image. f0, h0: the starting object and PSF.
support: booleans, True where the PSF may be nonzero (default: everywhere).
obj_support: booleans, True where the object may be nonzero (default: everywhere).
alpha >= 0: the Wiener weight (0 gives the inverse filter where it is defined).
beta in (0, 1]: the weight of the new spectrum in each update.
callback(k, f, h) is called after each pass. Returns (f, h).
"""
n1, n2 = len(y), len(y[0])
if support is None:
support = [[True] * n2 for _ in range(n1)]
delta = [[1.0 if (i, j) == (0, 0) else 0.0 for j in range(n2)] for i in range(n1)]
f = project_object([[complex(v) for v in row] for row in f0], obj_support) # @line L1
h = project_psf([[complex(v) for v in row] for row in h0], support, delta)
c = dft2(y) # @line L2
for k in range(iters): # @line L3
fh = dft2(f)
hh = wiener_update(c, fh, alpha) # @line L4
if beta != 1.0:
hh = _mix(dft2(h), hh, beta)
h = project_psf(idft2(hh), support, h) # @line L5
ff = wiener_update(c, dft2(h), alpha) # @line L6
if beta != 1.0:
ff = _mix(fh, ff, beta)
f = project_object(idft2(ff), obj_support) # @line L7
if callback is not None:
callback(k + 1, f, h)
return f, h # @line L8
def shift(x, s1, s2):
"""The image x moved by (s1, s2) on the periodic grid: out[i][j] = x[i - s1][j - s2]."""
n1, n2 = len(x), len(x[0])
return [[x[(i - s1) % n1][(j - s2) % n2] for j in range(n2)] for i in range(n1)]
test_ayers_dainty_blind_deconvolution.py 160 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/ayers-dainty-blind-deconvolution/. The authors are listed in prov/MB6VNZ.jsonl.
import math
import random
from ayers_dainty_blind_deconvolution import (
ayers_dainty,
conv2,
dft2,
idft2,
misfit,
project_psf,
shift,
wiener_update,
)
N = 12
def problem(seed, n=N, lo=2, hi=9):
"""A sparse positive object in rows and columns lo..hi and a random positive 3 x 3 PSF."""
rng = random.Random(seed)
f = [[0.0] * n for _ in range(n)]
for i in range(lo, hi + 1):
for j in range(lo, hi + 1):
f[i][j] = rng.random() if rng.random() < 0.5 else 0.0
h = [[0.0] * n for _ in range(n)]
for a in range(-1, 2):
for b in range(-1, 2):
h[a % n][b % n] = rng.uniform(0.1, 1.0)
s = sum(map(sum, h))
h = [[v / s for v in r] for r in h]
sup = [[min(i, n - i) <= 1 and min(j, n - j) <= 1 for j in range(n)] for i in range(n)]
return f, h, sup
def rel_err(a, b):
num = sum((p - q) ** 2 for ra, rb in zip(a, b) for p, q in zip(ra, rb))
return math.sqrt(num / sum(q * q for rb in b for q in rb))
def start(y, sup, seed):
"""A random positive start image near the mean of the data and a flat PSF on its support.
A flat start image has a spectrum that is zero except at frequency 0, up to
rounding, and the first division would then divide by rounding errors.
"""
mean = sum(map(sum, y)) / (len(y) * len(y[0]))
rng = random.Random(100 + seed)
f0 = [[mean * rng.uniform(0.5, 1.5) for _ in row] for row in y]
h0 = [[1.0 if s else 0.0 for s in row] for row in sup]
return f0, h0
def test_convolution_theorem_and_round_trip():
rng = random.Random(1)
x = [[rng.random() for _ in range(5)] for _ in range(4)]
h = [[rng.random() for _ in range(5)] for _ in range(4)]
lhs = dft2(conv2(x, h))
xf, hf = dft2(x), dft2(h)
assert max(abs(lhs[i][j] - xf[i][j] * hf[i][j]) for i in range(4) for j in range(5)) < 1e-12
back = idft2(xf)
assert max(abs(back[i][j] - x[i][j]) for i in range(4) for j in range(5)) < 1e-13
def test_wiener_update_is_the_regularized_least_squares_minimizer():
# In the image domain B = dft2(b) minimizes ||y - a * b||^2 + alpha ||b||^2 (Parseval).
rng = random.Random(2)
n1, n2, alpha = 4, 5, 0.3
a = [[rng.random() for _ in range(n2)] for _ in range(n1)]
y = [[rng.random() for _ in range(n2)] for _ in range(n1)]
b = [[v.real for v in row] for row in idft2(wiener_update(dft2(y), dft2(a), alpha))]
def cost(bb):
r = conv2(a, bb)
fit = sum((p - q) ** 2 for rp, rq in zip(y, r) for p, q in zip(rp, rq))
return fit + alpha * sum(v * v for row in bb for v in row)
c0 = cost(b)
for _ in range(200):
eps = 10 ** rng.uniform(-4, -1)
bb = [[v + eps * rng.gauss(0, 1) for v in row] for row in b]
assert cost(bb) >= c0 - 1e-12
def test_shift_and_scale_give_the_same_data():
f, h, _ = problem(3)
y = conv2(f, h)
y2 = conv2(shift(f, 1, -2), shift(h, -1, 2))
y3 = conv2([[2.5 * v for v in r] for r in f], [[v / 2.5 for v in r] for r in h])
assert rel_err(y2, y) < 1e-13 and rel_err(y3, y) < 1e-13
def test_true_pair_is_a_fixed_point_without_regularization():
f, h, sup = problem(2)
y = conv2(f, h)
assert min(abs(v) for row in dft2(f) for v in row) > 1e-6
f1, h1 = ayers_dainty(y, f, h, support=sup, alpha=0.0, iters=3)
assert rel_err(f1, f) < 1e-9 and rel_err(h1, h) < 1e-9
def test_trivial_pair_is_a_fixed_point_and_attracts_the_start_f0_equal_y():
f, h, sup = problem(1)
y = conv2(f, h)
rng = random.Random(4)
h0 = [[rng.random() if s else 0.0 for s in row] for row in sup]
f1, h1 = ayers_dainty(y, y, h0, support=sup, alpha=0.0, iters=5)
assert abs(h1[0][0] - 1.0) < 1e-12
assert sum(abs(v) for row in h1 for v in row) - h1[0][0] < 1e-12
assert rel_err(f1, y) < 1e-12 and misfit(y, f1, h1) < 1e-12
def test_constraints_hold_after_every_pass():
f, h, sup = problem(5)
y = conv2(f, h)
rng = random.Random(6)
y = [[v + rng.gauss(0, 0.01) for v in row] for row in y]
osup = [[1 <= i <= 10 and 1 <= j <= 10 for j in range(N)] for i in range(N)]
f0, h0 = start(y, sup, 5)
seen = []
def check(k, fk, hk):
seen.append(k)
assert min(min(r) for r in fk) >= 0 and min(min(r) for r in hk) >= 0
assert abs(sum(map(sum, hk)) - 1.0) < 1e-12
for i in range(N):
for j in range(N):
if not sup[i][j]:
assert hk[i][j] == 0.0
if not osup[i][j]:
assert fk[i][j] == 0.0
ayers_dainty(y, f0, h0, support=sup, obj_support=osup, alpha=1e-3, beta=0.5, iters=8, callback=check)
assert seen == list(range(1, 9))
def test_psf_projection_keeps_the_old_psf_when_nothing_positive_is_left():
sup = [[True, False], [False, False]]
old = [[1.0, 0.0], [0.0, 0.0]]
assert project_psf([[-1 + 0j, 2 + 0j], [3 + 0j, 4 + 0j]], sup, old) == old
def test_measured_recovery_on_seed_2():
# A measurement, not a theorem: on this problem 110 passes recover f and h.
f, h, sup = problem(2)
y = conv2(f, h)
f0, h0 = start(y, sup, 2)
f1, h1 = ayers_dainty(y, f0, h0, support=sup, alpha=0.0, iters=110)
assert rel_err(f1, f) < 1e-3 and rel_err(h1, h) < 1e-3
def test_misfit_is_not_monotone_on_seed_1():
# A measurement: the alternation has no descent property.
f, h, sup = problem(1)
y = conv2(f, h)
f0, h0 = start(y, sup, 1)
vals = []
ayers_dainty(y, f0, h0, support=sup, alpha=0.0, iters=30, callback=lambda k, fk, hk: vals.append(misfit(y, fk, hk)))
assert any(vals[k + 1] > vals[k] * 1.01 for k in range(len(vals) - 1))
History
Blind deconvolution of images was studied in the 1980s, when Bates and coworkers argued that a convolution of two images can in general be split in one way only, unlike a convolution of two signals. In 1988 G. R. Ayers and J. C. Dainty published a short method that applies the alternating scheme of Gerchberg, Saxton and Fienup to this problem, with positivity in the image domain and divisions in the Fourier domain. Davey, Lane and Bates (1989) made the divisions Wiener-type and studied how the constraints affect convergence. The method became a standard example in reviews of blind deconvolution, such as Kundur and Hatzinakos (1996), both for its simplicity and for its lack of convergence guarantees. Later methods, such as blind Richardson-Lucy and the variational Bayes methods of the 2000s, added a noise model and a prior.
References
- G. R. Ayers and J. C. Dainty, Iterative blind deconvolution method and its applications, Optics Letters 13(7), 1988, pages 547 to 549
- B. L. K. Davey, R. G. Lane and R. H. T. Bates, Blind deconvolution of noisy complex-valued image, Optics Communications 69(5-6), 1989, pages 353 to 356 (the Wiener-type form of the two Fourier steps and the effect of the constraints on convergence)
- Lane and Bates 1987, the article (why a convolution of images, unlike one of signals, can in general be factored in one way only)
- Kundur and Hatzinakos 1996, the section on iterative blind deconvolution
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H1 sketch |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag MB6VNZ Edit this page History Report an error Markdown