Cover the lens on a 12-bit camera, take a frame in darkness, and the histogram sits near 300 DN — not 0. Flood the sensor with light and the same camera tops out near 3600 DN, 495 codes short of full scale. Both readings are normal sensor behaviour, and treating them as faults leads to wrong measurement math and wasted tuning time. This page explains where the pedestal comes from, how much of a dark frame is genuine dark current, why the top of the range can sit below 4095, and which subtraction makes raw 12-bit data usable for measurement. Anyone doing photometry, SNR work or defect thresholds on raw frames can check every number here on their own bench.
The pedestal: an offset the sensor adds on purpose
A CMOS pixel cannot produce negative charge. Read noise and per-row and per-column offsets swing both directions around true zero, so an output referenced at 0 DN would clip half the noise floor and destroy the low-side information a correction stage needs. Sensor designers therefore bias the output above zero — the black-level pedestal — and expect an ISP, or your own code, to subtract it. Machine-vision cameras expose the offset as a GenICam BlackLevel control; sensor boards and bridge-chip cameras that ship raw frames leave it in place.
The size is a design choice, not a fault. Some ISP pipelines calibrate the black level to a round 64 DN at 8-bit output, which is 1024 DN in 12-bit terms. A covered-lens mean of 300 DN at 12 bits is about 7% of full scale — an ordinary pedestal.
If frames arrive already corrected, the covered-lens mean drops toward zero and the sub-zero half of the noise goes with it. For measurement work you want the pedestal present and subtracted by you, not clipped upstream. That is why the camera black level setting deserves a deliberate choice rather than the factory default.
Dark current: the small share that moves
Dark current is charge generated thermally inside the pixel during the exposure. It scales linearly with exposure time and, by the standard rule of thumb for silicon, roughly doubles every 6 to 8 °C of temperature rise. At a 25 °C bench with exposures of 10 to 100 ms, the dark signal lands in the low single digits of DN per frame — the 2 to 4 DN class that data-sheet scaling gives for typical sensors. The number to expect is a few DN, not 300.
The check that proves the separation: estimate dark current from the data sheet, subtract the pedestal from the covered-lens mean first, and the remainder should land on the estimate. A camera whose estimate is 4 DN and whose measured remainder is 4 DN has the subtraction right — its 300 DN was never dark current.
Hot pixels are the exception to watch. A few defective cells sit tens or hundreds of DN above the frame mean even in darkness. Compare mean and median on every dark run, and map cells that stay bright across frames as defects — the same isolation logic as a persistent black spot in a camera image.
Worked example: a 300 DN dark frame on a 12-bit mono camera
The case: a mono global-shutter board camera streaming 12-bit raw over USB3, lens covered, manual exposure, unity gain.
Inputs:
- Code span 0–4095 DN — the definition of 12-bit output.
- Covered-lens mean 300 DN — measured dark frames.
- Expected dark signal 2 DN — the sensor dark-current figure scaled into DN at that exposure.
- Saturation code 3600 DN — measured under strong, even illumination.
The rule, in words: pedestal equals dark-frame mean minus the dark-current share; usable swing equals saturation code minus pedestal; unreachable headroom equals 4095 minus the saturation code.
Here B is the pedestal in DN, dark_mean the covered-lens mean in DN, D the dark current in DN/s, t the exposure in s, and S_sat the saturation code in DN.
Arithmetic:
- B = 300 − 2 = 298 DN, so 298 of the 300 DN — 99.3% — is offset.
- swing = 3600 − 300 = 3300 DN: 3300 / 4096 ≈ 80.6% of the codes carry signal.
- headroom = 4095 − 3600 = 495 DN: 495 / 4096 ≈ 12.1% of the codes sit beyond any light level.
Result: the dark frame is a 298 DN pedestal carrying 2 DN of true dark signal, 3300 DN of usable swing remains, and 495 codes are unreachable.
Exposure check built into the same numbers: double the exposure and only the dark share doubles, 2 DN to 4 DN, so the mean should read 300 + 2 = 302 DN. A mean that instead doubles is tracking light or leakage, not pedestal.
Decision: subtract the measured 300 DN from every frame and leave the range alone. The gain that maps 3600 DN to 4095 DN is 4095 / 3600 ≈ 1.138, and applied to the whole signal chain it lifts the pedestal to 300 × 1.138 ≈ 341 DN while multiplying noise by the same 13.8%. Escalation threshold: a covered-lens mean above pedestal + 5 DN points to light leakage or hot pixels before it points to the sensor.
Why the top of the range stops below 4095
Sensors like the one above map analog saturation to a code below the converter maximum by design: the unused top codes buy a low, quiet pedestal, because pushing saturation to the rail takes more gain in the output stage and raises the floor. The 495 DN of headroom are not lost information — no signal reaches them.
The workable response is to leave the mapping alone and subtract in software. If a display or 8-bit handoff needs the full span, rescale after subtraction: (raw − 300) × 4095 / 3300 stretches the usable swing to the display range without touching the sensor.
Find the true top code empirically: shoot a flood-illuminated uniform field at fixed exposure and read the histogram's right edge. Re-check it after any firmware or pixel-format change — a camera that starts delivering raw8 has lost the top codes for a different reason, covered in ADC bit depth versus pixel format.
Measuring the pedestal on your bench
- Lock manual exposure and a fixed analog gain. The pedestal tracks gain; dark current tracks exposure. If the SDK hides the control, sensor-register writes are the fallback — see setting exposure via sensor registers.
- Cap the lens physically. A darkened room still leaks through the mount and fakes dark current.
- Capture 16 or more frames and average them; record the median too, since single hot pixels pull means upward.
- Repeat at double the exposure. A rise of only the predicted few DN confirms a stable pedestal; a proportional rise means you are measuring light.
- Subtract the measured mean from every frame before any other math. With column stripes in the dark frames, subtract a per-column dark frame instead of one number — the fixed-pattern logic in dark frame subtraction for fixed pattern noise.
Where the subtraction belongs in the math
With B removed, values are signal. Every ratio, flat-field gain map and SNR figure needs pedestal-free numbers: an offset left in biases each mean upward by B and inflates the dark sigma by the pedestal's noise. The SNR calculation from 8-bit camera images shows the signed-value trap the subtraction creates once sigma drops below the old offset.
A 12-bit stream shifted into a 16-bit container multiplies everything by 16: the 300 DN pedestal reads 4800 DN, saturation reads 57600 DN, and the 65520 ceiling of such streams is 4095 × 16. Previews that look black are the same scaling at work — 12-bit data in a 16-bit V4L2 frame and why 12-bit images look black in a 16-bit preview cover both sides. Save frames as 16-bit PNG or TIFF — the saving guide walks the conversion — so the pedestal survives round trips through tools.
Cameras that hand you raw 12-bit data
Two families put raw sensor data in your hands. Board-level cameras and sensor modules deliver the stream directly, often with no ISP stage at all, which is exactly what dark-frame work wants — board-level cameras with global shutters are the usual bench choice:
- Sensor format
- 1/2.9"
- Lens mount
- M12
- Sensor format
- 1/1.8"
- Lens mount
- C-mount
Area scan cameras reach the same data through the pixel format choice: request raw12 rather than raw8, as covered in raw10 and raw12 sensor modes. Area scan cameras in mono keep the arithmetic per-frame simple:
- Sensor format
- 1/1.7"
- Interface
- USB3
- Resolution
- 12 MP
- Shutter
- Rolling
For larger formats and higher sampling:
- Sensor format
- 1"
- Lens mount
- C-mount
- Interface
- USB3
- Resolution
- 16-25 MP
The camera finder filters by interface, shutter, resolution and mono or color, and the configurator pairs the camera with lens and light if the bench is being built from scratch. More camera-side reading sits on the cameras topic page.
When the standard answer is wrong
- Color sensors: the pedestal differs between CFA channels, so subtract per channel — one scalar for the whole frame leaves a checkerboard residue. ISPs measure the offset per color component for exactly this reason.
- Bridge-chip and embedded cameras: a driver or bridge stage may apply correction before you see the data. A covered-lens mean parked at a suspiciously round number — 64, 128, 256 DN — is the signature; subtracting again double-counts.
- Long sessions: dark current climbs as the camera warms and the pedestal drifts slightly with temperature. Re-shoot darks between long runs rather than reusing a morning value at midnight.
- Gain changes: the pedestal scales with analog gain, so a dark table measured at unity gain is wrong at every other gain setting.
Bench checklist before you trust a dark frame
- Lens capped physically, lights off — mount leakage reads as dark current.
- Manual exposure, fixed gain — separates the two variables that move the mean.
- 16+ frames averaged, median recorded — hot pixels pull means upward.
- Two exposures, t and 2t — the flat pedestal and the scaling dark signal separate in two shots.
- Flood field captured — the histogram's right edge is the true saturation code.
- Pixel format confirmed as raw10 or raw12 — 8-bit delivery truncates before any math starts.
- Temperature logged — dark current roughly doubles every 6 to 8 °C.
If a data set still refuses to add up after these checks, the contact page reaches the applications team.
Questions
Is a 300 DN dark reading on a 12-bit camera a defective sensor?
Almost never. A mean of a few percent of full scale in darkness is the pedestal the sensor adds so noise and row offsets do not clip at zero. Call it a fault only when the mean climbs through a session, rises far faster than the temperature log explains, or shows a bright gradient across the frame — those signatures point to light leakage, a warming camera or a supply offset rather than the pedestal itself.
How do I pick the black level value to subtract in my code?
Shoot 16 or more covered-lens frames at your working exposure and gain, average them, and prefer the median when isolated hot pixels would drag the mean. Store the value together with its gain, exposure and temperature so the subtraction stays reproducible months later. When dark frames show column stripes, subtract a per-column dark frame rather than one scalar.
Why does my 12-bit camera saturate near 3600 instead of 4095?
The sensor maps analog saturation to a code below the converter maximum by design, trading the unused top codes for a low, quiet pedestal. Raising gain until saturation reaches 4095 lifts the pedestal and noise by the same percentage, so nothing is gained. Subtract the pedestal and rescale the usable swing in software when a display needs the full range.
Does the pedestal change with exposure time?
No. The offset is fixed per gain setting, so a covered-lens mean that climbs with exposure is dark current or stray light. That is why the dark sequence you subtract should always be shot at the working exposure: a pedestal measured at 10 ms carries none of the 20 ms dark charge. Pedestal does scale with analog gain, and dark current roughly doubles every 6 to 8 °C.
Should I raise the camera's black level setting to improve contrast?
Rarely. A higher pedestal spends codes that signal could use and must be undone in software anyway. Keep the control near its factory value and get contrast from exposure, lighting or a tone curve applied after subtraction. The one case for raising it is raw output that clips at zero in deep shadow: add just enough offset to lift the noise floor off the rail.



