sketchkit.vectorization.LineDrawer.CNNVE package

Subpackages

Submodules

sketchkit.vectorization.LineDrawer.CNNVE.CNNVE module

class sketchkit.vectorization.LineDrawer.CNNVE.CNNVE.CNNVE(device='cuda')[source]

Bases: object

A class for image vectorization using the CNNVE method.

model

The loaded line extraction model.

bat_process(indir)[source]

Batch processes all PNG files in a directory.

For each file *.png in indir, it creates an output directory indir/output/… and calls process_single_image.

Parameters:

indir (str) – The directory containing PNG files to process.

process_single_image(fname, outdir, iter_id=0, merge_or_onepath={})[source]

Main processing pipeline to build a graph, segment strokes, and merge them.

Parameters:
  • fname (str) – The file path of the input PNG image.

  • outdir (str) – The directory to save output and intermediate files.

  • iter_id (int, optional) – Iteration ID. Defaults to 0.

  • merge_or_onepath (dict, optional) – Dictionary to pass merge/path info.

run(input_path: str)[source]

Vectorize the input raster image or images in a folder.

Parameters:

input_path (str) – a path to an input raster image or a folder with multiple images.

Module contents

class sketchkit.vectorization.LineDrawer.CNNVE.CNNVE(device='cuda')[source]

Bases: object

A class for image vectorization using the CNNVE method.

model

The loaded line extraction model.

bat_process(indir)[source]

Batch processes all PNG files in a directory.

For each file *.png in indir, it creates an output directory indir/output/… and calls process_single_image.

Parameters:

indir (str) – The directory containing PNG files to process.

process_single_image(fname, outdir, iter_id=0, merge_or_onepath={})[source]

Main processing pipeline to build a graph, segment strokes, and merge them.

Parameters:
  • fname (str) – The file path of the input PNG image.

  • outdir (str) – The directory to save output and intermediate files.

  • iter_id (int, optional) – Iteration ID. Defaults to 0.

  • merge_or_onepath (dict, optional) – Dictionary to pass merge/path info.

run(input_path: str)[source]

Vectorize the input raster image or images in a folder.

Parameters:

input_path (str) – a path to an input raster image or a folder with multiple images.