Inpainting

Inpainting

← Back to Notebook Examples

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 Face diffusers pipeline as juspice.stable_diff.StableDiff). Each spice.inpaint.<method>() call changes spice.data in place, records what it did (including the mask itself) into spice.history, and returns spice so calls can be chained. Stable Diffusion runs with a low num_inference_steps to keep it fast on a CPU. The notebook finishes by saving the Telea result and replaying the whole pipeline with spice.history.to_lines().