Merge pull request #43 from outis1one/clDemoe/seasonal-sunrise-montage-nn268
ClDemoe/seasonal sunrise montage nn268
This commit is contained in:
+8
-3
@@ -92,6 +92,7 @@ mapfile -t all_images < <(find "$image_dir" -type f -name "*.jpg" | sort)
|
||||
# SEASONS_GREY_STDDEV_MIN=0 (default) disables the grey filter.
|
||||
# Set to e.g. 5 in sky-cam.conf to drop uniform grey frames (bad-signal captures).
|
||||
GREY_MIN="${SEASONS_GREY_STDDEV_MIN:-0}"
|
||||
GREY_DARK_FLOOR="${SEASONS_GREY_DARK_FLOOR:-30}" # frames darker than this are never skipped
|
||||
images=(); bad=0; grey=0
|
||||
for img in "${all_images[@]}"; do
|
||||
# Empty or unreadable
|
||||
@@ -106,10 +107,14 @@ for img in "${all_images[@]}"; do
|
||||
echo "WARNING: skipping corrupt frame: $(basename "$img")"
|
||||
((bad++)) || true; continue
|
||||
fi
|
||||
# Optional: skip uniform-grey bad-signal frames (low pixel standard deviation)
|
||||
# Optional: skip uniform-grey bad-signal frames.
|
||||
# A frame is bad-signal if it is BOTH uniform (low stddev) AND not dark.
|
||||
# Night frames are dark so they pass even with low stddev.
|
||||
if [ "$GREY_MIN" != "0" ] && command -v convert &>/dev/null; then
|
||||
stddev=$(convert "$img" -colorspace Gray -format "%[fx:int(standard_deviation*255)]" info: 2>/dev/null || echo "255")
|
||||
if [ "${stddev:-255}" -lt "$GREY_MIN" ]; then
|
||||
read -r stddev mean < <(convert "$img" -colorspace Gray \
|
||||
-format "%[fx:int(standard_deviation*255)] %[fx:int(mean*255)]" \
|
||||
info: 2>/dev/null || echo "255 128")
|
||||
if [ "${stddev:-255}" -lt "$GREY_MIN" ] && [ "${mean:-0}" -gt "$GREY_DARK_FLOOR" ]; then
|
||||
((grey++)) || true; continue
|
||||
fi
|
||||
fi
|
||||
|
||||
+10
-6
@@ -257,13 +257,17 @@ AUDIO_BITRATE=192k # montage-mvt.sh — music track on movement
|
||||
|
||||
# ── Frame validation (4-seasons.sh) ──────────────────────────────────────────
|
||||
# Corrupt or empty frames (e.g. first frame after a camera reconnect) are always
|
||||
# skipped automatically via ffprobe.
|
||||
# skipped automatically via ffprobe. No config needed.
|
||||
#
|
||||
# SEASONS_GREY_STDDEV_MIN: also skip uniform-grey frames caused by a bad RTSP
|
||||
# signal. These are valid JPEGs but contain a near-solid grey image.
|
||||
# Value is the minimum pixel standard deviation on a 0–255 scale.
|
||||
# 0 = disabled (default). Try 5–10 if your camera produces grey frames on reconnect.
|
||||
SEASONS_GREY_STDDEV_MIN=0
|
||||
# SEASONS_GREY_STDDEV_MIN / SEASONS_GREY_DARK_FLOOR — optional bad-signal filter.
|
||||
# Uncomment both lines to enable. A frame is dropped only when BOTH are true:
|
||||
# 1. pixel standard deviation (0–255) < SEASONS_GREY_STDDEV_MIN (frame is uniform)
|
||||
# 2. mean brightness (0–255) > SEASONS_GREY_DARK_FLOOR (frame is not dark)
|
||||
# This keeps genuine night frames (dark + low variation) while dropping
|
||||
# solid-grey bad-signal frames (mid-bright + no variation).
|
||||
# Requires ImageMagick (convert). Start with these values and tune from there:
|
||||
#SEASONS_GREY_STDDEV_MIN=5 # skip if stdev < 5 (very uniform)
|
||||
#SEASONS_GREY_DARK_FLOOR=30 # …but only if mean brightness > 30 (not a night frame)
|
||||
|
||||
# ── Montage attribution overlay ───────────────────────────────────────────────
|
||||
# A translucent bar across the top of each movement montage, naming the
|
||||
|
||||
Reference in New Issue
Block a user