Skip to content

Commit

Permalink
Reduce mask blur kernel size to 2.5 sigmas
Browse files Browse the repository at this point in the history
This more closely matches the old behavior of PIL's Gaussian blur, and
fixes breakage when tiling.

See Coyote-A/ultimate-upscale-for-automatic1111#111 (comment)

Thanks to Алексей Трофимов and eunnone for reporting the issue.
  • Loading branch information
Splendide-Imaginarius committed Aug 5, 2023
1 parent a1825ee commit 5688864
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1275,13 +1275,13 @@ def init(self, all_prompts, all_seeds, all_subseeds):

if self.mask_blur_x > 0:
np_mask = np.array(image_mask)
kernel_size = 2 * int(4 * self.mask_blur_x + 0.5) + 1
kernel_size = 2 * int(2.5 * self.mask_blur_x + 0.5) + 1
np_mask = cv2.GaussianBlur(np_mask, (kernel_size, 1), self.mask_blur_x)
image_mask = Image.fromarray(np_mask)

if self.mask_blur_y > 0:
np_mask = np.array(image_mask)
kernel_size = 2 * int(4 * self.mask_blur_y + 0.5) + 1
kernel_size = 2 * int(2.5 * self.mask_blur_y + 0.5) + 1
np_mask = cv2.GaussianBlur(np_mask, (1, kernel_size), self.mask_blur_y)
image_mask = Image.fromarray(np_mask)

Expand Down

0 comments on commit 5688864

Please sign in to comment.