Totally obsessed with the idea of inpainting, used to reconstruct and remove items from images automatically. I’m especially in love with the glitchy, Predator-esque ghosting that remains.
This is very easy to accomplish with OpenCV and a few lines of code – here I’ve run this with a radius of 5px. The results are actually pretty usable, especially in busy or small areas of the image.
The very simple code to run everything:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import numpy as np import cv2 input_image = 'bedroom.jpg' mask_image = 'bedroom-mask3.jpg' radius = 5 img = cv2.imread(input_image) mask = cv2.imread(mask_image) mask = cv2.cvtColor(mask, cv2.COLOR_BGR2GRAY) dest = cv2.inpaint(img, mask, radius, cv2.INPAINT_TELEA) cv2.imwrite('Telea-' + str(radius) + '.jpg', dest) |
And here’s the same input, but with a really weird, blobby, random mask:
h/t Miriam Redi