Small test project for pyramidal image inpainting in Processing v.3.5.3.
key words: image inpainting; image completion
This algorithm as described by Chema Guerra works in 2 stages:
-
The first stage (analysis) prepares the mean pyramid of the source image by doing progressive 1:2 downscalings. Only the meaningful (not-a-hole) pixels in each 2×2 packet are averaged down. If a 2×2 packet does not have any meaningful pixels, a hole is passed to the next (lower) level.
-
The second stage (synthesis) starts at the smallest level and goes up, leaving meaningful pixels intact, while replacing holes by upscaled data from the previous (lower) level.
The project assumes that pixels to be filled have a special "mask" color, such as #00FF00. Other approaches (e.g. using an alpha channel) would be better.
Sample results in 256x256 using a green mask:
Very modest; this is not optimized or GPU code. About 3ms for 256x256 pixel image, with approx. 20% pixels masked, on MacBook Pro (Early 2013), 3GHz Intel Core i7. Sample images from Flickr CC.
- http://chemaguerra.com/filling-of-missing-image-pixels/
- http://wwwvis.informatik.uni-stuttgart.de/~kraus/preprints/vmv06_strengert.pdf
- https://rosettacode.org/wiki/Bilinear_interpolation#Java
- https://github.com/kosua20/Rendu
- https://github.com/cheind/inpaint (C++)
- https://github.com/Mugichoko445/Fast-Digital-Image-Inpainting (OpenCV2, C++)
- https://github.com/YuanTingHsieh/Image_Completion & add'l code
- https://www.researchgate.net/publication/275197779_Fast_GPU-based_image_warping_and_inpainting_for_frame_interpolation (CUDA)
- https://www.shadertoy.com/view/4ty3Dy (GLSL)
- https://forum.openframeworks.cc/t/how-to-configure-a-shader-with-multiple-render-buffers-and-swapbuffers-ex-shadertoy/23933