Commit f1ff932c authored by CodeHatchling's avatar CodeHatchling
Browse files

Formatted soft_inpainting.

parent b2414476
Loading
Loading
Loading
Loading
+16 −10
Original line number Diff line number Diff line
@@ -276,6 +276,7 @@ def weighted_histogram_filter(img, kernel, kernel_center, percentile_min=0.0, pe
            An element of the histogram, its weight
            and bounds.
            """

            def __init__(self, value, weight):
                self.value: float = value
                self.weight: float = weight
@@ -355,6 +356,7 @@ def weighted_histogram_filter(img, kernel, kernel_center, percentile_min=0.0, pe

    return img_out


def smoothstep(x):
    """
    The smoothstep function, input should be clamped to 0-1 range.
@@ -362,6 +364,7 @@ def smoothstep(x):
    """
    return x * x * (3 - 2 * x)


def smootherstep(x):
    """
    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:
        (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.
    def gaussian(sqr_mag):
        return math.exp(-sqr_mag / (stddev_radius * stddev_radius))
@@ -656,7 +660,8 @@ class Script(scripts.Script):
        # p.extra_generation_params["Mask rounding"] = False
        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:
            return

@@ -675,7 +680,8 @@ class Script(scripts.Script):
                                          mba.current_latent,
                                          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:
            return

@@ -723,8 +729,8 @@ class Script(scripts.Script):
                                                          height=p.height,
                                                          paste_to=p.paste_to)


    def postprocess_maskoverlay(self, p, ppmo: scripts.PostProcessMaskOverlayArgs, enabled, power, scale, detail_preservation, mask_inf, dif_thresh, dif_contr):
    def postprocess_maskoverlay(self, p, ppmo: scripts.PostProcessMaskOverlayArgs, enabled, power, scale,
                                detail_preservation, mask_inf, dif_thresh, dif_contr):
        if not enabled:
            return