Add nightly moon-track timelapse and monthly moon-phase composites
Two new jobs operate on the SUNRISE_CAM, sharing three Python helpers (moon_phase, moon_detect, moon_composite) and one cached lunar texture: - moon-track.sh: nightly batch detects the moon in each east frame, crops a 480x480 box around it, stitches into an mp4 that holds the moon roughly centred while clouds and stars drift past. - moon-phase-monthly.sh: daily check that runs whichever phase composite is due that day. Handles full moon (posts D+3), first quarter (D+2, best-effort due to daytime-only geometry from east), and third quarter (D+2). Picks the frame closest in time to the exact phase moment that meets quality / altitude / illumination thresholds, then composites the cached lunar texture into it -- sky/halo/parallactic-angle/timing real from east, surface detail borrowed from the reference image. Honest-by-design: a 38-px white blob from a wide-field IP camera cannot be enhanced into crater detail by software. The composite makes the borrowing explicit and constrains everything else (when, where, sky, orientation) to match what east actually saw. install.sh now downloads the skyfield ephemeris (de421.bsp) and the default lunar reference (Wikipedia CC BY-SA full-moon photo) on first run. Both can be overridden via .env. https://claude.ai/code/session_015PBVDESC3KLMbq1LpA6qLn
This commit is contained in:
+109
@@ -47,6 +47,18 @@
|
||||
# on the last day of a movement, auto-triggers
|
||||
# montage-mvt.sh
|
||||
#
|
||||
# moon-track.sh — nightly at SCHEDULE_MOON_TRACK (SUNRISE_CAM only)
|
||||
# detects the moon in each east night frame, crops
|
||||
# a tracked sequence, stitches into an mp4
|
||||
#
|
||||
# moon-phase-monthly.sh — daily at SCHEDULE_MOON_PHASE (SUNRISE_CAM only)
|
||||
# no-ops except on phase post-days, when it picks
|
||||
# the best east frame from the collection window,
|
||||
# composites a high-res lunar texture into it,
|
||||
# and posts to Mattermost. Handles full moon,
|
||||
# first quarter (waxing half), and third quarter
|
||||
# (waning half).
|
||||
#
|
||||
#
|
||||
# install.sh — run once at setup, and again if this file changes
|
||||
# generates and installs systemd units from conf
|
||||
@@ -135,6 +147,25 @@
|
||||
# ← run manually only; no script calls it
|
||||
# → safe to rename with no other changes needed
|
||||
#
|
||||
# moon-track.sh
|
||||
# ← called by systemd sky-cam-moon-track.timer (SCHEDULE_MOON_TRACK)
|
||||
# → if renamed: update install.sh (the moon-track write_service block)
|
||||
# calls → moon_detect.py (Python lib via heredoc), ffmpeg
|
||||
#
|
||||
# moon-phase-monthly.sh
|
||||
# ← called by systemd sky-cam-moon-phase.timer (SCHEDULE_MOON_PHASE)
|
||||
# → if renamed: update install.sh (the moon-phase write_service block)
|
||||
# calls → moon_phase_monthly.py
|
||||
#
|
||||
# moon_phase_monthly.py
|
||||
# ← called by moon-phase-monthly.sh
|
||||
# → if renamed: update moon-phase-monthly.sh (the exec line at the bottom)
|
||||
# calls → moon_phase.py, moon_detect.py, moon_composite.py, notify.sh
|
||||
#
|
||||
# moon_phase.py / moon_detect.py / moon_composite.py
|
||||
# ← Python libraries used by moon-track.sh and moon_phase_monthly.py
|
||||
# → if renamed: update moon-track.sh, moon_phase_monthly.py, README
|
||||
#
|
||||
# =============================================================================
|
||||
|
||||
# ── Install location ──────────────────────────────────────────────────────────
|
||||
@@ -235,6 +266,10 @@ SUNRISE_CAM=east # which camera faces east (gets the sunrise v
|
||||
#
|
||||
SCHEDULE_SUNRISE=03:00:00
|
||||
|
||||
# Moon jobs (see "Moon jobs" section further down)
|
||||
SCHEDULE_MOON_TRACK=02:30:00 # nightly tracker — runs after midnight, before seasons
|
||||
SCHEDULE_MOON_PHASE=09:30:00 # daily check; no-ops except on phase post-days
|
||||
|
||||
# Four Seasons daily clip — one per camera, staggered 30 min apart.
|
||||
# Processes yesterday's images; on the last day of a movement auto-triggers
|
||||
# montage-mvt.sh. Space cameras at least 30 min apart to avoid disk contention.
|
||||
@@ -397,6 +432,80 @@ AMBIENT_RETENTION_DAYS=30 # global default; 0 = keep forever
|
||||
#AMBIENT_RETENTION_DAYS_north=30
|
||||
#AMBIENT_RETENTION_DAYS_south=60 # keep south longer for nature sound library
|
||||
|
||||
# ── Moon jobs (nightly tracker + monthly phase close-ups) ────────────────────
|
||||
# All moon jobs operate on the SUNRISE_CAM (the east-facing camera that already
|
||||
# has a clear view of the eastern sky). They share three Python helpers
|
||||
# (moon_phase.py, moon_detect.py, moon_composite.py) and one cached lunar
|
||||
# reference texture downloaded by install.sh.
|
||||
#
|
||||
# moon-track.sh nightly batch — detects the moon in each frame,
|
||||
# crops a 480×480 box around it, stitches the
|
||||
# tracked sequence into an mp4. Output:
|
||||
# $MOVIES_DIR/<cam>/moon-track/YYYY/YYYY-MM-DD-moon-track.mp4
|
||||
#
|
||||
# moon-phase-monthly.sh daily check; runs whichever phase composite is
|
||||
# due today. Three phases handled:
|
||||
# 🌕 Full Moon posts D + MOON_FULL_POST_DELAY_DAYS
|
||||
# 🌓 First Quarter posts D + MOON_QUARTER_POST_DELAY_DAYS
|
||||
# 🌗 Third Quarter posts D + MOON_QUARTER_POST_DELAY_DAYS
|
||||
# Each picks the frame closest in time to the
|
||||
# exact phase moment that meets quality / altitude
|
||||
# / illumination thresholds, composites the
|
||||
# cached lunar texture into it (sky/halo/angle
|
||||
# real from east, surface detail borrowed),
|
||||
# uploads to Mattermost. Output:
|
||||
# $MOVIES_DIR/<cam>/full-moons/YYYY-MM-full.jpg
|
||||
# $MOVIES_DIR/<cam>/first-quarter/YYYY-MM-first-quarter.jpg
|
||||
# $MOVIES_DIR/<cam>/third-quarter/YYYY-MM-third-quarter.jpg
|
||||
#
|
||||
# Honest-by-design: the surface texture is not from your camera (no software
|
||||
# can recover detail your camera didn't capture). The framing — sky color,
|
||||
# halo, parallactic angle, exact moment of capture — is all real-from-east.
|
||||
#
|
||||
# Geometry caveat: east only sees the eastern sky. At first quarter the moon
|
||||
# is up only from noon to midnight, transiting south at sunset, so east only
|
||||
# catches it during DAYTIME. The brightness-based detector often fails on
|
||||
# daytime moon shots — first quarter is best-effort. Full moon and third
|
||||
# quarter both rise after dark and stay in east's view; those should land
|
||||
# cleanly most months.
|
||||
#
|
||||
# Toggles (any can be disabled independently):
|
||||
MOON_TRACK_ENABLED=true
|
||||
MOON_FULL_ENABLED=true
|
||||
MOON_FIRST_QUARTER_ENABLED=true # set false if daytime-detection misses are noisy
|
||||
MOON_THIRD_QUARTER_ENABLED=true
|
||||
|
||||
# Nightly tracker tuning ──────────────────────────────────────────────────────
|
||||
MOON_TRACK_CROP_PX=480 # pixels — box size around the moon (source coords)
|
||||
MOON_TRACK_FPS=12 # output mp4 framerate
|
||||
MOON_TRACK_CRF=24 # output mp4 CRF
|
||||
MOON_TRACK_RETENTION_DAYS=90 # delete tracker mp4s older than this; 0 = forever
|
||||
|
||||
# Full-moon monthly tuning ────────────────────────────────────────────────────
|
||||
# How many days after the exact full moon to post. 3 = waits for D-1..D+2
|
||||
# nights to be on disk, then runs the morning of D+3.
|
||||
MOON_FULL_POST_DELAY_DAYS=3
|
||||
|
||||
# Frame-acceptance thresholds — a candidate must beat all three to qualify.
|
||||
# Lower = more permissive (accept hazier nights / lower moon). If you find
|
||||
# the script never finds a clear shot, loosen these.
|
||||
MOON_FULL_MIN_QUALITY=0.55 # 0..1 from moon_detect (roundness × halo × isolation)
|
||||
MOON_FULL_MIN_ALTITUDE_DEG=15 # below this the moon is in trees / on the horizon
|
||||
MOON_FULL_MIN_ILLUMINATION=0.95 # 0..1 — ~95% lit covers ±2 days from exact full
|
||||
|
||||
# Output frame. Default 1920×1080 to match the sunrise videos.
|
||||
MOON_FULL_OUTPUT_W=1920
|
||||
MOON_FULL_OUTPUT_H=1080
|
||||
MOON_FULL_HEIGHT_PCT=0.70 # moon disk fills this fraction of frame height
|
||||
|
||||
# Lunar reference texture — downloaded once by install.sh, reused forever.
|
||||
# Override MOON_REFERENCE_URL in .env to use a different image. Any high-res
|
||||
# photo of a full moon on a black background works. Default is the Wikipedia
|
||||
# "FullMoon2010" by Gregory H. Revera (CC BY-SA 3.0), 3500×3500.
|
||||
#MOON_REFERENCE_URL=https://upload.wikimedia.org/wikipedia/commons/e/e1/FullMoon2010.jpg
|
||||
#MOON_REFERENCE_DIR="$SCRIPT_DIR/moon-ref"
|
||||
#MOON_REFERENCE_PATH="$MOON_REFERENCE_DIR/full-moon.jpg"
|
||||
|
||||
# ── Mattermost — daily sunrise upload ─────────────────────────────────────────
|
||||
# mattermost_url, access_token, channel_id go in .env (see bottom of this file).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user