GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - JochemDeen/LuckyStack: Native macOS lucky-imaging stacker for planetary, lunar and solar recordings, inspired by AutoStakkert!

BranchesTags
Open more actions menu

Latest commit

 

History

1 Commit
1 Commit

Folders and files

NameName
Last commit message
Last commit date
Resources
Resources
 
 
Sources
Sources
 
 
Tests/LuckyStackCoreTests
Tests/LuckyStackCoreTests
 
 
scripts
scripts
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
Package.swift
Package.swift
 
 
README.md
README.md
 
 

Repository files navigation

LuckyStack

A native macOS lucky-imaging stacker for planetary, lunar and solar recordings, inspired by AutoStakkert!. It follows the same workflow (image stabilization → frame quality analysis → alignment points → multi-point alignment and stacking → recombination), starts from the same default settings and can open AutoStakkert .as3 sessions, so moving over is easy.

On top of that it has an optional enhanced stacking core (warp engine, per-AP reference with gradient sub-pixel refinement, transparency compensation, guided Bayer completion, a per-pixel noise map) and built-in post-processing (wavelets, unsharp mask, Richardson–Lucy and Wiener deconvolution with the PSF measured from the planet limb, with a live GPU preview). With the extensions off — the default — processing stays AutoStakkert-compatible.

  • Input: RAW8 / RAW16 recordings, Bayer (RGGB/GRBG/GBRG/BGGR) or mono, as

    • SER files,
    • uncompressed AVI (ASICAP, SharpCap, FireCapture RAW AVIs, including OpenDML > 1 GB),
    • image sequences: a folder of PNG/TIFF frames, e.g. ASICAP's CapObj/<date>Z/ folders. These are decoded once into a temporary memory-mapped file.

    The Bayer pattern comes from the SER header or the capture software's sidecar .txt (Debayer Type = RGGB), and can be overridden. 16-bit byte order and reduced bit depths (10–14 bit) are detected automatically.

  • Capture metadata: camera settings and per-frame UTC times from the SER trailer, the frame files' times, ASICAP / SharpCap / FireCapture logs or the file name (luckystack info).

  • Output: 16-bit TIFF / PNG, or FITS, with the capture data and the times of the frames actually stacked in the header; optionally a 32-bit float noise map and a sharpened copy.

  • Swift + SwiftUI, multithreaded. Frames are read zero-copy from a memory map.

LuckyStack is an independent project. It is not affiliated with or endorsed by AutoStakkert! or its author, and it contains no AutoStakkert code.

Build and run

Requirements: macOS 14 or later and Xcode 16 or later (Swift 6 toolchain).

./scripts/build-app.sh          # → dist/LuckyStack.app and dist/luckystack (CLI)
open dist/LuckyStack.app

You can also open Package.swift in Xcode and run the LuckyStackApp scheme.

Workflow (app)

  1. Open a recording (⌘O or drag & drop): a .ser/.avi file, an image-sequence folder, or any frame in such a folder. Use Colour to override the detected Bayer pattern.
  2. Choose Image Stabilization: Planet (COG) for planets, Surface for Moon/Sun, or Disabled.
  3. Analyse (⇧⌘A). Every frame is stabilized and its quality is estimated. The graph shows quality per frame (blue) and sorted best-first (green). Use Sort by quality and the slider to browse the frames.
  4. Place AP Grid (⇧⌘G). Alignment points are placed on the best frame. Click the frame to add an AP of the current size; ⌥-click removes the nearest one.
  5. Set Stack Options: up to four percentages and/or four frame counts. One output is written per entry.
  6. Stack (⌘↩). Files are written to the output folder as <name>_lapl<N>_ap<count>_<50p|200f>.tif, or with File names: WinJUPOS as 2026-01-26-2112_1-JD-RGB-25p.tif (the mid time of the frames actually stacked, UT).
  7. Sharpen (⌘K, or the wand in the toolbar while the Stack view is shown): deconvolution (Measure PSF fits the planet limb), wavelet layers with per-layer denoise, unsharp mask and a tone curve, previewed live on the GPU. Zoom to 100 % to judge it. Save Sharpened… (⇧⌘S) writes the result and its recipe (.json); Write a sharpened copy with every stack applies the recipe automatically. SNR map shows stack ÷ noise when the noise map is on. Any finished stack can be opened for sharpening with Open Stack for Sharpening… (⇧⌘O); a <name>_noise.tif next to it is loaded too.

Enhanced stacking (beyond AutoStakkert) in the settings holds the extensions; Use measured best switches on the combination below, AutoStakkert switches them all off.

Sessions: Save Session… (⌘S), or Write session file under Output, saves the analysis, the alignment points (including your edits) and the settings as a .luckystack file next to the stacks. Opening it restores everything without analysing again. Opening an AutoStakkert .as3 takes over its settings, alignment points and frame list; the recording is found next to it.

Batch Queue (⇧⌘B): drop recordings or folders of recordings (e.g. CapObj), or watch the capture folder: every recording is stacked when it is complete (a sequence folder without new frames for 5 s, an AVI once ASICAP has written its .txt log), with a preset chosen automatically (by target name, or planet vs Moon/Sun detected from the frames), a named preset or the main window's settings. Stacks go to one output folder (~/Pictures/LuckyStack by default; never the capture folder); double-click a finished item to sharpen it. Save Settings as Preset… stores the current settings as a JSON preset named after its target — "Jupiter" is then used for every recording with Jupiter in its name.

All options default to AutoStakkert's defaults: AP size 72, minimum brightness 30, multi-scale APs, local quality, automatic noise robust, automatic reference, 50 % stack.

Command line

dist/luckystack process capture.ser --stack 25,50 --mode planet --out results/
dist/luckystack process moon.ser --mode surface --stack 10 --ap-size 56 --normalize 70
dist/luckystack process ~/ASICAP/CapObj/2026-01-26_21_11_58Z --stack 50 --out results/   # PNG sequence
dist/luckystack process ~/ASICAP/CapObj --preset auto --out results/      # every recording in the folder
dist/luckystack watch ~/ASICAP/CapObj --out results/                      # stack each new recording when complete
dist/luckystack presets ~/ASICAP/CapObj                                   # presets, and the automatic choice per recording
dist/luckystack presets --save Jupiter.json --targets Jupiter --scene planet --stack 25 --enhanced
dist/luckystack process capture.ser --stack 25 --save-session --out results/   # also results/capture_lapl6_ap19.luckystack
dist/luckystack process results/capture_lapl6_ap19.luckystack --stack 10,50 --enhanced   # stack again, no analysis
dist/luckystack process AS_P25/2026-01-26_21_17_36Z_lapl4_ap2704.as3 --out results/   # AutoStakkert's settings and APs
dist/luckystack process capture.avi --bayer RGGB --stack 25
dist/luckystack info capture.ser                     # format, camera settings, frame times
dist/luckystack best capture.ser best.tif            # best single frame (registered, demosaiced)
dist/luckystack preview stack.tif crop.png --crop 400x400 --sharpen 2,3 --scale 2
dist/luckystack synth test.ser --scene planet --frames 500 --size 640x480 --bits 16
dist/luckystack asref AS_P25/session.as3 raw/<recording> --out cmp/ --both --stack 25,50   # replay an AutoStakkert session

# LuckyStack extensions and post-processing
dist/luckystack process moon.ser --mode surface --stack 25 --enhanced     # warp engine etc. + noise map
dist/luckystack process jupiter.ser --stack 50 --enhanced --recipe sharpen.json   # also writes a sharpened copy
dist/luckystack process low-saturn.ser --stack 25 --rgb-align                # correct atmospheric dispersion
dist/luckystack process jupiter.ser --stack 25 --naming winjupos --observer JD   # 2026-01-26-2112_1-JD-RGB-25p.tif
dist/luckystack psf stack.tif                                              # PSF from the limb (or point sources)
dist/luckystack sharpen stack.tif out.tif --deconv lr --psf auto --iter 40 --wavelets 1.3,1.2 --denoise 1,0.5
dist/luckystack sharpen stack.tif out.tif --recipe sharpen.json            # noise map picked up automatically
dist/luckystack bench --scene surface -- "base=" "warp=--engine warp"       # score variants against synthetic truth
dist/luckystack splitbench moon.ser --mode surface -- "base=" "enh=--enhanced"   # split-half FRC on real data
dist/luckystack convert capture-folder/ capture.ser                        # PNG sequence / AVI → SER
dist/luckystack compare autostakkert.tif ours.tif   # max |a-b|, then a registered, object-masked comparison

luckystack without arguments lists all options (drizzle, sigma clipping, global quality, manual reference size, double stack reference, output format, COG threshold, and more).

Tested on real data

ASICAP RAW8 RGGB captures from a ZWO ASI678MC (PNG sequences and AVI):

Recording Frames Mode Time
Jupiter 1280×720 1000 planet, 50 % 5.7 s
Jupiter 1360×768 1000 planet, 25 %, AP 24 2.2 s
Moon 3840×2160 1124 surface, AP 104 (2418 APs), 25 % 77 s (11 s PNG decode)

Compared with AutoStakkert 4

luckystack asref replays an AutoStakkert session (.as3) on the same raw frames, in the same order and with the same settings, and compares the results. On five replayed sessions (one Jupiter recording in planet mode, four Moon recordings in surface mode, 639–863 frames each), with the extensions off:

  • the frame quality ranking and the selected frames were the same;
  • after registration the stacks matched AutoStakkert's closely (green-channel correlation 0.998–0.99997, the same brightness, colour balance and 3–6 px detail) and were visually indistinguishable; LuckyStack's pixel noise was 2 % (planet) to 4–9 % (Moon) higher;
  • LuckyStack's own AP placement found 98–100 % of AutoStakkert's AP count, with stacks as close to AutoStakkert's as those made with AutoStakkert's APs.

Beyond AutoStakkert

Each extension was measured on synthetic recordings against ground truth (luckystack bench) and on real recordings with a split-half Fourier ring correlation (luckystack splitbench: two stacks from disjoint frames, each aligned to references built from its own frames only; the frequency where they stop agreeing shows how much real detail a method recovers).

Extension Synthetic (vs truth) Real recordings (split-half) In --enhanced
B3 Warp engine: one smooth displacement and frame-selection field per frame, no AP patchwork blur σ −11 % (planet), restored error −5 to −6 % Moon: resolved detail +6 %, noise −17 %; Jupiter: noise −7 % yes
B2 Per-AP reference + Lucas–Kanade sub-pixel refinement sub-pixel error 0.35 → 0.03 px (rigid shifts); AP shift error −25 % (surface), blur σ −10 % (planet) Moon: resolved detail +1.4 % yes
B5 Transparency (haze) compensation under haze: residual −12 %, colour error −40 % noise −2 % (clear night) yes
B7 Guided Bayer completion colour error −44 % colour noise −38 % (Moon), −39 % (Jupiter) yes
B6 Per-pixel noise map (standard error) within 5 % of the measured noise median SNR in the log; SNR view; drives sharpening yes
B1 Neighbour check of AP shifts no gain (no failures to fix) resolved detail −1 to −4 % no
B4 Quality weights, soft cut-off ±1 % ±1 % no
A2 Colour dispersion correction in the splat (no resampling), with drift dispersion measured to 0.01 px; colour error −83 to −86 %, blur σ 1.52 → 1.18 px removes the measured offsets (Jupiter 0.31 → 0.01 px, Moon ~0.9 → 0.1 px); little visible change on these soft captures yes
F3 Capture metadata and frame times; times of the stacked frames in the headers — ASICAP file times (also whole-second copies) and AVI logs read correctly (their local times shifted to UT) always
D5 WinJUPOS file names from the mid time of the frames actually stacked — Jupiter: 2112_1 (25 %) and 2112_0 (50 %) instead of the capture start 2111_9; pixels unchanged option
F1 Batch (process with several inputs or a folder), presets, watch and the app's Batch Queue — planet vs Moon detected correctly on all 24 real recordings; a simulated ASICAP session stacked 3 s after the last frame / one scan after the AVI log; pixels identical to process —
A6 Sessions (.luckystack): analysis, APs and settings saved and restored; AutoStakkert .as3 import restored stacks byte-identical (local and global quality, drizzle, sigma, enhanced) byte-identical on Jupiter and the 4K Moon; Moon 10 % run 33 s → 26–28 s; .as3 import = asref replay option
C1 Wavelets, unsharp mask, tone; live GPU preview (46 ms at 4K) — — recipe
C2 Richardson–Lucy / Wiener with the PSF measured from the limb limb σ within 2–6 %; RMSE −26 % (RL), −29 % (Wiener) Jupiter: σ 12.2 px measured (AutoStakkert's stack: 13.4 px); RL brings out belts and festoons recipe

All together (--enhanced): on the Moon recording 21_17_36Z (1536×1024 crop, 576 APs, 25 %) the split-half resolution rises 8 % (FRC 0.5 at 0.0541 instead of 0.0501 cycles/px) with 17 % less noise and 48 % less colour noise; on Jupiter 21_11_38Z (seeing-limited, σ ≈ 12 px) the resolution is unchanged, noise −7 % and colour noise −38 %. On synthetic recordings the error after an optimal restoration drops 8 % (planet), 6 % (surface) and 11 % (planet under haze).

The IDs in the first column are the ones used in the source comments.

Tests

swift test -c release -Xswiftc -enable-testing

The suite renders synthetic recordings with known ground truth (seeing jitter, local distortion, varying blur, noise, Bayer mosaic) and checks:

  • that the quality ranking follows the true seeing;
  • that the stack is closer to the ground truth than the best single frame;
  • SER byte-order detection, COG accuracy, sub-pixel AP alignment, surface tracking, drizzle, sigma clipping, double stack reference and 12-bit scaling;
  • the extensions: warp engine better than AP patches, refinement and per-AP reference lower the shift error, outlier replacement, frame weights, transparency compensation under haze, the noise map against the measured split-half noise, guided Bayer completion, option decoding of older settings, float TIFF/FITS round trips;
  • colour dispersion: measurement against the truth (also without dispersion), correction in the stack, a drifting dispersion; capture metadata: ASICAP / SharpCap / FireCapture logs (ASICAP's local times), times from names, whole-second file times, copied files, SER timestamps, header metadata in FITS / TIFF / PNG, and the mid time of the stacked frames; WinJUPOS names (rounding, carries, fields) from the stacked frames' mid time; batch work: planet / surface detection, preset files and the automatic choice, finding recordings, the watcher's completion rules (growing sequences, AVI logs, existing and excluded folders) and batch jobs stacking like a single run; sessions: restored stacks identical to fresh ones (local and global quality, surface, drizzle, discard-worst), exact floats, what is reused when settings change, moved and changed recordings, .as3 import (also a frame subset);
  • post-processing: wavelet reconstruction and denoising, PSF from the limb (σ 1.0–2.5 px) and from point sources, Richardson–Lucy and Wiener against the truth, recipes, and the Metal preview against the CPU reference plus its 4K speed.

Source layout

File Contents
SERFile.swift, MappedFile.swift, FrameSource.swift SER / AVI / image-sequence readers, sidecar metadata, 16-bit normalisation, registration
Stabilization.swift planet COG (dynamic background), surface tracking, anchor search
Quality.swift Laplacian noise-robust quality, local quality maps, artefact metric
AlignmentPoints.swift AP grid placement, multi-scale, smart stack rectangles
Alignment.swift half-resolution reference, gain-normalised SAD search, ln-parabola sub-pixel
Stacker.swift per-AP Bayer-drizzle accumulation, sigma clipping, weights, noise sums
Recombine.swift sharpness maps, pixel→AP assignment, mask blending
WarpStacker.swift B3 warp engine
Dispersion.swift A2 colour dispersion measurement and model
CaptureInfo.swift, StackMetadata.swift F3 capture metadata, frame times, output header metadata
Presets.swift, Watch.swift F1 presets, planet/surface detection, finding and watching recordings, batch jobs
ShiftSmoothing.swift B1 neighbour check of AP shifts
Demosaic.swift bilinear and guided demosaicing, B7 Bayer completion
Output.swift, ImageWriter.swift finishing (fill, normalise, drizzle resize), TIFF/PNG/FITS read and write
Session.swift the pipeline: analyse(), placeAPs(), stack()
Evaluation.swift scoring against synthetic truth, shift error, Fourier ring correlation
PostProcess/ recipes, wavelets / unsharp mask / tone, deconvolution, PSF estimation, FFT, Metal preview
AS3Session.swift AutoStakkert .as3 session reader (for luckystack asref replays and imports)
SessionFile.swift A6 .luckystack sessions: save, restore, what is reused; .as3 import
Sources/LuckyStackApp SwiftUI app
Sources/luckystack command-line tool

Not supported yet

MP4 and colour (debayered) input (colour sequences are treated as mono luminance), dark/flat/dead-pixel calibration, derotation, and writing .as3 session files (they are read, to replay or import AutoStakkert sessions; LuckyStack saves its own .luckystack sessions).

License

MIT; see LICENSE. AutoStakkert! is the work of its own author and is not covered by this license.

About

Native macOS lucky-imaging stacker for planetary, lunar and solar recordings, inspired by AutoStakkert!

Topics

astrophotographyimage-stackinglucky-imagingmacosplanetary-imagingswiftswiftui

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.