overmask_scale_mainframes
parent
8cedb40787
commit
b1dcbd5c9e
|
|
@ -14,7 +14,6 @@ from .sd_helpers import renderImg2Img, renderTxt2Img
|
|||
from .image import shrink_and_paste_on_blank
|
||||
from .video import write_video
|
||||
|
||||
|
||||
def crop_fethear_ellipse(image, feather_margin=30, width_offset=0, height_offset=0):
|
||||
# Create a blank mask image with the same size as the original image
|
||||
mask = Image.new("L", image.size, 0)
|
||||
|
|
@ -89,6 +88,7 @@ def outpaint_steps(
|
|||
mask_width,
|
||||
mask_height,
|
||||
custom_exit_image,
|
||||
overmask,
|
||||
frame_correction=True, # TODO: add frame_Correction in UI
|
||||
):
|
||||
main_frames = [init_img.convert("RGB")]
|
||||
|
|
@ -108,7 +108,7 @@ def outpaint_steps(
|
|||
current_image, mask_width, mask_height
|
||||
)
|
||||
|
||||
mask_image = np.array(current_image)[:, :, 3]
|
||||
mask_image = np.array(current_image.resize((current_image.width-overmask, current_image.height-overmask)))[:, :, 3]
|
||||
mask_image = Image.fromarray(255 - mask_image).convert("RGB")
|
||||
# create mask (black image with white mask_width width edges)
|
||||
|
||||
|
|
@ -190,6 +190,7 @@ def create_zoom(
|
|||
upscale_do,
|
||||
upscaler_name,
|
||||
upscale_by,
|
||||
overmask,
|
||||
inpainting_denoising_strength=1,
|
||||
inpainting_full_res=0,
|
||||
inpainting_padding=0,
|
||||
|
|
@ -221,6 +222,7 @@ def create_zoom(
|
|||
upscale_do,
|
||||
upscaler_name,
|
||||
upscale_by,
|
||||
overmask,
|
||||
inpainting_denoising_strength,
|
||||
inpainting_full_res,
|
||||
inpainting_padding,
|
||||
|
|
@ -312,6 +314,7 @@ def create_zoom_single(
|
|||
upscale_do,
|
||||
upscaler_name,
|
||||
upscale_by,
|
||||
overmask,
|
||||
inpainting_denoising_strength,
|
||||
inpainting_full_res,
|
||||
inpainting_padding,
|
||||
|
|
@ -409,12 +412,14 @@ def create_zoom_single(
|
|||
mask_width,
|
||||
mask_height,
|
||||
custom_exit_image,
|
||||
overmask
|
||||
)
|
||||
all_frames.append(
|
||||
do_upscaleImg(main_frames[0], upscale_do, upscaler_name, upscale_by)
|
||||
if upscale_do
|
||||
else main_frames[0]
|
||||
)
|
||||
|
||||
for i in range(len(main_frames) - 1):
|
||||
# interpolation steps between 2 inpainted images (=sequential zoom and crop)
|
||||
for j in range(num_interpol_frames - 1):
|
||||
|
|
@ -477,20 +482,9 @@ def create_zoom_single(
|
|||
if upscale_do and progress:
|
||||
progress(((i + 1) / num_outpainting_steps), desc="upscaling interpol")
|
||||
|
||||
all_frames.append(
|
||||
do_upscaleImg(interpol_image, upscale_do, upscaler_name, upscale_by)
|
||||
if upscale_do
|
||||
else interpol_image
|
||||
)
|
||||
all_frames.append(interpol_image)
|
||||
|
||||
if upscale_do and progress:
|
||||
progress(((i + 1) / num_outpainting_steps), desc="upscaling current")
|
||||
|
||||
all_frames.append(
|
||||
do_upscaleImg(current_image, upscale_do, upscaler_name, upscale_by)
|
||||
if upscale_do
|
||||
else current_image
|
||||
)
|
||||
all_frames.append(current_image)
|
||||
|
||||
frames2Collect(all_frames, out_config)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ default_sampling_steps = 35
|
|||
default_sampler = "DDIM"
|
||||
default_cfg_scale = 8
|
||||
default_mask_blur = 48
|
||||
default_overmask = 8
|
||||
default_total_outpaints = 5
|
||||
promptTableHeaders = ["Start at second [0,1,...]", "Prompt"]
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ from .static_variables import (
|
|||
default_cfg_scale,
|
||||
default_mask_blur,
|
||||
default_sampler,
|
||||
default_overmask
|
||||
)
|
||||
from .helpers import putPrompts, clearPrompts
|
||||
from .prompt_util import readJsonPrompt
|
||||
|
|
@ -219,6 +220,12 @@ def on_ui_tabs():
|
|||
maximum=64,
|
||||
value=default_mask_blur,
|
||||
)
|
||||
overmask = gr.Slider(
|
||||
label="Overmask (px) paint a bit into centered image",
|
||||
minimum=0,
|
||||
maximum=64,
|
||||
value=default_overmask,
|
||||
)
|
||||
inpainting_fill_mode = gr.Radio(
|
||||
label="Masked content",
|
||||
choices=["fill", "original", "latent noise", "latent nothing"],
|
||||
|
|
@ -287,6 +294,7 @@ Our best experience and trade-off is the R-ERSGAn4x upscaler.
|
|||
upscale_do,
|
||||
upscaler_name,
|
||||
upscale_by,
|
||||
overmask
|
||||
],
|
||||
outputs=[output_video, out_image, generation_info, html_info, html_log],
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue