Lucky Imaging the Moon: My Seestar Pipeline Leaves Deep Space

Last week’s post about my Seestar pipeline’s first fortnight ended on a cliffhanger, of sorts. The pipeline had just been taught to handle the Moon, the Sun and Jupiter, and I said I’d find out whether it worked once the first video had been through.

It did. In the week since, three Moon images have come out the other end, all made from videos the Seestar S50 recorded, and all of them now on Flickr and my astronomy site, vividgrey.co.uk. This post explains why the Moon needed a different approach from the galaxies and nebulae, how that approach works, and what came out.

Why the Moon is different

For deep-sky targets the Seestar saves thousands of ten-second exposures, and my Windows PC stacks them in Siril. Siril lines the frames up using the stars, which works beautifully for a galaxy surrounded by a star field.

The Moon, the Sun and the planets are different in two ways:

  • They’re recorded as video. The Seestar saves an MP4 rather than individual frames, at around 30 frames a second, so even a short clip holds thousands of frames.
  • There are no stars to align on. Siril’s registration is star-based only. Its own help text says the algorithm “only works with deep sky images”, and there’s no planetary or multi-point alignment I could run from a script.

So instead of bending Siril to do something it wasn’t built for, Claude Code wrote a small separate step in Python, using OpenCV and NumPy. It’s the first part of the PC side that isn’t plain standard-library Python, so it runs in its own virtual environment, and the main script calls it as a separate process. The deep-sky pipeline is untouched.

How lucky imaging works

“Lucky imaging” is the standard trick for the Moon and planets. Looking through the atmosphere is like looking through the bottom of a moving swimming pool: most frames are smeared, but every so often the air steadies for a moment and you get a sharp one. Record enough frames, keep only the lucky ones, and stack those.

The new step does exactly that, in five stages:

  • Score every frame. Each frame gets a sharpness score (the variance of the Laplacian, which is a measure of how much fine edge detail there is).
  • Keep the best 10%. With a minimum of 30 frames, for very short clips. The sharpest frame of all becomes the reference.
  • Align them, twice. First each frame is shifted as a whole to match the reference, using phase correlation. Then, because the atmosphere distorts different parts of the disc in different ways, it’s refined locally: a grid of 128-pixel alignment points, every 96 pixels, each matched on its own. The resulting map of small shifts is smoothed and used to warp the frame into place.
  • Average. The aligned frames are averaged, which smooths out the noise and the video compression blockiness.
  • Sharpen. A three-scale “wavelet” boost brings out the detail the averaging has recovered, and the result is saved as a JPG and a 16-bit PNG.

It also saves a single frame of median quality next to the stack, so I can compare what one typical frame looked like with what the stack achieved. That comparison was the first test: on a short Moon video from May it kept 410 of 4,100 frames, and the stack was clearly sharper and less blocky than the typical single frame.

Fitting it into the pipeline

The stacking was the interesting part, but most of the work was making it fit the pipeline I already had without breaking anything:

  • Deep sky comes first. Each Tuesday and Friday run still processes its deep-sky target, then does one video, so the deep-sky queue isn’t held up. The largest video goes first, because it has the most frames to choose from.
  • Every video is remembered. Once a video has been stacked, its file name is added to that target’s note in my Obsidian vault, so a new recording of the same object is picked up later rather than ignored.
  • The Pi had to learn a new format. The Raspberry Pi that uploads to Flickr and drafts the vividgrey post expected deep-sky details: filters, nights, the number of stars used for colour calibration. A video has none of those, and the old code would simply have crashed on one. It now recognises a video result and writes a different title, description and details table: when it was captured, how long the video was, and how many frames were kept.
  • Switched on in the right order. The PC side was built with the video step turned off. Only once the Pi side was updated and its tests passed was it switched on, late on 21 November.

Comets are still left out, because they move against the stars and need a different kind of alignment again, and the planets’ still frames aren’t stacked yet. When the step was switched on there were ten videos waiting: four of the Moon, two of the Sun and four of Jupiter.

The first three Moons

Last week I expected the first result after Tuesday’s run. In the end it turned up a day earlier, on Monday morning, and it wasn’t one of the ten in the queue.

A waxing gibbous Moon against a black sky, with craters and dark maria visible across the lit side
Waxing gibbous Moon, 21 November 2026: the best 10,353 of 103,534 frames from a 57-minute video.

21 November 2026. While the video step was being written, the Seestar was out recording the waxing gibbous Moon, starting at 22:08. That video, nearly an hour long, was bigger than anything in the queue, so it went first. The stack used 10,353 of its 103,534 frames, and it was on vividgrey on 23 November.

A warm-toned full Moon against a black sky, with bright ray systems spreading out from a crater near the bottom of the disc
Full Moon, 8 August 2025: the best 4,147 of 41,471 frames from a 23-minute video.

8 August 2025. This was the video the pipeline was expected to start with, a 23-minute recording of a full Moon. It arrived on Wednesday 25 November, from Tuesday’s run, alongside M 42, the Orion Nebula. 4,147 of 41,471 frames were kept. A full Moon is lit straight on, so there are few shadows, but the bright rays thrown out from the younger craters show up well.

A gibbous Moon against a black sky, with sharp craters along the shadow line on its left-hand edge
Gibbous Moon, 1 November 2025: the best 1,208 of 12,079 frames from a video under seven minutes long.

1 November 2025. The third came from Friday’s run and arrived on Saturday 28 November, with M 31, the Andromeda Galaxy. It’s the shortest of the three, 6 minutes 43 seconds, and 1,208 of 12,079 frames went into the stack. Even so, the craters along the shadow line are crisp.

All three went through the same review step as the deep-sky images: a draft on vividgrey and a checkbox in my Daily note, and nothing goes public until I’ve looked at it.

Next: the Sun and Jupiter

The Sun and Jupiter videos are still in the queue, and they’ll be the real test. The Moon fills a good part of the frame, so the local alignment points have plenty to work with. Jupiter will be a small disc. For a small object the code scores only a box around it rather than the whole picture, and anything under 400 pixels across is aligned as a whole, without the local alignment points. I’ll find out how well that works when the first one comes through.

What I’ve learned

  • Don’t force a tool past what it’s for. Siril is excellent at deep sky. A couple of hundred lines of Python and OpenCV turned out to be easier than trying to make it do planetary work.
  • Turn things on in the right order. Building the video step switched off, and only turning it on once the Pi could cope, meant the first video went straight through rather than failing in the middle.
  • Keep a comparison frame. Saving a typical single frame next to every stack makes it obvious whether the stacking has actually helped.
  • The newest data can jump the queue. Choosing by size rather than by date meant the video I recorded on the night it was switched on became the first image out.

The deep-sky pile is still shrinking twice a week, and now the Moon is coming along with it.

A note on how this post was written: it was drafted by Claude Code from the AstroProcessor and AstroPublisher repos, their code history and my vault notes on the pipeline and the Moon, and written into WordPress as a draft through the API. Claude chose the photos from my Flickr account. I reviewed and edited it before publishing.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *