mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-01-04 13:55:06 +08:00
Formatted soft_inpainting.
This commit is contained in:
parent
b2414476ef
commit
f1ff932caf
@ -276,6 +276,7 @@ def weighted_histogram_filter(img, kernel, kernel_center, percentile_min=0.0, pe
|
|||||||
An element of the histogram, its weight
|
An element of the histogram, its weight
|
||||||
and bounds.
|
and bounds.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, value, weight):
|
def __init__(self, value, weight):
|
||||||
self.value: float = value
|
self.value: float = value
|
||||||
self.weight: float = weight
|
self.weight: float = weight
|
||||||
@ -355,6 +356,7 @@ def weighted_histogram_filter(img, kernel, kernel_center, percentile_min=0.0, pe
|
|||||||
|
|
||||||
return img_out
|
return img_out
|
||||||
|
|
||||||
|
|
||||||
def smoothstep(x):
|
def smoothstep(x):
|
||||||
"""
|
"""
|
||||||
The smoothstep function, input should be clamped to 0-1 range.
|
The smoothstep function, input should be clamped to 0-1 range.
|
||||||
@ -362,6 +364,7 @@ def smoothstep(x):
|
|||||||
"""
|
"""
|
||||||
return x * x * (3 - 2 * x)
|
return x * x * (3 - 2 * x)
|
||||||
|
|
||||||
|
|
||||||
def smootherstep(x):
|
def smootherstep(x):
|
||||||
"""
|
"""
|
||||||
The smootherstep function, input should be clamped to 0-1 range.
|
The smootherstep function, input should be clamped to 0-1 range.
|
||||||
@ -385,6 +388,7 @@ def get_gaussian_kernel(stddev_radius=1.0, max_radius=2):
|
|||||||
Returns:
|
Returns:
|
||||||
(nparray, nparray): A kernel array (shape: (N, N)), its center coordinate (shape: (2))
|
(nparray, nparray): A kernel array (shape: (N, N)), its center coordinate (shape: (2))
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Evaluates a 0-1 normalized gaussian function for a given square distance from the mean.
|
# Evaluates a 0-1 normalized gaussian function for a given square distance from the mean.
|
||||||
def gaussian(sqr_mag):
|
def gaussian(sqr_mag):
|
||||||
return math.exp(-sqr_mag / (stddev_radius * stddev_radius))
|
return math.exp(-sqr_mag / (stddev_radius * stddev_radius))
|
||||||
@ -656,7 +660,8 @@ class Script(scripts.Script):
|
|||||||
# p.extra_generation_params["Mask rounding"] = False
|
# p.extra_generation_params["Mask rounding"] = False
|
||||||
settings.add_generation_params(p.extra_generation_params)
|
settings.add_generation_params(p.extra_generation_params)
|
||||||
|
|
||||||
def on_mask_blend(self, p, mba: scripts.MaskBlendArgs, enabled, power, scale, detail_preservation, mask_inf, dif_thresh, dif_contr):
|
def on_mask_blend(self, p, mba: scripts.MaskBlendArgs, enabled, power, scale, detail_preservation, mask_inf,
|
||||||
|
dif_thresh, dif_contr):
|
||||||
if not enabled:
|
if not enabled:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -675,7 +680,8 @@ class Script(scripts.Script):
|
|||||||
mba.current_latent,
|
mba.current_latent,
|
||||||
get_modified_nmask(settings, mba.nmask, mba.sigma[0]))
|
get_modified_nmask(settings, mba.nmask, mba.sigma[0]))
|
||||||
|
|
||||||
def post_sample(self, p, ps: scripts.PostSampleArgs, enabled, power, scale, detail_preservation, mask_inf, dif_thresh, dif_contr):
|
def post_sample(self, p, ps: scripts.PostSampleArgs, enabled, power, scale, detail_preservation, mask_inf,
|
||||||
|
dif_thresh, dif_contr):
|
||||||
if not enabled:
|
if not enabled:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -723,8 +729,8 @@ class Script(scripts.Script):
|
|||||||
height=p.height,
|
height=p.height,
|
||||||
paste_to=p.paste_to)
|
paste_to=p.paste_to)
|
||||||
|
|
||||||
|
def postprocess_maskoverlay(self, p, ppmo: scripts.PostProcessMaskOverlayArgs, enabled, power, scale,
|
||||||
def postprocess_maskoverlay(self, p, ppmo: scripts.PostProcessMaskOverlayArgs, enabled, power, scale, detail_preservation, mask_inf, dif_thresh, dif_contr):
|
detail_preservation, mask_inf, dif_thresh, dif_contr):
|
||||||
if not enabled:
|
if not enabled:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user