Portable Automated Macro-Stitching Film Digitizer
An automated sub-$160 macro-stitching scanner combining dual-axis microstepping, a 10-stage physical 12-bit Bayer-RAW optical-density model, and a LAN streaming VLM architecture.
Desktop analog film digitization forces a trade-off between lab turnaround, bulky copy stands, and $500–$1,500 dedicated scanners. Inside a $158.11 hardware BOM, I built an automated 4×4 macro-stitching scanner producing 4104×3447 4K-class scans (<0.1 mm homing, <5 px seams, 0 frame drops across 2-hour 68.4 °C thermal soak) paired with a physical 12-bit Bayer-RAW optical-density pipeline and a per-tile LAN streaming FastAPI + VLM backend.
Why 4×4 Macro-Stitching and Split Timing Beat Single-Shot Scanners
Capturing a full 35 mm frame in one shot inside a compact box introduces severe edge field curvature and chromatic aberration. Adding a 10 mm extension tube to a 25 mm f/1.4 C-mount lens on a 12 MP Sony IMX477 (1.55 µm pixel pitch) sets working distance to 8.75 cm (8.73 cm bench / 8.5 cm enclosure) at M = 0.4× (15.7 × 11.7 mm tile FoV). To avoid stacking two full X–Y stages, the upper gantry translates the camera (X) while the lower stage moves the film (Y) at 1/16 microstepping (0.625 µm/step).
Because Linux scheduling jitter corrupts stepper timing, we split control across two planes: a Raspberry Pi 4 (:5000) sends synchronous 115,200-baud coordinate packets to an STM32F401RE hardware ISR (<10 ms command latency, 500 ms settle delay before shutter ACK), powered by star-topology rails (12.462 V battery, 5.150 V logic, ≤50 mV p-p ripple, AMS1117-3.3 solving CMOS V_IH = 0.7 VDD logic-level matching on A4988 drivers).
Inside the 10-Stage Optical-Density & Dye-Unmixing Pipeline
Naive 255 − x RGB inversion destroys color negatives because the orange coupler mask compresses blue/green dynamic range, film dyes behave logarithmically in optical density, and spectral crosstalk shifts hues nonlinearly. Our 10+ stage physical model (Post_Processing_Negative/) works strictly in linear 12-bit Bayer RAW: per-tile flat-fielding → base transmission T = I_lin / I_base → optical density D = −ln(T) → 3×3 dye-crosstalk unmixing matrix M → expm1 positive inversion (g = [1.35, 1.20, 1.10]) → Lab zoned tone curves, paired with an Agentic VLM Router (29 unit tests) that classifies negative, positive, and instant film via majority vote.
Why Synthetic DNGs Broke Physics—and Why Bandwidth Beat AWS Lambda
Two empirical audits reshaped the entire architecture. First, measuring all 24 physical neighbor tile pairs captured serpentine lead-screw backlash and brought final 4K seam alignment to < 5 px (< 0.1 mm homing). Second, auditing the legacy 13496×11784 Pi-stitched synthetic DNG proved it contained 26.7% below-black numeric zeros and 12.2% clipped backlight, breaking optical-density math. Pivoting to streaming native 4056×3040 per-tile DNGs with first-three-tile global bootstrapping fixed RAW validity while overlapping scanning with 2-worker compute.
Benchmarking cloud vs. local compute exposed an equally clear systems lesson: AWS Lambda warm compute itself is fast (0.851 s CloudWatch duration, 1.08 s 5-run mean, 98 MB RAM; 3.57 s cold start), but uploading 16 × 18.5 MB RAW frames (320.9 MB @ 10 Mbps) burns 256.72 s (> 4.2 minutes) on WAN transfer alone. Moving the FastAPI pipeline to local LAN delivered < 1 s direct previews, 1–3 s/tile RAW fast previews, and < 30 s/tile full physical restoration on a $158.11 BOM.
Diagnosing Real CineStill 400D Hotspots and Underside PCB Solder Bridges
Running real CineStill 400D film end-to-end (4104×3447) validated crisp < 5 px rebate text and polarity recovery while transparently exposing localized magenta circles where raw LED backlight dies saturated the sensor—pointing straight to a thicker optical diffuser and locking global fixed_stats across all 16 tiles. On the electronics side, TruView 12 X-ray inspection caught bridged underside solder pads on the STM32WB5MMG footprint, prompting a reliable STM32F401RE dev-board fallback for the working prototype.