You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
640 B

from demo import Demo
import numpy as np
from inpaint import Inpaint
inpute = Demo.loadImage("./dog/cow_img.bmp")
maskImage = Demo.loadImage("./dog/cow_mask.bmp")
inpute = np.copy(inpute)
height, width = inpute.shape[:2]
mask = np.zeros((height,width),dtype=bool)
for y in range(height):
for x in range(width):
mask[y,x] = maskImage[y,x] == 255
for y in range(height):
for x in range(width):
if mask[y,x]:
inpute[y,x,0] = 255
inpute[y,x,1] = 0
inpute[y,x,2] = 0
Demo.setValue(inpute,mask)
Demo.display(Demo.input)
output = Inpaint(Demo.input,Demo.mask,2)
Demo.display(output)