sketchkit.cleanup package

Subpackages

Submodules

sketchkit.cleanup.cleaner module

class sketchkit.cleanup.cleaner.Cleaner(method: str = 'MasterSketch', device: str = 'cuda')[source]

Bases: object

A class for rough sketch cleanup.

This class provides functionality to convert a raster rough sketch to a clean sketch.

method

The vectorization method that is used.

Type:

str

device

The device that is used.

Type:

str

run(input: ndarray, output_folder: str = 'cleanup') ndarray[source]

Simplify the input raster image.

Parameters:

input (numpy.ndarray) – input raster image in shape (H, W), with values in [0, 255].

Returns:

an image in H*W in [0, 255].

Return type:

sketch (numpy.ndarray)

Module contents

class sketchkit.cleanup.Cleaner(method: str = 'MasterSketch', device: str = 'cuda')[source]

Bases: object

A class for rough sketch cleanup.

This class provides functionality to convert a raster rough sketch to a clean sketch.

method

The vectorization method that is used.

Type:

str

device

The device that is used.

Type:

str

run(input: ndarray, output_folder: str = 'cleanup') ndarray[source]

Simplify the input raster image.

Parameters:

input (numpy.ndarray) – input raster image in shape (H, W), with values in [0, 255].

Returns:

an image in H*W in [0, 255].

Return type:

sketch (numpy.ndarray)

class sketchkit.cleanup.MasterSketch(device: str = 'cuda')[source]

Bases: object

A class for rough sketch cleanup using the method of paper “Mastering Sketching: Adversarial Augmentation for Structured Prediction” in SIGGRAPH 2018.

device

The device that is used.

Type:

str

_download_models()[source]

Download the pretrained models

run(image_array: ndarray, image_folder: str = './', out_folder: str = 'cleanup') ndarray[source]

Sketch simplification for the input raster image.

Parameters:
  • image_array (numpy.ndarray) – input raster image in shape (H, W), with values in [0, 255].

  • image_folder (str, optional) – the folder of the input raster image.

  • out_folder (str, optional) – an output folder to store the output file.

Returns:

a sketch image in H*W in [0, 255].

Return type:

pred_out (numpy.ndimage)