Inpainting¶
- notebooks/inpainting/example_inpainting.ipynb
Repairs a damaged rectangle in a grayscale SEM image using
spice.inpaint.<method>(), and compares four methods side by side: Telea (OpenCV, fast, spreads nearby pixels inward), biharmonic (scikit-image, a smooth mathematical fill), IOPaint (the external LaMa model, run as a separate program), and Stable Diffusion (generative — it invents new content from a text prompt, via the same Hugging Facediffuserspipeline asjuspice.stable_diff.StableDiff). Eachspice.inpaint.<method>()call changesspice.datain place, records what it did (including the mask itself) intospice.history, and returnsspiceso calls can be chained. Stable Diffusion runs with a lownum_inference_stepsto keep it fast on a CPU. The notebook finishes by saving the Telea result and replaying the whole pipeline withspice.history.to_lines().