sketchkit.animation package

Subpackages

Submodules

sketchkit.animation.animator module

class sketchkit.animation.animator.Animator(method: str = 'RIFE', device: str = 'cuda')[source]

Bases: object

A class for sketch animation or inbetweening.

method

The animation method that is used.

Type:

str

device

The device that is used.

Type:

str

_gen_gif(all_files, save_path)[source]

Gennerate .gif for images in a folder.

run(input_0: ndarray, input_1: ndarray, inner_frames: int = 8, output_folder: str = 'animation') list[ndarray][source]

Generate sketch animation or inbetweening.

Parameters:
  • input_0 (numpy.ndarray) – an input raster image (frame 0).

  • input_1 (numpy.ndarray) – an input raster image (frame 1).

  • inner_frames (int) – number of intermediate frames.

  • output_folder (str, optional) – an output folder to store the output animation results.

Returns:

a list of image frames in size H*W*3 in [0, 255].

Return type:

img_list (list[numpy.ndarray])

Module contents

class sketchkit.animation.Animator(method: str = 'RIFE', device: str = 'cuda')[source]

Bases: object

A class for sketch animation or inbetweening.

method

The animation method that is used.

Type:

str

device

The device that is used.

Type:

str

_gen_gif(all_files, save_path)[source]

Gennerate .gif for images in a folder.

run(input_0: ndarray, input_1: ndarray, inner_frames: int = 8, output_folder: str = 'animation') list[ndarray][source]

Generate sketch animation or inbetweening.

Parameters:
  • input_0 (numpy.ndarray) – an input raster image (frame 0).

  • input_1 (numpy.ndarray) – an input raster image (frame 1).

  • inner_frames (int) – number of intermediate frames.

  • output_folder (str, optional) – an output folder to store the output animation results.

Returns:

a list of image frames in size H*W*3 in [0, 255].

Return type:

img_list (list[numpy.ndarray])

class sketchkit.animation.RIFE(device: str = 'cuda')[source]

Bases: object

A class for sketch animation using the method of paper “Real-Time Intermediate Flow Estimation for Video Frame Interpolation” in ECCV 2022.

device

The device that is used.

Type:

str

_download_models(cislab_source=False)[source]

Download the pretrained models

run(input_image_list: list[ndarray], inner_frames: int) list[ndarray][source]

Generate sketch animation or inbetweening for a list of keyframes.

Parameters:
  • input_image_list (list[numpy.ndarray]) – a list of keyframes in shape (H, W, 3), with values in [0, 255].

  • inner_frames (int) – number of intermediate frames.

Returns:

a list of image frames in size H*W*3 in [0, 255].

Return type:

frame_list (list[numpy.ndarray])