composite: use east frame background with bilateral filter at 70% zoom
Switch monthly pipeline from render_phase_closeup (black background) to composite_full_moon (east frame + NASA moon overlay) when an east frame and detection are available. Falls back to render_phase_closeup when east verification is disabled. Changes: - composite_full_moon: bilateral filter (d=9, σ=75) on upscaled background to smooth pixelation artifacts before compositing the NASA moon - composite_full_moon: caption now placed below the moon disk instead of overlapping it (paste_y + target_size + 12) - run_phase: keep detection result (best_det) alongside best_frame - _render_and_post: accept east_frame + detection, route to the right renderer - Monthly pipeline uses moon_height_pct=0.70 for the east-frame composite https://claude.ai/code/session_01JieSeNQZ3X6fhsb11YyJrK
This commit is contained in:
+8
-2
@@ -191,6 +191,11 @@ def composite_full_moon(
|
||||
crop = src.crop((left, top, left + crop_w, top + crop_h))
|
||||
bg = crop.resize(output_size, LANCZOS)
|
||||
|
||||
# ── Smooth upscaling artifacts in the sky background ──
|
||||
import cv2
|
||||
bg_arr = cv2.bilateralFilter(np.array(bg), d=9, sigmaColor=75, sigmaSpace=75)
|
||||
bg = Image.fromarray(bg_arr)
|
||||
|
||||
# ── Where is the moon's center within the upscaled background? ──
|
||||
moon_x_in_crop = cx - left
|
||||
moon_y_in_crop = cy - top
|
||||
@@ -230,10 +235,11 @@ def composite_full_moon(
|
||||
paste_y = max(0, min(paste_y, output_size[1] - target_size))
|
||||
bg.paste(ref_rot, (paste_x, paste_y), mask)
|
||||
|
||||
# ── Caption ──
|
||||
# ── Caption — below the moon disk, not overlapping it ──
|
||||
if caption:
|
||||
draw = ImageDraw.Draw(bg)
|
||||
_draw_caption(draw, caption, (22, output_size[1] - 48), output_size[0])
|
||||
caption_y = min(paste_y + target_size + 12, output_size[1] - 30)
|
||||
_draw_caption(draw, caption, (22, caption_y), output_size[0])
|
||||
|
||||
Path(out_path).parent.mkdir(parents=True, exist_ok=True)
|
||||
bg.save(out_path, quality=92)
|
||||
|
||||
Reference in New Issue
Block a user