The numbers behind NightScape Lab

Eric Brown7 min read

In this guide7 sections
  1. Stacking: how much quieter the sky gets
  2. Sky White Balance: why it reads the sky alone
  3. Star removal: what comes out, and what goes back
  4. Foreground Sky Merge: how the two halves meet
  5. Panorama: how closely the panels line up
  6. Star trails: what the frames have to cover
  7. How these numbers were made

This page is for the people who want to see the numbers. Every one of them comes from my own photos from Idaho, run through the app's engine as it is today. Where a number depends on a choice I made to measure it, I say what the choice was.

The camera is a Sony A7 IV. The Milky Way set is 15 frames at 14mm, 8 seconds, f/2.8, ISO 10000, with 16 dark frames shot right after. The panorama and the foreground come from the same night.

Stacking: how much quieter the sky gets

Noise in a night photo is mostly random, so it's different in every frame while the stars and the Milky Way stay the same. Average a stack of frames and the signal holds while the noise partly cancels. In theory the noise falls with the square root of the number of frames, so 15 frames should be 3.87 times quieter than one.

I measured it on the 15-frame stack against the first frame on its own.

One frame15-frame stack
Sky noise (fraction of full scale)0.00570.0017
Sky signal to noise5.217.0

That's 3.27 times less noise, 84% of the ideal 3.87. A stack never quite reaches the ideal. Rejection leaves out the samples where one frame disagrees with the rest, and some of a camera's noise repeats from frame to frame instead of averaging away. I haven't separated how much each of those costs here.

How I measured: the sky only, away from the horizon and the frame edges, with the stars masked out. I subtract a smoothed copy of the image (a 6-pixel blur) so only the fine grain is left, and take the median absolute deviation of what's left. Signal is the median sky brightness.

What dark frames do, and where

Hot pixels are the bright single-pixel dots a sensor makes on long exposures. They sit in the same place in every frame. In the sky that doesn't matter much, because the stack lines the frames up on the stars and the sky moves a little between frames, so a hot pixel lands somewhere different each time and rejection throws it out. The ground doesn't move. A hot pixel on the ground lands in the same spot in every frame, so the stack keeps it. And as the noise around it drops, it stands out more.

One frameStack, no darksStack with 16 darks
Hot pixels on the ground221045
Sky noise0.00570.00170.0017

I counted a hot pixel as one that stands more than 10 times the ground's noise above its 3 by 3 neighbours, over the same 462,000 pixels of ground in each picture. The darks took the ground from 104 to 5. They made no measurable difference to the sky.

That's why Stack Frames asks about darks and leaves them unticked: they're worth it when the foreground matters and you shot them, and they cost you nothing to skip on a sky-only frame.

Sky White Balance: why it reads the sky alone

A white balance has to measure something it believes should be neutral. Most automatic balances measure the whole frame. A nightscape is two different scenes in one frame, though: a sky lit by the night, and ground lit by whatever was left of the dusk, a moon or a headlamp. Let the ground vote and it pulls the sky's color with it.

Sky White Balance measures only the pixels the AI sky mask calls sky. Of those it keeps the middle band of brightness (the 30th to 70th percentile), so stars and dark corners don't count, and takes the median of each color channel. The balance makes those medians equal.

Here's the same measurement, made two ways, on a five-frame stack shot at dusk, where the ground is half the frame:

The sky's color after balancingRed to greenBlue to green
Balanced on the whole frame0.921.47
Balanced on the sky alone1.001.00

Balanced on the whole frame, the sky stays 47% too blue. On the 14mm Milky Way stack, where the ground is only 7% of the frame, the two ways land within 1% of each other. The more foreground in the picture, the more it matters.

It only sets Temp and Tint, the way Basic's Auto does. It doesn't write new pixels, so you can move the sliders from there.

Star removal: what comes out, and what goes back

Remove Stars splits the photo in two: a starless sky and a star map. They're built to add back up to the photo you started with. On the 15-frame stack, starless plus star map matched the original to within 2 levels out of 65,535 at every pixel, which is rounding. Nothing is lost, so you can fade the star map back in, or use Reduce to shrink the stars by size.

On the 15-frame 14mm stackMeasured
Stars at least 5 times the sky's noiseabout 71,000
Share of the frame those stars cover3%
Share of the sky's light in the star map5.8%

The star count depends on where you draw the line between a faint star and noise. At 10 times the noise it's about 37,000. The light share is the whole star map, faint stars included.

One honest note: the sky between the stars comes out a little smoother. Its noise measured 8% lower in the starless image than in the original. The model smooths the background slightly as it separates the stars.

Foreground Sky Merge: how the two halves meet

A merge takes the sky from one photo and the ground from another, usually a Milky Way stack and a foreground shot at blue hour, when there was still light on the land. The AI sky mask finds the horizon on the foreground photo. The sky stack is placed behind it and color-matched, and the two are blended along the horizon.

The blend is narrow on purpose. On the merge of the dusk foreground with the 15-frame sky, the soft edge between sky and ground is 6 pixels wide at the median and 11 pixels at the 90th percentile, across a frame 4,688 pixels wide. That's wide enough that you don't see a cut line, and narrow enough that no sky shows through a ridge or a tree.

The engine writes the foreground, the sky and the mask as separate layers as well as the flat result.

Panorama: how closely the panels line up

Stitching a Milky Way panorama is a star-matching problem. The app finds the stars in each panel, matches them across each overlap, and fits one lens model to all of them, so straight lines and star fields stay true from one panel to the next. Each panel is stacked first, so the stitch works on clean panels instead of noisy ones.

I stitched three overlapping 50mm panels, each a five-frame stack.

Panels 1 and 2Panels 2 and 3
Stars matched in the overlap3,1522,870
How far apart they land (RMS)0.67 px0.71 px
95% of stars within1.21 px1.33 px
Along the seam (RMS)0.54 px0.67 px

Under a pixel means a star at the seam lands on itself: you don't get doubled stars or a soft band where the panels meet. The brightness of the panels was matched within 1.3% of each other.

Star trails: what the frames have to cover

The sky turns once every 23 hours 56 minutes, which is 15 degrees an hour. A trail is that turn, recorded as one frame after another. Two things decide how it looks: how long the run is, and what happens between frames.

My 14mm run is 32 frames of 8 seconds, shot about 9 seconds apart. Over its 4 minutes 40 seconds the sky turned 1.2 degrees, which gives short trails. An hour of frames would give 15 degrees.

Between each pair of frames the shutter was closed for about a second, so a trail can come out as beads on a string, with a small gap after every frame. Fill gaps between frames bridges those gaps. It's on by default for the Meteor look and off for the others, whose longer tails already cover most of the gap.

Remove plane and satellite streaks works on each frame by itself. In 8 seconds at 14mm a star moves 1 to 3 pixels, so in any one frame it's a dot. A plane or a satellite crosses hundreds of pixels in the same 8 seconds, so it's a thin line. The tool finds those lines in each frame and leaves them out before the frames are combined.

How these numbers were made

Every number on this page was measured on the files the engine wrote, with short scripts I can run again, on photos from the same Idaho night as many of the examples. Nothing was tuned for this page: each tool ran once, at its default setting. If a future version of the app changes a number, I'll update it here.

Keep reading

More to read.

All guides
  1. Why stack astrophotography images?

    What stacking actually does for astrophotography: signal-to-noise, what it fixes, what it doesn't, and why landscape astro needs a dual-stream stack.

    5 min read

  2. How it works

    NightScape Lab is a desktop app. Stack Frames writes a 16-bit TIFF base image. The Lightroom Classic plugin is part of the license.

    8 min read

  3. Examples

    Before and after examples of every NightScape Lab tool, run on my own nightscapes from Idaho, Mammoth Lakes, Park County, Algatha and Grand Junction.

    2 min read