Dust map
Sensor dust appears in every frame at the same place, as a soft dark spot. A focus stacker does not merely keep it — it makes it worse than in any single frame, because the region-energy rule reads the spot's edge as detail and picks it. The spot comes out sharper than it ever was.
There is a second, quieter problem: a fixed pattern present in every frame is exactly what pulls an intensity-based registration toward zero shift. Dust degrades your alignment as well as your image.
lapstack's answer is Helicon Focus's: shoot a dust map, and take the spots out of every frame as it is decoded, before alignment.
Shooting the map
One frame of an evenly lit, featureless surface, thoroughly out of focus, at the stack's aperture:
- A white wall, the sky, or a sheet of paper
- Defocused enough that the surface itself contributes nothing
- The same aperture as the stack, because dust shadows sharpen and darken as you stop down, and move slightly
That frame shows nothing but the dust.
The map must be the same pixel dimensions as the frames. A map of another size stops the run.
Using it
In the browser
The Dust map section of the parameter panel. Load the frame; the spots are found in the worker and outlined on a preview (click the preview for a larger view in a new tab). The threshold, margin and mode take effect immediately, so you can tune them against the preview.
The map then applies to every frame the engine decodes: the run, the DFR and WAV renders, the slabs, the Source view and the retouch brush. The filmstrip's thumbnails show the frames as shot, unretouched, so you can compare.
A project file records the map's name, and the file is matched from the frames added when the project is opened again.
On the command line
lapstack --dust-map dust.tif --save-dust-map spots.png -o stacked.tif frames/*.tifThe controls
| Control | Command line | Default | What it does |
|---|---|---|---|
| threshold | --dust-threshold PCT | 3 | A pixel darker than its local background by more than this percentage is dust |
| margin | --dust-margin PX | 3 | Pixels the detected spots are grown by — the soft edge of the shadow, and the little a spot moves between apertures |
| mode | --dust-mode fill|flat | fill | How a spot is removed (below) |
| — | --save-dust-map PATH | — | Write the mask found (white = dust) to check the map before a long batch |
How spots are found
The map's luminance is taken at half resolution — one REDUCE, which also tames the noise — and divided by its own large-scale background. That background is a plane fitted under each cell four pyramid levels up, by a first-order normalized convolution, so the illumination's falloff is followed right out to the frame's edges while a small spot is not. It is estimated twice, the second time with the first pass's spots weighted out.
A pixel darker than that background by more than the threshold is dust. The connected components, grown by the margin, are the spots. A component under 16 pixels is treated as noise, and a blob wider than a quarter of the frame is not dust and is reported as such.
The run logs the spots found — count, size, and share of the frame.
fill or flat
fill (the default, and Helicon's way) interpolates each spot from its surroundings by
pull–push: the window's pyramid is built with the dust weighted out, and on the way back down
every hole takes the coarser level's value. The result is a smooth patch that meets its edges
cleanly. Whatever detail was under the spot is gone, replaced by a plausible continuation.
flat divides the spot by the attenuation the map measured — a flat-field correction. It
keeps whatever detail lies under the spot, which is strictly better when it works. It
works when the map was shot at the stack's aperture and lighting; when it was not, you get a
ring.
Use fill unless you shot a careful map and the spots fall on detail you care about.
Run --save-dust-map once and look at the mask before committing a long batch. A
threshold that is too low turns vignetting or a smudge into hundreds of false spots, and
fill will happily smooth over real detail in every one of them.