Skip to content

[WIP] Second inpainting pass to extrapolate padding pixels smarter #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions scripts/deforum.py

Large diffs are not rendered by default.

33 changes: 27 additions & 6 deletions scripts/deforum/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,29 @@ def anim_frame_warp_2d(prev_img_cv2, args, anim_args, keys, frame_idx):
else:
xform = np.matmul(rot_mat, trans_mat)

return cv2.warpPerspective(
prev_img_cv2,
xform,
(prev_img_cv2.shape[1], prev_img_cv2.shape[0]),
borderMode=cv2.BORDER_WRAP if anim_args.border == 'wrap' else cv2.BORDER_REPLICATE
)
borderMode = cv2.BORDER_CONSTANT #zeros

if anim_args.border == 'wrap':
borderMode = cv2.BORDER_WRAP
elif anim_args.border == 'wrap':
borderMode = cv2.BORDER_REPLICATE

if borderMode == 'zeros':
return cv2.warpPerspective(
prev_img_cv2,
xform,
(prev_img_cv2.shape[1], prev_img_cv2.shape[0]),
borderMode=borderMode,
borderValue=(0, 0, 0,),
)
else:
return cv2.warpPerspective(
prev_img_cv2,
xform,
(prev_img_cv2.shape[1], prev_img_cv2.shape[0]),
borderMode=borderMode,
)


def anim_frame_warp_3d(device, prev_img_cv2, depth, anim_args, keys, frame_idx):
TRANSLATION_SCALE = 1.0/200.0 # matches Disco
Expand Down Expand Up @@ -272,6 +289,10 @@ def __init__(self, anim_args):
self.contrast_schedule_series = get_inbetweens(parse_key_frames(anim_args.contrast_schedule), anim_args.max_frames)
self.cfg_scale_schedule_series = get_inbetweens(parse_key_frames(anim_args.cfg_scale_schedule), anim_args.max_frames)
self.seed_schedule_series = get_inbetweens(parse_key_frames(anim_args.seed_schedule), anim_args.max_frames)
self.kernel_schedule_series = get_inbetweens(parse_key_frames(anim_args.kernel_schedule), anim_args.max_frames)
self.sigma_schedule_series = get_inbetweens(parse_key_frames(anim_args.sigma_schedule), anim_args.max_frames)
self.amount_schedule_series = get_inbetweens(parse_key_frames(anim_args.amount_schedule), anim_args.max_frames)
self.threshold_schedule_series = get_inbetweens(parse_key_frames(anim_args.threshold_schedule), anim_args.max_frames)
self.fov_series = get_inbetweens(parse_key_frames(anim_args.fov_schedule), anim_args.max_frames)
self.near_series = get_inbetweens(parse_key_frames(anim_args.near_schedule), anim_args.max_frames)
self.far_series = get_inbetweens(parse_key_frames(anim_args.far_schedule), anim_args.max_frames)
Expand Down
Loading