Dark frame subtraction

Also known as: long exposure noise reduction

On this page 6

Dark frame subtraction is a calibration technique that removes repeatable sensor artifacts from an image by subtracting a dark frame, an exposure taken with no light reaching the sensor but with the same exposure time, ISO and temperature as the original. In photography it is a core tool for protecting image quality in long exposures, where thermal signal, hot pixels and amp glow become visible. Many cameras offer it as long exposure noise reduction.

The method targets only the fixed, predictable part of the noise. It cannot remove random noise such as shot noise or most read noise, and if done carelessly it can even add random noise to the final image.

How dark frame subtraction works

Every sensor pixel accumulates a small charge even in complete darkness. This dark current comes from thermally generated electrons, and its amount differs from pixel to pixel because of manufacturing variations. Over a long exposure these differences produce a fixed pattern of bright pixels and gradients that appears in the same place in every frame taken under the same conditions.

A dark frame records exactly this pattern without any scene content. Subtracting it pixel by pixel from the light frame removes the repeatable component, leaving the scene plus the random noise of both exposures. The subtraction must happen on linear raw data before demosaicing, white balance and tone curves, which is why cameras do it internally and why astrophotography software applies it at the calibration stage.

The table below lists the artifacts that a dark frame can and cannot correct.

ArtifactOriginRemoved by subtraction
Hot pixelsPixels with unusually high dark currentYes, if temperature matches
Amp glowHeat or light from readout circuitryYes, largely
Thermal gradientUneven sensor temperatureYes, if stable between frames
Shot noiseRandom arrival of photonsNo
Random read noiseReadout electronicsNo, it increases
Sensor dust and vignettingOptical pathNo, requires flat frames
Which artifacts a dark frame removes

Parameters that determine success

A dark frame is useful only when it reproduces the same dark signal as the light frame. The decisive variables are exposure time, gain and sensor temperature. Dark current in typical silicon sensors roughly doubles for every 5 to 7 degrees Celsius of temperature rise, so even modest warming during a night session can make a dark frame mismatched.

ParameterMatching requirementEffect of mismatch
Exposure timeIdentical to the light frameUnder- or overcorrection of hot pixels
ISO or gainIdentical settingPattern scaled incorrectly
Sensor temperatureWithin about 1 to 2 degrees CelsiusResidual hot pixels or dark holes
Offset or black levelSame camera mode and firmwareShifted background level
Light leakageFully sealed lens or body capScene light contaminates the dark
Matching requirements for a usable dark frame

Overcorrection produces dark holes where hot pixels used to be, while undercorrection leaves faint residual hot pixels. Both are signs that the dark frame and the light frame were recorded under different conditions.

In-camera noise reduction versus master darks

Cameras implement dark frame subtraction as long exposure noise reduction: after a long exposure, the camera immediately records a dark frame of equal length and subtracts it. This guarantees near-perfect temperature matching but doubles the total capture time, which is a serious drawback when shooting star trails or time-lapse sequences.

Astrophotographers usually prefer a master dark, made by averaging many individual dark frames. A single dark frame contains its own random noise, so subtracting it raises random noise by a factor of about 1.41. Averaging N dark frames reduces that penalty to the square root of 1 plus 1 divided by N, so 20 to 50 darks make the added noise nearly negligible.

StrategyMain advantageMain drawback
In-camera single darkAutomatic, temperature matchedDoubles time, adds random noise
Averaged master darkMinimal added noiseTemperature matching is harder
Dark libraryReusable across sessionsNeeds cooled camera or temperature records
Scaled dark with biasAdapts to different exposure timesMore complex processing
Dithering without darksRejects hot pixels statisticallyRequires many frames and a tracking mount
Comparison of dark frame strategies

In full astrophotography calibration, darks work together with bias frames, which capture the readout offset, and flat frames, which correct vignetting and dust. Each calibration frame addresses a different error, and none can replace the others.

When dark frame subtraction is worth using

The benefit grows with exposure length and sensor temperature. Modern sensors with low dark current may show few artifacts below about 30 seconds, whereas multi-minute exposures on a warm summer night often reveal dozens of hot pixels and visible amp glow. The decision table below summarizes typical situations.

SituationRecommended approachReason
Single night landscape, 2 to 4 minutesIn-camera noise reduction onFew frames, matching is automatic
Star trails or time-lapseNoise reduction off, darks taken laterAvoids gaps between frames
Deep-sky stacking with cooled cameraMaster dark from a libraryStable temperature allows reuse
Short handheld exposuresNo dark frame neededDark current is negligible
Deciding whether to subtract a dark frame
  • Record darks during or immediately after the session so the sensor temperature stays similar.
  • Cover the eyepiece or viewfinder on DSLR cameras, because stray light can enter through it.
  • Keep raw format for both light and dark frames, since JPEG processing breaks linear subtraction.

A non-technical view

Picture an old window with a few permanent smudges. Every photograph taken through it shows the same smudges in the same places. If a photo is taken of pure darkness through that window, only the smudges appear, and they can then be erased from every other photo.

Dark frame subtraction does this for a camera sensor. A long exposure with the lens covered shows only the sensor’s own built-in flaws, and removing that pattern leaves a cleaner picture of the real scene.

A concrete example

A night sky photographer captures the Milky Way core from a desert site in July, using a tracking mount, a full-frame camera at ISO 800 and 180-second exposures. The ambient temperature stays near 24 degrees Celsius, and the first test frame shows scattered red and blue hot pixels plus a faint purple glow in one corner.

Instead of using in-camera noise reduction, which would halve the number of usable frames, the photographer shoots 40 light frames and then 30 dark frames with the lens cap on while the camera is still at the same temperature. Stacking software averages the darks into a master dark and subtracts it from every light frame. The hot pixels and corner glow disappear, and the final stack shows clean dust lanes without the speckled pattern.