Vision Systems & Engineering

Machine Vision Cameras

The industrial camera as a class of device, covering area-scan, line-scan and TDI sensors, shutter modes, binning, decimation and regions of interest, pixel formats and bit depth, how to read an EMVA 1288 datasheet, cooled, SWIR and polarization variants, and a checklist for choosing one.

intermediate

A machine-vision camera is a digital camera built to be controlled and measured rather than to make pleasing pictures. It can be triggered from outside, exposes its settings through a programming interface, and can deliver its sensor’s output with the camera’s processing switched off, so that the image is, as far as possible, the linear output of the sensor. Such cameras are also called industrial cameras, and in their scientific forms scientific or measurement cameras. In our reading, they differ from one another less in their optics than in their sensors: whether the sensor is a two-dimensional array or a line, how it starts and ends exposures, how it combines or skips pixels, how many bits it delivers and how noisy those bits are.

The image sensor article explains the chip itself, its noise model and the EMVA 1288 measurement method; industrial machine vision explains how cameras are wired into a production line, from triggers and encoders to interfaces and PLCs; the digital camera article places the machine-vision camera among other camera classes. This article is about the device in between: the features a camera exposes, what they do to the signal, and how to read the numbers on its datasheet.

How It Works

One programming model for many cameras

Cameras on the standard machine-vision interfaces describe themselves through GenICam, whose Standard Features Naming Convention (SFNC) fixes the names and meanings of features across vendors (SFNC 2.8; the digital camera article describes the GenICam layers). The SFNC treats a camera as a source of data that produces one rectangular image, of which one or several regions of interest are streamed (SFNC 2.8, Chapter 4). Feature names from that convention are used below, because they are what a programmer sets.

Area-scan, line-scan and 3D devices

DeviceScanType distinguishes four kinds of device: Areascan, a 2D sensor whose image comes from a single sensor acquisition; Linescan, a 1D sensor whose image is acquired line by line; and the range-image forms Areascan3D and Linescan3D (SFNC 2.8, Section 3.3). The feature is typically read-only, but the SFNC notes that some cameras can switch between line-scan and area-scan operation. Industrial Machine Vision describes when each scan type suits a task and how a line-scan camera is triggered from an encoder; the sensor-level variants matter here.

A line-scan sensor has one row of pixels or a few (Industrial Machine Vision), and PFNC defines non-square colour filter patterns for line-scan use and bi-colour formats for some two-stage colour line-scan sensors (PFNC 2.5, Section 3.1.11 and revision history); the image is assembled from successive lines as the object moves. Its weakness is light: each line is exposed for at most one line period, and at high line rates that period is short. Time delay integration (TDI) answers this with a sensor of NN rows. As the image of an object line moves from one row to the next, the charge it has generated is shifted along with it, so the same object line is exposed NN times and read out once (Bulayev, 2012). Bulayev’s technical note for Hamamatsu calls this “noiseless accumulation” of multiple exposures, names the full-frame CCD as the architecture used for TDI as well as for traditional scientific and industrial applications, and gives the condition for a sharp image: the row-shift frequency must match the speed of the image on the sensor, f=V/d1=VM/d2f = V/d_1 = VM/d_2, with VV the object speed, d1d_1 the size of an object element imaged onto one pixel, d2d_2 the pixel size and M=d2/d1M = d_2/d_1 the magnification (Bulayev, 2012, Eq. 1).

Two consequences follow, and the example below quantifies both:

  • Signal and noise. With NN stages the integration time and the collected charge grow NN-fold; shot noise grows by N\sqrt{N}, so the note gives a theoretical signal-to-noise improvement of N\sqrt{N} (Bulayev, 2012). Because the packet is read only once, read noise is added once whatever NN is; it follows (our derivation, not a statement of the note) that where read noise dominates, the improvement approaches NN.
  • Synchronization. The practical limit on NN is how accurately the shift frequency matches the object’s speed. The note shows a 128-stage TDI-CCD camera with the scan rate 10% too high (slight elongation of the image), 10% too low (slight compression) and about 30% too low (substantial degradation), and gives the loss of modulation transfer from a relative velocity mismatch ΔV/V\Delta V/V as
MTFvel=sin⁡ ⁣(π2 ΔVV N fsigfN)π2 ΔVV N fsigfN,\mathrm{MTF}_{\mathrm{vel}} = \frac{\sin\!\left(\frac{\pi}{2}\,\frac{\Delta V}{V}\,N\,\frac{f_{\mathrm{sig}}}{f_N}\right)}{\frac{\pi}{2}\,\frac{\Delta V}{V}\,N\,\frac{f_{\mathrm{sig}}}{f_N}},

with fsig/fNf_{\mathrm{sig}}/f_N the spatial frequency relative to the Nyquist frequency, together with a similar term for an angular misalignment of the rows with the direction of motion (Bulayev, 2012, Eqs. 2 and 3). This is the transfer function of a box of width N ΔV/VN\,\Delta V/V pixels (our reading). The note reports that a 2% to 4% mismatch has been found acceptable for 96-stage devices used in semiconductor inspection.

EMVA 1288 covers line-scan cameras as well as area-scan ones, and for a TDI sensor it multiplies the exposure time by the TDI factor when it converts irradiance to photons per pixel (EMVA 1288, Sections 1 and 6.4). Bulayev’s note describes TDI with CCDs; for a sensor that accumulates digitally, the example uses our own model of NN separate reads.

Shutters from the vendor’s side

SensorShutterMode offers Global, Rolling and GlobalReset (SFNC 2.8, Section 4.7); the digital camera article defines the three, and the rolling shutter article works out the geometry of the second. On a datasheet the shutter type sits next to the overlap capability: EMVA 1288 asks vendors to state whether the readout of frame nn and the exposure of frame n+1n + 1 can happen at the same time (overlapping) or only one after the other (EMVA 1288, Section 10.1). Overlap decides whether the frame period is set by exposure plus readout or by the longer of the two (reasoning from the definition).

Taps

A sensor or its converter may deliver several pixels at once. SFNC names SensorTaps, the number of taps of the sensor, and SensorDigitizationTaps, the number of samples the A/D conversion stage outputs simultaneously (SFNC 2.8, Sections 4.8 and 4.9). Bulayev (2012) notes that multiport CCDs read faster but need well-matched output circuits, otherwise the part of the image served by one amplifier can differ in contrast from the rest.

Binning, decimation and regions of interest

Three features reduce the number of pixels, and they act in a fixed order. Binning or decimation first shrinks the sensor’s SensorWidth × SensorHeight pixels to WidthMax × HeightMax; the image can be flipped (ReverseX, ReverseY), which the SFNC places before the region of interest; and the region of interest is set with OffsetX, OffsetY, Width and Height, measured in the shrunk image (SFNC 2.8, Chapter 4).

  • Binning combines neighbouring photosensitive cells. BinningHorizontal and BinningVertical give the number of cells combined, and BinningSelector chooses whether the setting controls the sensor’s binning or that of a region (SFNC 2.8, Sections 4.29–4.33). Each direction has a mode: in Sum the responses are added, “resulting in increased sensitivity”, and in Average they are averaged, “resulting in increased signal/noise ratio” (SFNC 2.8, Sections 4.30 and 4.32). The SFNC does not say whether the combination happens in the charge domain, before readout, or digitally, after it; optical microscopy describes charge binning of 2 × 2 pixels before readout, which raises the signal about fourfold relative to the read noise. For measurements on a binned camera, EMVA 1288 multiplies the pixel area by the binning factors (EMVA 1288, Section 6.4).
  • Decimation subsamples: DecimationHorizontalMode and DecimationVerticalMode either keep every NNth pixel (Discard) or average a group of NN adjacent pixels (Average) (SFNC 2.8, Sections 4.34–4.37). Discarding pixels without averaging lets fine detail alias, as sampling and aliasing explains.
  • Regions of interest stream part of the image, and the SFNC allows several regions selected with RegionSelector.

Binning, decimation and the region also change the camera’s geometry: the principal point and focal length in pixels change with them, as camera parameters works out for resizing and cropping. Whether a smaller region raises the frame rate depends on the readout. For a sensor that reads rows one after another, the readout time falls with the number of rows read, so a region that is short in the readout direction raises the attainable frame rate, while a narrow but tall region may not (reasoning from row-sequential readout as the image sensor article describes it, not a vendor’s statement).

Sensor format

The sensor’s size, resolution and pixel size are the first lines of an EMVA 1288 datasheet: the sensor type (CCD, CMOS or another), the sensor diagonal in millimetres (the sensor length for line sensors), a lens category in inches, the resolution of the active area and the pixel width and height in micrometres (EMVA 1288, Section 10.1). The lens category states which class of lens covers the sensor; together with the pixel size it links the sensor to the optics, as focal length and field of view and the arithmetic in designing a vision system show. Larger pixels collect more light per pixel, and smaller ones resolve finer detail on the same chip; the image sensor article discusses the trade.

Data It Produces

A machine-vision camera delivers raw or lightly processed frames (or lines) in a declared pixel format. PixelFormat combines what PixelSize, PixelColorFilter and the dynamic-range features state separately: PixelSize is the total number of bits per pixel, from 1 to 96 (SFNC 2.8, Section 4.44), and PixelDynamicRangeMin and PixelDynamicRangeMax give the range the values actually take. The SFNC’s example is a 16-bit format carrying the values of a 12-bit converter (SFNC 2.8, Chapter 4). The full list of standard formats and their bit layouts is the Pixel Format Naming Convention (PFNC 2.5); names such as Mono8, Mono12 and the packed Mono10p distinguish monochrome formats by bit depth and by whether pixels are padded to whole bytes or packed. The SFNC adds that interfaces with frame grabbers may code pixels differently on the cable and leave the conversion to the grabber (SFNC 2.8, PixelFormat). Packing and what a format costs on the link belong to camera interfaces; Industrial Machine Vision tabulates the interfaces.

The choice of bit depth follows the noise. The image sensor article notes that more bits help only while the quantization step is not much smaller than the noise; a deeper format costs bandwidth and memory for every pixel (reasoning). Colour cameras deliver either the raw mosaic of their colour filter array (BayerRG8, BayerRG12 and others) or interpolated colour; for measurement the raw form keeps the linear response. Metadata such as a timestamp and the exposure actually used can travel with each frame as chunk data, which the digital camera article describes.

Characteristics

Reading an EMVA 1288 datasheet

Camera datasheets are comparable only when they are measured the same way, which is what EMVA 1288 provides (the image sensor article describes the method). A compliant datasheet has a general part with the test equipment, the release of the standard used, the camera’s basic parameters and a summary of the operating points measured, and for each operating point a summary page with the photon transfer curve, the SNR curve and a table of all parameters (EMVA 1288, Section 10.2). Points worth checking when reading one:

  • Type of data. The basic information states whether values are from a single camera, typical, guaranteed, or guaranteed over life time, and how “typical” was defined (EMVA 1288, Section 10.1).
  • Operating point. Every parameter belongs to an operating point (gain, offset, maximum exposure time, camera mode), which must be given completely enough to repeat the measurement; parameters not given are assumed to be factory defaults (EMVA 1288, Section 10.1). Two cameras compared at different gains are not compared.
  • Signal-to-noise ratio. EMVA 1288 defines it as the dark-subtracted mean over the temporal noise (Eq. 20) and gives it in terms of photons as
SNR(μp)=η μpσd2+σq2/K2+η μp,\mathrm{SNR}(\mu_p) = \frac{\eta\,\mu_p}{\sqrt{\sigma_d^2 + \sigma_q^2/K^2 + \eta\,\mu_p}},

with the quantum efficiency η\eta, the dark noise σd\sigma_d in electrons, the quantization noise σq2=1/12\sigma_q^2 = 1/12 DN² and the system gain KK (EMVA 1288, Eq. 21). At high light it grows as ημp\sqrt{\eta\mu_p} and at low light linearly (Eq. 22). Quantum efficiency and dark noise decide the low-light end; saturation capacity decides the maximum SNR and, with the absolute sensitivity threshold, the dynamic range.

  • Readout and interface. The basic information also lists the readout type for CCDs, the shutter type and overlap for CMOS, the maximum readout rate (frames per second, or lines per second for line sensors) at the given operating point, dark current compensation and the interface type (EMVA 1288, Section 10.1).
  • Scope. Release 4.0 Linear applies only to cameras that the linear model describes, with white temporal noise; preprocessing such as debayering, denoising or edge sharpening rules it out (EMVA 1288, Section 1.2).

Variants

  • Cooled and scientific cameras. EMVA 1288 provides for cameras with internal temperature regulation and cooling of the image sensor, whose dark current can then be measured only over the temperatures that can be set (EMVA 1288, Section 7.2); the image sensor article explains that dark current grows with exposure time and rises steeply with temperature.
  • SWIR cameras. Silicon stops at about 1.1 µm (image sensor); the short-wave infrared beyond it needs other detector materials. The thermal and infrared camera article places the bands.
  • Polarization cameras. A polarization camera has JJ channels, each behind a linear polarizer in its own direction. EMVA 1288 characterizes each channel’s response, polarizer orientation and quality, and recommends 1−P1 - P, the inverse of the extinction ratio, over the degree of linear polarization PP, which is close to 1 (EMVA 1288, Section 2.3). PFNC names the filter arrays: POL22M1, for example, is a 2 × 2 array of polarizers at 90°, 45°, 135° and 0° with no colour filter, and colour variants such as POL44C1 combine the four polarizer directions with red, green and blue filters in a 4 × 4 array (PFNC 2.5, Section 3.1.12). Lighting for machine vision explains what polarized light reveals.
  • 3D cameras. The Areascan3D and Linescan3D scan types deliver range or disparity images; structured light, time-of-flight and stereo cameras are the usual principles.
  • TDI cameras for low light and X-ray. Bulayev (2012) describes back-thinned TDI-CCDs for ultraviolet and deep-ultraviolet wafer and reticle inspection, TDI for automated optical inspection of circuit boards, and X-ray TDI cameras for automated X-ray inspection, and gives as an example a sensor of 4096 × 128 active pixels of 12 µm with bidirectional charge transfer and TDI scan rates up to 100 kHz.

Calibration

Two calibrations matter for the device. Radiometric calibration subtracts the dark signal and divides by a flat field to remove the dark-signal and photo-response nonuniformities that EMVA 1288 measures (the image sensor article gives the method); for a line-scan camera this is a per-column correction, since every image line comes from the same pixels (reasoning). Geometric calibration maps pixels to the scene; for area-scan cameras it is camera calibration, and for line-scan cameras the pixel pitch along the motion is set by the trigger or the line rate, as Industrial Machine Vision describes. Any change of binning, decimation or region changes the intrinsic parameters, and a camera calibrated in one mode must be recalibrated, or its parameters converted, for another (camera parameters).

Processing the Data

Example: TDI and binning against read noise

The example simulates a sensor with the EMVA 1288 linear model and compares the ways a camera can add light: a single line, charge-domain TDI, digital accumulation of NN reads, and 2 × 2 binning in the SFNC’s Sum and Average modes. A second part runs a TDI register stage by stage with a line rate that does not match the web speed.

Set-up and conventions. Signals are photoelectrons: μ\mu is the mean number per pixel per line period, with the quantum efficiency folded in, drawn from a Poisson distribution. Each readout adds Gaussian read noise of 10 electrons, multiplies by a gain K=0.5K = 0.5 DN/e⁻ and rounds to an integer (NumPy’s rint, ties to even), so that σ2=σd2+σq2/K2=100.33\sigma^2 = \sigma_d^2 + \sigma_q^2/K^2 = 100.33 e⁻². There is no offset, clipping, saturation, dark current or nonuniformity. SNR is the mean over the standard deviation of the output with the zero offset known (EMVA 1288, Eq. 20). The cases are:

  • (a) a single line, 16 million samples per light level;
  • (b) charge TDI with N∈{4,16,64}N \in \{4, 16, 64\}: one Poisson draw of NμN\mu per pixel (the sum of NN independent stage charges, exact in distribution for perfect synchronization), one read, one rounding; one million samples;
  • (c) digital accumulation: NN separate exposures, each read and rounded, summed in DN; this is our model of a sensor that accumulates digitally;
  • (d) 2 × 2 binning of an area sensor on the same flat scene, in the charge domain (four cells’ charge summed, one read) and in the digital domain (four reads summed), each delivered as Sum, as Average (Sum/4 as a float) and as Average rounded to an integer DN, because a camera’s pixel format is an integer; the SFNC leaves both choices open, so all six are printed;
  • (e) a charge TDI register with N∈{1,4,16,64}N \in \{1, 4, 16, 64\} stages, stepped one line period at a time. Each stage integrates for the whole period over a 1-pixel row with full fill factor; the charge moves one row per period, while the image moves 1+ε1 + \varepsilon rows per period, so ε>0\varepsilon > 0 means the line rate is too low for the web. Output line kk is the packet that entered stage 0 in period kk, so successive output lines are 1+ε1 + \varepsilon object pixels apart, and widths are measured in output lines. The web has a sharp edge from reflectance 0.2 to 1.0, 2000 electrons per stage-period at reflectance 1. Its position is shifted by a different sub-pixel phase in each of 2000 columns, which gives a finely sampled edge spread function (binned at 0.05 lines), whose 10–90% width is the measure.

The closed forms are EMVA 1288’s Eq. 21 with NμN\mu electrons and one read, SNRN=Nμ/Nμ+σ2\mathrm{SNR}_N = N\mu/\sqrt{N\mu + \sigma^2}, for (a) and (b); N SNR1\sqrt{N}\,\mathrm{SNR}_1 for (c); and for (d) the variance of each output (for the rounded Average, a quarter of the Sum’s standard deviation with 3/323/32 DN² added, the variance of rounding an integer divided by 4, our derivation). The gain G=SNRN/SNR1G = \mathrm{SNR}_N/\mathrm{SNR}_1 then tends to NN when Nμ≪σ2N\mu \ll \sigma^2 and to N\sqrt{N} when μ≫σ2\mu \gg \sigma^2, while digital accumulation gains exactly N\sqrt{N} (our derivation from these forms). For (e), the prediction is a box-smear model in the form of Bulayev’s Eq. 2: the zero-mismatch spread of one stage-period (a triangle from −1 to 1 pixel, the pixel aperture moved by one pixel) convolved with a box of width NεN\varepsilon pixels, converted to output lines by dividing by 1+ε1 + \varepsilon. Measured SNRs are compared with the closed forms in standard errors, SE/SNR=1/(M SNR2)+1/(2M)\mathrm{SE}/\mathrm{SNR} = \sqrt{1/(M\,\mathrm{SNR}^2) + 1/(2M)} for MM samples.

Checks and hypotheses. Five checks test the code: C1, that at ε=0\varepsilon = 0 the noise-free register gives exactly NN times the single line (10−1210^{-12}); C2, that the noise-free single-line edge has the triangle’s 10–90% width 2(1−0.2)=1.105572(1 - \sqrt{0.2}) = 1.10557 lines (within 0.005); C3, that the register’s plateau means equal KNμrKN\mu r within 5 SE; C4, that the dark noise equals K2σd2+1/12\sqrt{K^2\sigma_d^2 + 1/12} within 4 SE; and C6, that the means of all 56 SNR conditions are within 5 SE of KNμKN\mu. The hypotheses were: (H1a) charge TDI and the single line match their closed forms within 4 SE at every level; (H1b) at μ=0.25\mu = 0.25, G/N≥0.90G/N \ge 0.90 for every NN, and at μ=4096\mu = 4096, ∣G/N−1∣≤0.02|G/\sqrt{N} - 1| \le 0.02; (H2a) digital accumulation matches its closed form within 4 SE; (H2b) at μ=0.25\mu = 0.25 the ratio of charge to digital SNR is at least 0.90N0.90\sqrt{N}, and (H2c) at μ=4096\mu = 4096 it is within 0.02 of 1; (H3), the batch plan’s hypothesis that Sum and Average give the same SNR, differing only in scale: the SNR ratio Average/Sum within 0.01 of 1 for the float Average (H3a, which holds by construction, since the Average is the Sum divided by 4) and the rounded Average (H3b), with (H3c) each of the six outputs within 4 SE of its closed form; (H4), the batch plan’s hypothesis that a mismatch widens the edge by about NεN\varepsilon lines, tested as ∣Δw/(Nε)−1∣≤0.25|\Delta w/(N\varepsilon) - 1| \le 0.25 for every ε>0\varepsilon > 0 and N>1N > 1; (H4a) the measured width within 0.07 lines of the box-smear prediction; and (H4b) the width increasing with ε\varepsilon for every N>1N > 1.

Our derivation, written before any script ran, predicted that H3b would fail for charge binning at low light (its estimate of the ratio, about 0.975 at μ=0.25\mu = 0.25, added a rounding variance of 1/12 DN² to the rounded Average), and that H4 would fail, because the 10–90% width of a box is only 0.8 of its width and convolving it with the one-period triangle makes the widening smaller still.

Process. The hypotheses and most bars were written in a file before any script for this article existed. Two planning scripts then ran the full example at seed 100 and printed every outcome before the plan was frozen, so the example illustrates the derivations rather than testing them. After the first planning script, the closed form of the rounded Average’s variance was corrected from the continuous 1/121/12 DN² to 3/323/32 DN²: the script had printed z=−3.32z = -3.32 for that output, and an integer Sum divided by 4 leaves residues 0, ¼, ½ and ¾, whose rounding errors have variance 3/32, not 1/12. The two bars left open in that file, C2’s 0.005 lines and H4a’s 0.07 lines, were set after that script had printed the values they bound. The pilot ran the planned script at seed 0; the first run is that script with one print-format change (C2’s line printed the name of its bar instead of the value). Pilot and first run printed the same outcomes.

import os
os.environ["OPENBLAS_NUM_THREADS"] = os.environ["OMP_NUM_THREADS"] = "1"
import numpy as np
from scipy.optimize import brentq

SEED = 0
# Sensor (EMVA 1288 linear model): electrons -> read noise -> gain -> rounding to integer DN.
K, SIG_D = 0.5, 10.0                     # system gain DN/e-, read (dark) noise e- per read
SIG2 = SIG_D**2 + (1 / 12) / K**2        # sigma_d^2 + sigma_q^2 / K^2, in e-^2
LEVELS = [0.25, 1, 4, 16, 64, 256, 1024, 4096]   # mu: photoelectrons per stage per line period
NS = [4, 16, 64]
M1, M, CHUNK = 16_000_000, 1_000_000, 1_000_000


def rng(*key):
    return np.random.default_rng((SEED,) + key)


def read(e, g):                          # one readout of a charge packet e (electrons)
    return np.rint(K * (e + SIG_D * g.standard_normal(np.shape(e))))


def moments(draw, m, g, n_out=1):
    """Mean and variance of each output of draw(n, g), pooled over chunks."""
    parts = [[] for _ in range(n_out)]
    for start in range(0, m, CHUNK):
        n = min(CHUNK, m - start)
        ys = draw(n, g)
        ys = ys if isinstance(ys, tuple) else (ys,)
        for i, y in enumerate(ys):
            parts[i].append((n, y.mean(), y.var()))
    res = []
    for p in parts:
        n = np.array([q[0] for q in p], float)
        mu = np.array([q[1] for q in p])
        v = np.array([q[2] for q in p])
        mean = (n * mu).sum() / n.sum()
        var = ((n * v).sum() + (n * (mu - mean) ** 2).sum()) / (n.sum() - 1)
        res.append((mean, var))
    return res


def rse_snr(snr, m):                     # relative standard error of an SNR estimate
    return np.sqrt(1 / (m * snr**2) + 1 / (2 * m))


def snr_line(mu, n):                     # EMVA 1288 Eq. 21 with n * mu electrons, one read
    return n * mu / np.sqrt(n * mu + SIG2)


# ---------------- Checks on the SNR model ----------------
print("== Checks")
(m0, v0), = moments(lambda n, g: read(g.poisson(0.0, n), g), M1, rng(9))
s_pred = np.sqrt(K**2 * SIG_D**2 + 1 / 12)
z = (np.sqrt(v0) - s_pred) / (s_pred / np.sqrt(2 * M1))
print(f"C4 dark std {np.sqrt(v0):.5f} DN vs sqrt(K^2 sd^2 + 1/12) = {s_pred:.5f}: z = {z:+.2f} "
      f"(bar |z| <= 4) -> {'held' if abs(z) <= 4 else 'failed'}")

# ---------------- (a)-(c): single line, charge TDI, digital accumulation ----------------
res = {}
c6 = []
for li, mu in enumerate(LEVELS):
    (m1, v1), = moments(lambda n, g: read(g.poisson(mu, n), g), M1, rng(1, li))
    res[mu, 1] = (m1, v1)
    c6.append(("line", mu, 1, m1, K * mu, np.sqrt(v1 / M1)))
    for N in NS:
        (mc, vc), = moments(lambda n, g: read(g.poisson(N * mu, n), g), M, rng(2, li, N))

        def digital(n, g, N=N):
            y = np.zeros(n)
            for _ in range(N):           # N separate exposures, each read and digitized
                y += read(g.poisson(mu, n), g)
            return y

        (md, vd), = moments(digital, M, rng(3, li, N))
        res[mu, "c", N], res[mu, "d", N] = (mc, vc), (md, vd)
        c6.append(("charge", mu, N, mc, K * N * mu, np.sqrt(vc / M)))
        c6.append(("digital", mu, N, md, K * N * mu, np.sqrt(vd / M)))

zs = [(m - e) / se for (_, _, _, m, e, se) in c6]
print(f"C6 means of {len(c6)} SNR conditions vs K N mu: max |z| = {max(abs(np.array(zs))):.2f} "
      f"(bar 5) -> {'held' if max(abs(np.array(zs))) <= 5 else 'failed'}")

print("\n== (a)-(c) SNR per output pixel: measured, closed form, z (bar |z| <= 4)")
print("    mu   N | single/charge TDI: SNR meas   closed      z |  gain G   G/N    G/sqrtN"
      " | digital: SNR meas   closed      z | (charge/digital)/sqrtN")
h1a = h2a = True
for mu in LEVELS:
    m1, v1 = res[mu, 1]
    s1, c1 = m1 / np.sqrt(v1), snr_line(mu, 1)
    z1 = (s1 - c1) / (c1 * rse_snr(c1, M1))
    h1a &= abs(z1) <= 4
    print(f"{mu:6g}   1 | {s1:23.5f} {c1:8.5f} {z1:+6.2f} |")
    for N in NS:
        mc, vc = res[mu, "c", N]
        md, vd = res[mu, "d", N]
        sc, cc = mc / np.sqrt(vc), snr_line(mu, N)
        sd, cd = md / np.sqrt(vd), np.sqrt(N) * c1
        zc = (sc - cc) / (cc * rse_snr(cc, M))
        zd = (sd - cd) / (cd * rse_snr(cd, M))
        h1a &= abs(zc) <= 4
        h2a &= abs(zd) <= 4
        G = sc / s1
        print(f"{'':6s} {N:3d} | {sc:23.5f} {cc:8.5f} {zc:+6.2f} | {G:7.4f} {G / N:6.4f} "
              f"{G / np.sqrt(N):7.4f} | {sd:17.5f} {cd:8.5f} {zd:+6.2f} | {sc / sd / np.sqrt(N):.4f}")

print("\n== Hypotheses (a)-(c)")
print(f"H1a charge TDI and single line within 4 SE of closed form at every level and N: "
      f"{'held' if h1a else 'failed'}")
lo, hi = LEVELS[0], LEVELS[-1]
for N in NS:
    G_lo = (res[lo, "c", N][0] / np.sqrt(res[lo, "c", N][1])) / (res[lo, 1][0] / np.sqrt(res[lo, 1][1]))
    G_hi = (res[hi, "c", N][0] / np.sqrt(res[hi, "c", N][1])) / (res[hi, 1][0] / np.sqrt(res[hi, 1][1]))
    print(f"H1b N={N:2d}: mu={lo:g} G/N = {G_lo / N:.4f} (bar >= 0.90) -> "
          f"{'held' if G_lo / N >= 0.90 else 'failed'}; mu={hi:g} G/sqrtN - 1 = "
          f"{G_hi / np.sqrt(N) - 1:+.4f} (bar |.| <= 0.02) -> "
          f"{'held' if abs(G_hi / np.sqrt(N) - 1) <= 0.02 else 'failed'}")
print(f"H2a digital accumulation within 4 SE of closed form at every level and N: "
      f"{'held' if h2a else 'failed'}")
for N in NS:
    r = {mu: (res[mu, "c", N][0] / np.sqrt(res[mu, "c", N][1]))
         / (res[mu, "d", N][0] / np.sqrt(res[mu, "d", N][1])) for mu in (lo, hi)}
    print(f"H2b N={N:2d}: mu={lo:g} (charge/digital)/sqrtN = {r[lo] / np.sqrt(N):.4f} (bar >= 0.90) -> "
          f"{'held' if r[lo] / np.sqrt(N) >= 0.90 else 'failed'};  "
          f"H2c mu={hi:g} charge/digital - 1 = {r[hi] - 1:+.4f} (bar |.| <= 0.02) -> "
          f"{'held' if abs(r[hi] - 1) <= 0.02 else 'failed'}")

# ---------------- (d) 2 x 2 binning, SFNC Sum and Average ----------------
print("\n== (d) 2x2 binning on an area sensor (per-cell mu): SNR meas [z vs closed form]")
print("domain     mu |      Sum            Average        Average(rounded) | Avg/Sum   AvgR/Sum"
      " | scale Sum/Avg  Sum/AvgR")
h3a = h3b = h3c = True
for dom in ("charge", "digital"):
    for li, mu in enumerate(LEVELS):
        if dom == "charge":
            def draw(n, g):
                s = read(g.poisson(mu, (4, n)).sum(0), g)       # charge of 4 cells, one read
                return s, s / 4, np.rint(s / 4)
            v_sum = K**2 * (4 * mu + SIG_D**2) + 1 / 12
        else:
            def draw(n, g):
                s = read(g.poisson(mu, (4, n)), g).sum(0)       # 4 reads, summed in DN
                return s, s / 4, np.rint(s / 4)
            v_sum = 4 * (K**2 * (mu + SIG_D**2) + 1 / 12)
        out = moments(draw, M, rng(4, dom == "charge", li), n_out=3)
        mean_c = [4 * K * mu, K * mu, K * mu]
        var_c = [v_sum, v_sum / 16, v_sum / 16 + 3 / 32]   # rounding an integer / 4: residues 0, 1/4, 1/2, 3/4
        snr = [m / np.sqrt(v) for m, v in out]
        snr_c = [mc / np.sqrt(vc) for mc, vc in zip(mean_c, var_c)]
        zz = [(s - c) / (c * rse_snr(c, M)) for s, c in zip(snr, snr_c)]
        h3c &= max(abs(np.array(zz))) <= 4
        ra, rr = snr[1] / snr[0], snr[2] / snr[0]
        h3a &= abs(ra - 1) <= 0.01
        h3b &= abs(rr - 1) <= 0.01
        print(f"{dom:8s} {mu:6g} | " + "  ".join(f"{s:9.5f} [{z:+5.2f}]" for s, z in zip(snr, zz))
              + f" | {ra:.6f}  {rr:.6f} | {out[0][0] / out[1][0]:.6f}  {out[0][0] / out[2][0]:.6f}")
print(f"H3a SNR(Average)/SNR(Sum) within 0.01 of 1, every domain and level: {'held' if h3a else 'failed'}")
print(f"H3b SNR(Average rounded)/SNR(Sum) within 0.01 of 1, every domain and level: "
      f"{'held' if h3b else 'failed'}")
print(f"H3c all six binning outputs within 4 SE of closed form: {'held' if h3c else 'failed'}")

# ---------------- (e) charge TDI register with a line-rate mismatch ----------------
W, MU_E, BIN = 2000, 2000.0, 0.05
TOL_C2, TOL_H4A = 0.005, 0.07   # lines; set after reach.py (PLAN)
EPS = [0.0, 0.01, 0.03, 0.1]


def P_ge(c, b):
    """P(a - b*tau >= c) for a, tau ~ U(0, 1): fraction of a stage-period seeing the bright side."""
    def H(x):
        return np.where(x < 0, 0.0, np.where(x <= 1, 0.5 * x * x, x - 0.5))
    return (H(1 - c) - H(1 - c - b)) / b


def tdi_register(N, eps, g, noise=True):
    """N-stage TDI: the image moves 1+eps rows per line period, charge moves 1 row."""
    b = 1 + eps
    ks = np.arange(-int(np.ceil(N * eps)) - 6, 7)          # output line indices
    phi = b * (np.arange(W) + 0.5) / W                     # edge phase per column (object pixels)
    j = np.arange(N)[:, None]
    reg, out = np.zeros((N, W)), {}
    for p in range(ks[0], ks[-1] + N):                     # line periods
        lam = MU_E * (0.2 + 0.8 * P_ge(-phi[None, :] - j + b * p, b))
        reg += g.poisson(lam) if noise else lam            # every stage integrates
        if p - (N - 1) >= ks[0]:
            out[p - (N - 1)] = reg[-1].copy()              # last stage is read out
        reg = np.roll(reg, 1, axis=0)                      # charge shifts one row
        reg[0] = 0.0
    e = np.array([out[k] for k in ks])
    y = read(e, g) if noise else K * e
    return ks, phi, y


def width_1090(ks, phi, y, N, eps):
    b = 1 + eps
    x = (ks[:, None] - phi[None, :] / b).ravel()           # position relative to the edge, lines
    v = ((y / (K * N * MU_E) - 0.2) / 0.8).ravel()         # edge spread function, 1 -> 0
    idx = np.floor((x - x.min()) / BIN).astype(int)
    cnt = np.bincount(idx)
    esf = np.bincount(idx, v) / cnt
    xc = x.min() + (np.arange(len(cnt)) + 0.5) * BIN

    def cross(level):
        i = np.argmax(esf <= level)
        return xc[i - 1] + (esf[i - 1] - level) / (esf[i - 1] - esf[i]) * BIN
    return cross(0.1) - cross(0.9)


def w_pred(N, eps):
    """Box-smear model: triangle(-1, 1) convolved with a box of width N*eps, in lines."""
    w = N * eps

    def Ftri(u):
        return np.where(u < -1, 0, np.where(u <= 0, (u + 1) ** 2 / 2, np.where(u <= 1, 1 - (1 - u) ** 2 / 2, 1)))

    def Gtri(u):
        return np.where(u < -1, 0, np.where(u <= 0, (u + 1) ** 3 / 6, np.where(u <= 1, u + (1 - u) ** 3 / 6, u)))

    def cdf(t):
        return Ftri(t) if w == 0 else (Gtri(t + w) - Gtri(t)) / w
    t10 = brentq(lambda t: cdf(t) - 0.1, -1 - w - 1, 2)
    t90 = brentq(lambda t: cdf(t) - 0.9, -1 - w - 1, 2)
    return (t90 - t10) / (1 + eps)


print("\n== (e) charge TDI with line-rate mismatch eps: 10-90% edge width in output lines")
ks0, phi0, y1 = tdi_register(1, 0.0, None, noise=False)
w_tri = 2 * (1 - np.sqrt(0.2))
w_c2 = width_1090(ks0, phi0, y1, 1, 0.0)
print(f"C2 noise-free N=1 eps=0 width {w_c2:.5f} vs triangle 2(1-sqrt(0.2)) = {w_tri:.5f}: "
      f"diff {w_c2 - w_tri:+.5f} (bar |.| <= {TOL_C2}) -> {'held' if abs(w_c2 - w_tri) <= TOL_C2 else 'failed'}")
c1 = 0.0
for N in NS:
    ks, phi, yN = tdi_register(N, 0.0, None, noise=False)
    c1 = max(c1, np.max(np.abs(yN - N * y1) / (N * y1)))
print(f"C1 noise-free eps=0: max rel |profile(N) - N profile(1)| = {c1:.2e} (bar 1e-12) -> "
      f"{'held' if c1 <= 1e-12 else 'failed'}")
print("   N   eps   N*eps | w exact   w meas   w pred  meas-pred | dw meas  dw/(N eps) | C3 plateau z (0.2, 1.0)")
wm = {}
h4a = h4 = h4b = c3 = True
for N in [1] + NS:
    for ei, eps in enumerate(EPS):
        ks, phi, y = tdi_register(N, eps, rng(5, N, ei))
        _, _, yx = tdi_register(N, eps, None, noise=False)
        w_ex, w_ms, w_pr = width_1090(ks, phi, yx, N, eps), width_1090(ks, phi, y, N, eps), w_pred(N, eps)
        wm[N, eps] = w_ms
        h4a &= abs(w_ms - w_pr) <= TOL_H4A
        zp = []
        for rows, r in ((slice(None, 3), 1.0), (slice(-4, None), 0.2)):
            yy = y[rows]
            mean_c = K * N * MU_E * r
            se = np.sqrt((K**2 * (N * MU_E * r + SIG_D**2) + 1 / 12) / yy.size)
            zp.append((yy.mean() - mean_c) / se)
        c3 &= max(abs(np.array(zp))) <= 5
        line = f"{N:4d} {eps:5.2f} {N * eps:6.2f} | {w_ex:7.4f} {w_ms:8.4f} {w_pr:8.4f} {w_ms - w_pr:+9.4f} |"
        if eps > 0:
            dw = w_ms - wm[N, 0.0]
            line += f" {dw:7.4f} {dw / (N * eps):10.4f}"
            if N > 1:
                h4 &= abs(dw / (N * eps) - 1) <= 0.25
                h4b &= w_ms > wm[N, EPS[ei - 1]]
        else:
            line += " " * 19
        print(line + f" | {zp[1]:+5.2f} {zp[0]:+5.2f}")
print(f"C3 plateau means within 5 SE of K N mu r for every (N, eps): {'held' if c3 else 'failed'}")
print(f"H4a |w meas - w pred| <= {TOL_H4A} lines for every (N, eps): {'held' if h4a else 'failed'}")
print(f"H4  |dw/(N eps) - 1| <= 0.25 for every eps > 0, N > 1: {'held' if h4 else 'failed'}")
print(f"H4b w increases with eps for every N > 1: {'held' if h4b else 'failed'}")

Output (NumPy 2.3.5, SciPy 1.16.3):

== Checks
C4 dark std 5.00711 DN vs sqrt(K^2 sd^2 + 1/12) = 5.00833: z = -1.38 (bar |z| <= 4) -> held
C6 means of 56 SNR conditions vs K N mu: max |z| = 2.93 (bar 5) -> held

== (a)-(c) SNR per output pixel: measured, closed form, z (bar |z| <= 4)
    mu   N | single/charge TDI: SNR meas   closed      z |  gain G   G/N    G/sqrtN | digital: SNR meas   closed      z | (charge/digital)/sqrtN
  0.25   1 |                 0.02545  0.02493  +2.10 |
         4 |                 0.09967  0.09934  +0.33 |  3.9160 0.9790  1.9580 |           0.04996  0.04985  +0.10 | 0.9976
        16 |                 0.39014  0.39161  -1.42 | 15.3277 0.9580  3.8319 |           0.10058  0.09971  +0.87 | 0.9697
        64 |                 1.48573  1.48343  +1.58 | 58.3715 0.9121  7.2964 |           0.19940  0.19942  -0.02 | 0.9314
     1   1 |                 0.09914  0.09934  -0.81 |
         4 |                 0.39181  0.39161  +0.20 |  3.9523 0.9881  1.9761 |           0.19935  0.19868  +0.66 | 0.9827
        16 |                 1.48364  1.48343  +0.14 | 14.9657 0.9354  3.7414 |           0.39901  0.39736  +1.59 | 0.9296
        64 |                 4.98950  4.99249  -0.81 | 50.3300 0.7864  6.2912 |           0.79431  0.79472  -0.36 | 0.7852
     4   1 |                 0.39143  0.39161  -0.67 |
         4 |                 1.48223  1.48343  -0.83 |  3.7867 0.9467  1.8933 |           0.78322  0.78321  +0.01 | 0.9462
        16 |                 4.99294  4.99249  +0.12 | 12.7556 0.7972  3.1889 |           1.56676  1.56642  +0.23 | 0.7967
        64 |                13.55561 13.56163  -0.62 | 34.6310 0.5411  4.3289 |           3.13373  3.13284  +0.37 | 0.5407
    16   1 |                 1.48398  1.48343  +1.52 |
         4 |                 4.99432  4.99249  +0.50 |  3.3655 0.8414  1.6827 |           2.96587  2.96687  -0.43 | 0.8420
        16 |                13.55192 13.56163  -1.01 |  9.1321 0.5708  2.2830 |           5.93580  5.93373  +0.48 | 0.5708
        64 |                30.55343 30.53883  +0.68 | 20.5888 0.3217  2.5736 |          11.86878 11.86746  +0.16 | 0.3218
    64   1 |                 4.99131  4.99249  -1.29 |
         4 |                13.55321 13.56163  -0.87 |  2.7154 0.6788  1.3577 |           9.97676  9.98498  -1.15 | 0.6792
        16 |                30.50841 30.53883  -1.41 |  6.1123 0.3820  1.5281 |          19.99286 19.96996  +1.62 | 0.3815
        64 |                63.18879 63.23026  -0.93 | 12.6598 0.1978  1.5825 |          39.98442 39.93991  +1.57 | 0.1975
   256   1 |                13.55985 13.56163  -0.74 |
         4 |                30.54669 30.53883  +0.36 |  2.2527 0.5632  1.1264 |          27.08803 27.12325  -1.83 | 0.5638
        16 |                63.25214 63.23026  +0.49 |  4.6647 0.2915  1.1662 |          54.22975 54.24650  -0.44 | 0.2916
        64 |               127.65168 127.60986  +0.46 |  9.4139 0.1471  1.1767 |         108.52491 108.49300  +0.42 | 0.1470
  1024   1 |                30.54654 30.53883  +1.43 |
         4 |                63.29479 63.23026  +1.44 |  2.0721 0.5180  1.0360 |          61.14694 61.07766  +1.60 | 0.5176
        16 |               127.46570 127.60986  -1.60 |  4.1728 0.2608  1.0432 |         122.25018 122.15533  +1.10 | 0.2607
        64 |               255.70921 255.80426  -0.53 |  8.3711 0.1308  1.0464 |         244.34815 244.31065  +0.22 | 0.1308
  4096   1 |                63.22675 63.23026  -0.31 |
         4 |               127.67880 127.60986  +0.76 |  2.0194 0.5048  1.0097 |         126.49646 126.46052  +0.40 | 0.5047
        16 |               255.68978 255.80426  -0.63 |  4.0440 0.2528  1.0110 |         252.70567 252.92103  -1.20 | 0.2530
        64 |               512.00352 511.90205  +0.28 |  8.0979 0.1265  1.0122 |         505.52960 505.84207  -0.87 | 0.1266

== Hypotheses (a)-(c)
H1a charge TDI and single line within 4 SE of closed form at every level and N: held
H1b N= 4: mu=0.25 G/N = 0.9790 (bar >= 0.90) -> held; mu=4096 G/sqrtN - 1 = +0.0097 (bar |.| <= 0.02) -> held
H1b N=16: mu=0.25 G/N = 0.9580 (bar >= 0.90) -> held; mu=4096 G/sqrtN - 1 = +0.0110 (bar |.| <= 0.02) -> held
H1b N=64: mu=0.25 G/N = 0.9121 (bar >= 0.90) -> held; mu=4096 G/sqrtN - 1 = +0.0122 (bar |.| <= 0.02) -> held
H2a digital accumulation within 4 SE of closed form at every level and N: held
H2b N= 4: mu=0.25 (charge/digital)/sqrtN = 0.9976 (bar >= 0.90) -> held;  H2c mu=4096 charge/digital - 1 = +0.0093 (bar |.| <= 0.02) -> held
H2b N=16: mu=0.25 (charge/digital)/sqrtN = 0.9697 (bar >= 0.90) -> held;  H2c mu=4096 charge/digital - 1 = +0.0118 (bar |.| <= 0.02) -> held
H2b N=64: mu=0.25 (charge/digital)/sqrtN = 0.9314 (bar >= 0.90) -> held;  H2c mu=4096 charge/digital - 1 = +0.0128 (bar |.| <= 0.02) -> held

== (d) 2x2 binning on an area sensor (per-cell mu): SNR meas [z vs closed form]
domain     mu |      Sum            Average        Average(rounded) | Avg/Sum   AvgR/Sum | scale Sum/Avg  Sum/AvgR
charge     0.25 |   0.09836 [-0.97]    0.09836 [-0.97]    0.09579 [-0.74] | 1.000000  0.973786 | 4.000000  3.993483
charge        1 |   0.39130 [-0.29]    0.39130 [-0.29]    0.38015 [-0.64] | 1.000000  0.971504 | 4.000000  4.003567
charge        4 |   1.48402 [+0.40]    1.48402 [+0.40]    1.44777 [+0.82] | 1.000000  0.975571 | 4.000000  3.999410
charge       16 |   4.98868 [-1.04]    4.98868 [-1.04]    4.89944 [-1.20] | 1.000000  0.982112 | 4.000000  4.000082
charge       64 |  13.55965 [-0.20]   13.55965 [-0.20]   13.44405 [-0.50] | 1.000000  0.991475 | 4.000000  3.999974
charge      256 |  30.50076 [-1.76]   30.50076 [-1.76]   30.41985 [-1.75] | 1.000000  0.997347 | 4.000000  4.000003
charge     1024 |  63.16995 [-1.35]   63.16995 [-1.35]   63.12529 [-1.34] | 1.000000  0.999293 | 4.000000  3.999997
charge     4096 | 127.68171 [+0.80]  127.68171 [+0.80]  127.66068 [+0.82] | 1.000000  0.999835 | 4.000000  4.000001
digital    0.25 |   0.04964 [-0.21]    0.04964 [-0.21]    0.04916 [-0.32] | 1.000000  0.990344 | 4.000000  4.009372
digital       1 |   0.19572 [-2.93]    0.19572 [-2.93]    0.19451 [-2.69] | 1.000000  0.993824 | 4.000000  3.995531
digital       4 |   0.78401 [+0.70]    0.78401 [+0.70]    0.77838 [+0.65] | 1.000000  0.992815 | 4.000000  3.999920
digital      16 |   2.96507 [-0.77]    2.96507 [-0.77]    2.94610 [-0.79] | 1.000000  0.993603 | 4.000000  4.000104
digital      64 |   9.98383 [-0.16]    9.98383 [-0.16]    9.93849 [-0.17] | 1.000000  0.995458 | 4.000000  4.000049
digital     256 |  27.10525 [-0.94]   27.10525 [-0.94]   27.04697 [-1.01] | 1.000000  0.997850 | 4.000000  4.000012
digital    1024 |  61.05706 [-0.48]   61.05706 [-0.48]   61.01272 [-0.56] | 1.000000  0.999274 | 4.000000  4.000000
digital    4096 | 126.47349 [+0.15]  126.47349 [+0.15]  126.45196 [+0.16] | 1.000000  0.999830 | 4.000000  4.000001
H3a SNR(Average)/SNR(Sum) within 0.01 of 1, every domain and level: held
H3b SNR(Average rounded)/SNR(Sum) within 0.01 of 1, every domain and level: failed
H3c all six binning outputs within 4 SE of closed form: held

== (e) charge TDI with line-rate mismatch eps: 10-90% edge width in output lines
C2 noise-free N=1 eps=0 width 1.10766 vs triangle 2(1-sqrt(0.2)) = 1.10557: diff +0.00209 (bar |.| <= 0.005) -> held
C1 noise-free eps=0: max rel |profile(N) - N profile(1)| = 3.98e-15 (bar 1e-12) -> held
   N   eps   N*eps | w exact   w meas   w pred  meas-pred | dw meas  dw/(N eps) | C3 plateau z (0.2, 1.0)
   1  0.00   0.00 |  1.1077   1.1048   1.1056   -0.0008 |                    | +0.86 +0.09
   1  0.01   0.01 |  1.1020   1.1036   1.0946   +0.0089 | -0.0012    -0.1196 | -0.19 +1.85
   1  0.03   0.03 |  1.0911   1.0887   1.0735   +0.0151 | -0.0161    -0.5364 | -0.97 +1.44
   1  0.10   0.10 |  1.0575   1.0557   1.0068   +0.0489 | -0.0491    -0.4909 | -1.10 -0.10
   4  0.00   0.00 |  1.1077   1.1081   1.1056   +0.0026 |                    | +1.52 +0.26
   4  0.01   0.04 |  1.1016   1.0995   1.0949   +0.0046 | -0.0087    -0.2166 | -0.88 -0.75
   4  0.03   0.12 |  1.0939   1.0923   1.0760   +0.0163 | -0.0159    -0.1322 | +0.18 +2.34
   4  0.10   0.40 |  1.0818   1.0789   1.0326   +0.0462 | -0.0293    -0.0732 | +1.56 +1.21
  16  0.00   0.00 |  1.1077   1.1070   1.1056   +0.0014 |                    | +1.79 -0.86
  16  0.01   0.16 |  1.1059   1.1064   1.0994   +0.0070 | -0.0007    -0.0041 | +0.83 +1.49
  16  0.03   0.48 |  1.1330   1.1339   1.1161   +0.0178 |  0.0269     0.0560 | -0.55 +0.17
  16  0.10   1.60 |  1.5116   1.5082   1.4791   +0.0291 |  0.4012     0.2507 | -0.23 -0.20
  64  0.00   0.00 |  1.1077   1.1076   1.1056   +0.0020 |                    | +0.09 -1.53
  64  0.01   0.64 |  1.1802   1.1805   1.1737   +0.0068 |  0.0729     0.1139 | +1.49 +0.05
  64  0.03   1.92 |  1.7800   1.7797   1.7702   +0.0096 |  0.6721     0.3501 | +0.47 +0.83
  64  0.10   6.40 |  4.6752   4.6799   4.6697   +0.0102 |  3.5723     0.5582 | +0.51 -0.39
C3 plateau means within 5 SE of K N mu r for every (N, eps): held
H4a |w meas - w pred| <= 0.07 lines for every (N, eps): held
H4  |dw/(N eps) - 1| <= 0.25 for every eps > 0, N > 1: failed
H4b w increases with eps for every N > 1: failed

The script runs in about 25 seconds, and two runs printed identical output.

All five checks held. The register gives exactly NN times the single line when it is synchronized (C1, 3.98×10−153.98 \times 10^{-15}), the noise-free single-line edge differs from the triangle’s width by +0.00209 lines (C2), the plateaus and means agree with their known values (C3, C6), and the dark noise of 5.00711 DN matches the model with quantization (C4).

H1a held: charge TDI and the single line stay within 4 SE of EMVA 1288’s formula at every level and NN (the largest ∣z∣|z| is 2.10, for the single line at μ=0.25\mu = 0.25), which is the Poisson–Gaussian model of image noise applied to NμN\mu electrons and one read. H1b held for every NN: at the lowest light the gain is close to NN (G/N 0.9790, 0.9580 and 0.9121 for 4, 16 and 64 stages), and at the highest G/N−1G/\sqrt{N} - 1 is at most +0.0122. Between the two, G/NG/N falls with the light level, except for 4 stages between the two lowest levels (0.9790, then 0.9881), and the more stages there are, the earlier it leaves the read-limited regime, because NμN\mu reaches σ2\sigma^2 at a lower μ\mu: with 64 stages the gain is already 0.7864 of NN at one electron per stage.

H2a held (largest ∣z∣|z| 1.83, at μ=256\mu = 256 with 4 stages): digital accumulation gains N\sqrt{N} at every level, as its closed form says. H2b held: at 0.25 electrons per stage, charge TDI’s SNR is 0.9976, 0.9697 and 0.9314 times N\sqrt{N} that of digital accumulation. H2c held: at 4096 electrons the ratio minus 1 is +0.0093, +0.0118 and +0.0128 for 4, 16 and 64 stages. Adding NN reads costs NN times the read-noise variance, which matters only while read noise is a large part of the total; the image sensor article’s remark that many short exposures added together are noisier than one long one is the same effect.

H3a held by construction: the float Average has exactly the Sum’s SNR, and the scale column shows the factor of 4 between them. H3b failed for the charge domain at μ\mu = 0.25, 1, 4 and 16, where the rounded Average’s SNR is 0.973786, 0.971504, 0.975571 and 0.982112 of the Sum’s; it held for charge binning from μ=64\mu = 64 (0.991475 there) and at every level in the digital domain (the closest to the bar is 0.990344, at μ=0.25\mu = 0.25). H3c held (largest ∣z∣|z| 2.93, digital Sum and Average at μ=1\mu = 1).

Charge binning also gives more SNR than digital binning at low light, 0.09836 against 0.04964 at 0.25 electrons per cell, for the same reason as charge TDI against digital accumulation.

H4a held: the largest difference between the stage-by-stage register’s width and the box-smear prediction is +0.0489 lines, for N=1N = 1 and ε=0.1\varepsilon = 0.1; for 64 stages at ε=0.1\varepsilon = 0.1 it is +0.0102 lines. H4 failed for every ε>0\varepsilon > 0 and N>1N > 1: against a bar of 1 ± 0.25, the largest printed Δw/(Nε)\Delta w/(N\varepsilon) is 0.5582 (N=64N = 64, ε=0.1\varepsilon = 0.1) and the smallest −0.2166-0.2166 (N=4N = 4, ε=0.01\varepsilon = 0.01). H4b failed for N=4N = 4, whose width falls at every step of ε\varepsilon (from 1.1081 to 1.0789 lines), and for N=16N = 16 at ε=0.01\varepsilon = 0.01 (1.1070 to 1.1064); it held for N=64N = 64.

With 64 stages, a 3% mismatch takes the edge from 1.1076 to 1.7797 lines, and 10% to 4.6799 lines, while the single line’s measured width is 1.1048 lines at ε=0\varepsilon = 0 and 1.0557 at ε=0.1\varepsilon = 0.1. That is the practical limit on the number of stages that Bulayev describes. Bulayev’s Eq. 2 depends on the mismatch and the number of stages only through their product, which in our reading is why a tolerance such as the reported 2–4% for 96 stages tightens as stages are added.

The outcomes test our model, not a particular sensor. Real TDI sensors saturate and have their own transfer inefficiencies and dark current, and the digital accumulation of case (c) is our model, not a described sensor.

Strengths

  • Control and repeatability. Exposure, gain, triggering, binning and region are set explicitly and stay fixed, so images from different days and stations are comparable.
  • Linear, measurable output. With processing switched off, the raw output follows the linear model that EMVA 1288 characterizes, which makes noise models, radiometric corrections and photometric methods applicable.
  • Specialized sensors. Line-scan sensors suit continuous webs and long parts (Industrial Machine Vision), TDI adds integration time at high line rates (Bulayev, 2012), and binning trades resolution for SNR at run time.
  • Standard naming. GenICam features let the same software drive cameras from different vendors, as far as they implement the same features.

Limitations

  • Feature support varies. Binning, decimation and the shutter mode are optional SFNC features (SFNC 2.8, Sections 4.7 and 4.29–4.37), and whether binning is done in the charge or the digital domain is not stated by the standard; the example shows that the two give different SNRs.
  • TDI needs synchronization. The line rate must follow the object’s speed, and the number of stages is limited by how accurately it does (Bulayev, 2012); in the example’s 64-stage register, a 10% mismatch widens the edge from 1.1076 to 4.6799 lines.
  • Datasheets need care. EMVA 1288 values hold for one operating point and only for cameras the linear model describes (EMVA 1288, Sections 1.2 and 10.1).
  • No adaptation. Without automatic exposure and processing, the system designer must choose the lighting and settings; exposure treats the trade-offs.

Typical Applications

Machine-vision cameras serve industrial visual inspection and gauging on production lines, robot guidance and code reading (Industrial Machine Vision). Line-scan and TDI cameras image webs, long or rotating parts, circuit boards and wafers; Bulayev (2012) names wafer and reticle inspection, automated optical inspection, document scanning and biomedical and astronomical uses for TDI. Line-scan principles also drive slide scanners in whole-slide imaging and the pushbroom instruments of multispectral satellite imaging. Cooled and scientific cameras serve microscopy (optical microscopy) and astronomy (the image sensor article); polarization cameras measure the polarization whose uses lighting for machine vision describes.

Comparison with Other Sensors

Against a consumer or smartphone camera (Digital Camera), a machine-vision camera gives up automatic processing and image appearance in exchange for control, timing and a linear output. Against an event camera, which reports brightness changes per pixel, it delivers complete frames or lines at a fixed rate. Against a thermal camera, a silicon machine-vision camera sees reflected visible and near-infrared light. 3D cameras deliver range rather than intensity; GenICam names them as scan types of their own.

Choosing a camera

A short checklist, in an order of our choosing; the arithmetic belongs to designing a vision system:

  1. Scan type. Area-scan for discrete parts in a field of view; line-scan for continuous or long objects and rotating parts; TDI when a line camera would be starved of light at the needed line rate.
  2. Resolution and pixel size. From the smallest feature and the field of view; check the lens category against the lens.
  3. Shutter and overlap. Global shutter for moving parts unless the motion during readout is negligible; overlapping readout for high frame rates.
  4. Frame or line rate. At the region and binning that will be used, and within the interface’s bandwidth (Industrial Machine Vision).
  5. Noise and sensitivity. Quantum efficiency at the illumination’s wavelength, dark noise, saturation capacity and dynamic range from an EMVA 1288 datasheet at the intended operating point.
  6. Pixel format and bit depth. Enough bits to resolve the noise, no more than the link and storage need.
  7. Spectrum and filters. Monochrome or colour, NIR, SWIR or polarization.
  8. Triggering, I/O and environment. Trigger inputs, strobe outputs, housing and temperature range, as Industrial Machine Vision describes.

Related

  • Digital Camera

    The camera as an imaging system, from lens, shutter and sensor to the image signal processor that demosaics, white-balances, colour-corrects, tone-maps and compresses its output; RAW against processed images, metadata, machine-vision interfaces, camera classes, and where processing breaks the assumptions of vision methods.

  • Designing a Computer Vision System

    How a working vision system is designed from its requirements, through the choice of sensor, optics, lighting, compute and model, to the data it is trained on, its validation in the field and its maintenance once deployed, with the requirement arithmetic for a measurement station worked through in code.

  • Image Noise

    The random variation in recorded pixel values that does not come from the scene, its physical sources in the camera, and how it is modeled and measured.

  • Exposure

    How much light a camera records in one frame, set by shutter time, aperture and gain; how exposure is counted in stops, metered and controlled automatically, and what each setting costs a vision system in motion blur, noise, depth of field and clipping.

  • Lighting for Machine Vision

    How the geometry, pattern, wavelength and filtering of the light decide which features of a part have contrast in an inspection image, from the law of reflection behind bright field and dark field to domes, coaxial light, colour, pass filters, polarizers and collimation, with an exact rendering of four defects under six lighting geometries.

  • Industrial Visual Inspection

    Using cameras and vision algorithms to check manufactured parts on a production line, from lighting and optics to golden-template comparison, supervised defect models and anomaly detection trained on good parts only, judged by how many defects escape and how many good parts are rejected.

References

  1. European Machine Vision Association (2021). EMVA Standard 1288: Standard for Characterization of Image Sensors and Cameras, Release 4.0 Linear.
  2. European Machine Vision Association (2026). GenICam Standard Features Naming Convention (SFNC), Version 2.8.
  3. European Machine Vision Association (2026). GenICam Pixel Format Naming Convention (PFNC), Version 2.5.
  4. Bulayev, Y. (2012). TDI imaging: An efficient AOI and AXI tool. Technical note, Hamamatsu Corporation (accessed November 2026).