Skip to main content
Sandbox Physics

Optics 069 · Diffraction, Fourier optics, and computational imaging

Coded-Aperture Camera

Decode a sky hidden inside overlapping shadows: real mask openings, Poisson acquisition, MURA limits and finite-edge ghosts.

Interactive modelCoded-Aperture Camera
Basic-code open fraction / expected source counts fopen,Csrcf_{\rm open},C_{\rm src}0.500.50
Detector fit / simulation-only truth error εD,εtruth\varepsilon_D,\varepsilon_{\rm truth}50%50\%
Central angular step / selected-source coding Δθ,cselected\Delta\theta,c_{\rm selected}0.00π0.00\pi
Model regimevalid model regime\text{valid model regime}

Physics tutorial

Audit the physics of Coded-Aperture Camera

BackgroundA detector does not record negative mask weights. Open cells transmit, closed cells absorb, and incoherent source contributions add: Di∼Poisson⁡ ⁣(E∑qHiqfq+b)D_i\sim\operatorname{Poisson}\!\left(E\sum_q H_{iq}f_q+b\right). Choose noiseless expectations or seeded Poisson counts. The signed decoder is applied only after acquisition.

Why it mattersHow can a patterned shadow encode a scene without a conventional lens?

Start with the essentials

Focus question
How can a patterned shadow encode a scene without a conventional lens?
One-sentence intuition
For this complete 13-square MURA cycle, the mask and special decoder satisfy A⋆G=Kδ,K=84A\star G=K\delta,\qquad K=84. Truncating the physical plate breaks the cyclic model. The origin correction matters; ordinary autocorrelation is not a perfect delta.

Core mathematical model

Ray geometry and real mask size

rM=rD−aqtan⁡θray=aqdND=13,NM=25 or 13a=2 mm\begin{aligned}\mathbf r_M&=\mathbf r_D-a\mathbf q\\ \tan\boldsymbol\theta_{\rm ray}&=\frac{a\mathbf q}{d}\\ N_D&=13,\quad N_M=25\text{ or }13\\ a&=2\,\mathrm{mm}\end{aligned}

Rows increase downward, columns rightward on detector images. Rays propagate from mask to detector; source direction is opposite the incoming propagation slope. Full mosaic covers every sampled shift without wraparound outside the plate. Pixel and hole areas match at integer shifts.

Nonnegative acquisition

μi=E(Hf)i+bDi∼Poisson⁡(μi)E[Di]=Var⁡(Di)=μi\begin{aligned}\mu_i&=E(H\mathbf f)_i+b\\ D_i&\sim\operatorname{Poisson}(\mu_i)\\ \mathbb E[D_i]&=\operatorname{Var}(D_i)=\mu_i\end{aligned}

Flux is in unit-source counts per open detector pixel. Background is uniform and calibrated, not fitted from truth. With noise off the record is an expectation and need not be integer. Noise on uses exact small-mean Poisson samplers summed for large means.

Decode the recorded shadow

f^q=∑iGi−q(Di−b)EKG00=1,Gij=2Aij−1 (i,j)≠(0,0)\begin{aligned}\widehat f_q&=\frac{\sum_i G_{i-q}(D_i-b)}{EK}\\ G_{00}&=1,\quad G_{ij}=2A_{ij}-1\ (i,j)\ne(0,0)\end{aligned}

Special MURA origin correction yields a delta point response only for the full cycle. Other masks use zero-mean matched correlation normalized to unit on-axis peak, which loses the sky mean and retains sidelobes. We label this, rather than claiming perfect random-mask inversion.

Finite-geometry ridge

f^=arg⁡min⁡f∥Hf−D−bE∥2+λ∥f∥2λ=ρtr⁡(HTH)169\begin{aligned}\widehat{\mathbf f}&=\arg\min_{\mathbf f}\left\|H\mathbf f-\frac{\mathbf D-b}{E}\right\|^2+\lambda\|\mathbf f\|^2\\ \lambda&=\rho\frac{\operatorname{tr}(H^TH)}{169}\end{aligned}

Conjugate gradients use the actual finite matrix and only acquired data. This is signed ridge least squares, not a positivity prior, optimal Poisson likelihood or a true Wiener filter. Eighty iterations maximum; regularization can suppress noise and bias the scene.

Common difficulties

More holes always mean a better image?

Typical misconceptionA bright shadowgram guarantees a sharp, high-SNR reconstruction.

Better mental modelEvery opening also carries photons from other sources. Their shot noise survives subtraction. Pattern, background, source structure and correct finite geometry all matter. More counts is not automatically more information.

Run the experiment

  1. 01

    Scene 1: Complete MURA shadow

    Drag the bright source in the answer key. Inspect actual openings and the receiving face; watch both shadows mix on one detector.

    What to observe: MURA has 84 open cells out of 169, not an adjustable arbitrary open fraction. The open-fraction slider changes only the random design.
  2. 02

    Scene 2: Random mask with photon noise

    Switch MURA, random masks, arrays and a single pinhole at the same exposure. Compare actual count budget and decoded point-response sidelobes.

    What to observe: The physical detector moves when separation changes. Angular grid spacing shrinks, while a fixed integer shadow shift remains the same. No fabricated blur change.
  3. 03

    Scene 3: A missing mask edge

    Remove the outer mosaic, move a source to the edge, and compare cyclic decoding with geometry-aware ridge on the unchanged record. Add Poisson noise and increase exposure.

    What to observe: Truth is only a synthetic score. Correlation and ridge can produce negative estimates, regularization bias or ghosts; the raw record remains nonnegative.
FeedbackSomething broken, confusing, or missing on this page?Tell us
What kind of feedback?

Sent with this page’s address, its Lab ID, the site language and your device type. Please leave out personal details. Feedback is kept for up to 12 months.Privacy policy