mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
inpainting fix per PR #1218
- This is a merge of the final version of PR #1218 "Inpainting Improvements" Various merge conflicts made it easier to commit directly. Author: Kyle0654 Co-Author: lstein
This commit is contained in:
@ -109,7 +109,7 @@ class Inpaint(Img2Img):
|
||||
|
||||
return make_image
|
||||
|
||||
def sample_to_image(self, samples)->Image:
|
||||
def sample_to_image(self, samples)->Image.Image:
|
||||
gen_result = super().sample_to_image(samples).convert('RGB')
|
||||
|
||||
if self.pil_image is None or self.pil_mask is None:
|
||||
@ -142,7 +142,7 @@ class Inpaint(Img2Img):
|
||||
# Blur the mask out (into init image) by specified amount
|
||||
if mask_blur_radius > 0:
|
||||
nm = np.asarray(pil_init_mask, dtype=np.uint8)
|
||||
nmd = cv.dilate(nm, kernel=np.ones((3,3), dtype=np.uint8), iterations=int(mask_blur_radius / 2))
|
||||
nmd = cv.erode(nm, kernel=np.ones((3,3), dtype=np.uint8), iterations=int(mask_blur_radius / 2))
|
||||
pmd = Image.fromarray(nmd, mode='L')
|
||||
blurred_init_mask = pmd.filter(ImageFilter.BoxBlur(mask_blur_radius))
|
||||
else:
|
||||
|
Reference in New Issue
Block a user