Algorithm Search⌘K

Techniqueadvanced

Single-pixel camera

Also called single-pixel imaging.

Image with one detector by measuring inner products of the scene with many random or Hadamard patterns, then reconstruct by sparse recovery.

A single-pixel camera forms an image with one light detector. A spatial light modulator, usually a digital micromirror device (DMD), shows a sequence of patterns, and the detector records the total light of the scene seen through each pattern, which is the inner product of the scene with the pattern. With as many patterns as pixels, a Hadamard pattern set gives the image by one fast transform. With fewer patterns, the image is found by sparse recovery, as in compressed sensing, which mentions this camera as an example; this page gives the measurement scheme, the noise and the pitfalls. It differs from coded aperture imaging, which records one shot through a fixed mask on a detector array and decodes by correlation: here there is one detector and many patterns in time.

In plain words

Imagine you can see a picture only through a stencil, and you can only learn how much light passes in total. One stencil tells you little. But if you try many stencils, each letting through a different set of spots, you can work out the brightness of every spot, just as you can find several unknown weights from the totals of many groups. A good set of stencils makes this quick and exact. If the picture is simple, for example mostly smooth with a few edges, fewer stencils than spots are enough, and a computer finds the simplest picture that agrees with all the totals. The single detector can then be one that would be far too expensive to build as a large array.

When it applies

  • Detector arrays are expensive or do not exist. Short-wave infrared, mid-infrared and terahertz light, or detectors with special abilities, such as fast timing for depth, a full spectrum per measurement, or single-photon sensitivity. One good detector replaces an array.
  • The scene is static during the acquisition. The MM patterns are shown one after another. The pattern rate of a DMD is in the range of thousands to tens of thousands per second, so an image of 64×6464 \times 64 pixels with all 4096 patterns takes from a fraction of a second to a few seconds.
  • The measurements are linear in the light. The detector reading must be proportional to the light that reaches it, plus noise. Saturation and nonlinear gain break the model.
  • For the compressive mode: the scene is compressible. In a wavelet basis, or with sparse gradients as measured by total variation, and the patterns are incoherent with that representation.

The template

Let the scene be x∈R≥0Nx \in \mathbb{R}^N_{\ge 0}, an image of NN pixels written as a vector, with NN a power of 2. Let HH be the N×NN \times N Sylvester Hadamard matrix, with entries ±1\pm1 and HTH=NIH^TH = NI; its rows are the Walsh functions of the Walsh-Hadamard transform. A DMD mirror either sends light to the detector or away from it, so a pattern has entries 0 and 1. The 0/1 version of row hih_i is pi=(hi+1)/2p_i = (h_i + \mathbf{1})/2, so the pattern matrix is P=(H+J)/2P = (H + J)/2 with JJ the all-ones matrix. The first row of HH is all ones, so p1=1p_1 = \mathbf{1} and its reading is the total light t=1Txt = \mathbf{1}^Tx.

  1. SINGLE-PIXEL-IMAGE(scene x, N, M, Ψ, ε)
  2. 1choose a set I of M rows of H, with row 1 in I ▷ all rows, low sequency rows, or a random set
  3. 2for each i in I
  4. 3show the pattern p_i = (h_i + 1)/2 on the DMD
  5. 4record y_i = ⟨p_i, x⟩ + e_i ▷ one detector reading
  6. 5t ← y_1 ▷ the total light
  7. 6for each i in I: z_i ← 2y_i - t ▷ the ±1 measurement ⟨h_i, x⟩ plus noise
  8. 7if M = N: return x̂ ← H^T z / N ▷ fast Walsh-Hadamard transform, O(N log N)
  9. 8else: return x̂ ← argmin ‖Ψ^T x‖₁ subject to ‖H_I x - z‖₂ ≤ ε ▷ or total variation, or another sparse decoder

Lines L2 to L4 are the hardware. Line L6 holds because 2⟨pi,x⟩−⟨1,x⟩=⟨hi+1,x⟩−⟨1,x⟩=⟨hi,x⟩2\langle p_i, x\rangle - \langle\mathbf{1}, x\rangle = \langle h_i + \mathbf{1}, x\rangle - \langle\mathbf{1}, x\rangle = \langle h_i, x\rangle. Line L7 is exact without noise, because HTH=NIH^TH = NI, and the fast Walsh-Hadamard transform computes it, and the products with HIH_I and HITH_I^T inside the decoder of line L8, in O(Nlog⁡N)O(N\log N) operations.

Example by hand. Take a 2×22 \times 2 image, N=4N = 4, with pixels x=(5,1,2,0)x = (5, 1, 2, 0). With

H=(11111−11−111−1−11−1−11),P=H+J2=(1111101011001001),H = \begin{pmatrix}1 & 1 & 1 & 1\\ 1 & -1 & 1 & -1\\ 1 & 1 & -1 & -1\\ 1 & -1 & -1 & 1\end{pmatrix}, \qquad P = \frac{H + J}{2} = \begin{pmatrix}1 & 1 & 1 & 1\\ 1 & 0 & 1 & 0\\ 1 & 1 & 0 & 0\\ 1 & 0 & 0 & 1\end{pmatrix},

the readings are y=Px=(8,7,6,5)y = Px = (8, 7, 6, 5). The total is t=8t = 8, and z=2y−8=(8,6,4,2)z = 2y - 8 = (8, 6, 4, 2), which is HxHx. Then HTz=(20,4,8,0)H^Tz = (20, 4, 8, 0), and dividing by N=4N = 4 gives back x=(5,1,2,0)x = (5, 1, 2, 0).

Compressive mode by hand. Keep only rows 1, 2 and 3 of HH, so M=3<N=4M = 3 < N = 4. The columns of this 3×43 \times 4 matrix are (1,1,1)(1, 1, 1), (1,−1,1)(1, -1, 1), (1,1,−1)(1, 1, -1) and (1,−1,−1)(1, -1, -1), and no two of them are parallel. So a scene with one bright pixel, x=cejx = ce_j, is determined: z=cz = c times column jj, and the pattern of signs of zz names jj. For example x=7e3x = 7e_3 gives y=(7,7,0)y = (7, 7, 0), t=7t = 7 and z=(7,7,−7)z = (7, 7, -7), the third column times 7. But two bright pixels are not always determined: e1+e4e_1 + e_4 and e2+e3e_2 + e_3 both give z=(2,0,0)z = (2, 0, 0).

Noise and the multiplexing advantage. Suppose each reading has independent additive detector noise of variance σ2\sigma^2, not depending on the light. Scanning one pixel at a time with NN readings gives each pixel with variance σ2\sigma^2. With differential measurement, showing pip_i and its complement 1−pi\mathbf{1} - p_i and subtracting, zi=⟨hi,x⟩z_i = \langle h_i, x\rangle has noise variance 2σ22\sigma^2 from 2N2N readings, and x^=HTz/N\hat x = H^Tz/N has noise covariance HT(2σ2I)H/N2=(2σ2/N)IH^T(2\sigma^2I)H/N^2 = (2\sigma^2/N)I. Against scanning with the same 2N2N readings, variance σ2/2\sigma^2/2, this is N/4N/4 times smaller. Each pattern collects light from half of the pixels, and this is the source of the gain. When the noise is photon noise, its variance grows with the collected light, and the gain shrinks or disappears; the Hadamard optics of the 1970s studied this trade.

Classic examples

  • The Rice single-pixel camera. Duarte and coauthors (2008) built a camera with a DMD and one photodiode, showed random binary patterns, and reconstructed images from fewer readings than pixels by sparse recovery.
  • Computational ghost imaging. The same measurement, a known pattern of light on the object and a detector without spatial resolution, was studied in quantum optics as ghost imaging. With a programmable modulator the second, imaging detector is not needed, and the method is a single-pixel camera with structured illumination instead of structured detection.
  • Infrared and terahertz imaging. One cooled infrared detector, or one terahertz detector, behind a modulator replaces a focal plane array.
  • Depth and spectra. A fast detector with photon timing gives the time of flight for each pattern, hence a depth image. A spectrometer in place of the photodiode gives a spectrum for each pattern, hence a spectral image.

Variations

  • Pattern sets. Full Hadamard sets with the exact inverse of line L7; random 0/1 patterns as in the Rice camera; Hadamard rows ordered by sequency (the number of sign changes), so that the first ones give a low-resolution image; Hadamard matrices with randomly permuted columns, which are more incoherent with wavelets and keep the fast transform; and sinusoidal patterns with phase shifts, which measure Fourier coefficients and are shown on a binary DMD by dithering.
  • Differential and complementary detection. Showing each pattern and its complement removes slow drift of the light source and the background. A second detector placed in the other mirror direction records the complement at the same time, so no light is wasted.
  • Decoders. Basis pursuit denoising with a wavelet basis, total variation minimization, greedy and thresholding methods, and learned decoders. With M=NM = N no decoder is needed beyond line L7.
  • Adaptive patterns. Measure coarse wavelet coefficients first and refine only where they are large.

Pitfalls

  • Hadamard and Haar are coherent. The Walsh functions and the Haar wavelets share vectors: the constant vector is in both bases, and so is the coarsest Haar wavelet, a Walsh function with one sign change. So the mutual coherence of the two bases is the worst possible, and uniformly random rows of HH miss the coarse wavelet content of most images. Sample all low-sequency rows and fewer high ones, as in variable density sampling, or permute the columns at random.
  • Motion. The MM readings are taken in sequence. A scene that moves during the acquisition is not described by one xx, and the reconstruction blurs or shows artifacts.
  • Forgetting the total. Without the total tt the ±1 measurements of line L6 cannot be formed from 0/1 patterns. Keep the all-ones pattern, or use differential measurements.
  • Detector noise against photon noise. The multiplexing gain above assumes additive detector noise. With photon noise, a scene that is bright in a few pixels can be worse with Hadamard patterns than with scanning.
  • The resolution is the modulator's. The number of pixels and the resolution are set by the modulator and the optics, not by the detector. A compressive decoder does not add detail finer than the patterns.
  • The compressive saving needs a sparse scene. The number of readings for a decoder is of order slog⁡(N/s)s\log(N/s) for ss significant coefficients, as in the Candes-Romberg-Tao theorem and its successors. A scene with fine texture everywhere needs nearly NN patterns.

Exercises

  1. Show that P=(H+J)/2P = (H + J)/2 has entries 0 and 1 when HH is a Sylvester Hadamard matrix of order NN, and that every row except the first has exactly N/2N/2 ones.
  2. For N=4N = 4 and x=(3,0,1,4)x = (3, 0, 1, 4), compute the readings y=Pxy = Px, form z=2y−y1z = 2y - y_1, and recover xx by HTz/4H^Tz/4.
  3. With independent noise of variance σ2\sigma^2 on each of the NN readings, and zi=2yi−y1z_i = 2y_i - y_1, show that the error of x^=HTz/N\hat x = H^Tz/N has variance σ2\sigma^2 in the first pixel and 4σ2/N4\sigma^2/N in every other pixel. Use the fact that every column of HH except the first sums to 0. Compare with the differential scheme.
  4. Find two different 2-sparse nonnegative scenes in R4\mathbb{R}^4 with the same readings for the first three rows of PP, and explain why one more pattern removes the ambiguity.
  5. Show that the coarsest Haar wavelet on N=2kN = 2^k points, (1,…,1,−1,…,−1)/N(1, \dots, 1, -1, \dots, -1)/\sqrt N, is a normalized row of the Sylvester Hadamard matrix. What is the scaled coherence Nmax⁡∣⟨hi/N,ψj⟩∣\sqrt N\max|\langle h_i/\sqrt N, \psi_j\rangle| of the two bases?

References

  1. Marco F. Duarte, Mark A. Davenport, Dharmpal Takhar, Jason N. Laska, Ting Sun, Kevin F. Kelly and Richard G. Baraniuk, Single-pixel imaging via compressive sampling, IEEE Signal Processing Magazine 25(2), 2008, pages 83 to 91 (the camera with a digital micromirror device and one photodiode, random binary patterns, and reconstruction by sparse recovery)
  2. Matthew P. Edgar, Graham M. Gibson and Miles J. Padgett, Principles and prospects for single-pixel imaging, Nature Photonics 13(1), 2019, pages 13 to 20 (review of pattern choices including Hadamard and Fourier patterns, differential measurement, applications at infrared and terahertz wavelengths, and time-resolved imaging)
  3. Emmanuel J. Candes, Justin Romberg and Terence Tao, Robust uncertainty principles, exact signal reconstruction from highly incomplete frequency information, IEEE Transactions on Information Theory 52(2), 2006, pages 489 to 509 (recovery from a random subset of rows of an orthogonal transform, the basis of the compressive mode)

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.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW3 standard
  • five exercises