sketchkit.vectorization package¶
Subpackages¶
- sketchkit.vectorization.DeepVecSIG24 package
- Submodules
- sketchkit.vectorization.DeepVecSIG24.DeepVecSIG24 module
DeepVecSIG24DeepVecSIG24.deviceDeepVecSIG24._D()DeepVecSIG24._download_models()DeepVecSIG24._load_checkpoint_ndc()DeepVecSIG24._load_checkpoint_udf()DeepVecSIG24._load_img()DeepVecSIG24._load_model()DeepVecSIG24._paths_to_Sketch()DeepVecSIG24._pre_svg()DeepVecSIG24._pre_udf()DeepVecSIG24._predict_SVG()DeepVecSIG24._predict_UDF()DeepVecSIG24._simplify_SVG()DeepVecSIG24._vis_stroke()DeepVecSIG24.run()
safe_torch_load()
- Module contents
DeepVecSIG24DeepVecSIG24.deviceDeepVecSIG24._D()DeepVecSIG24._download_models()DeepVecSIG24._load_checkpoint_ndc()DeepVecSIG24._load_checkpoint_udf()DeepVecSIG24._load_img()DeepVecSIG24._load_model()DeepVecSIG24._paths_to_Sketch()DeepVecSIG24._pre_svg()DeepVecSIG24._pre_udf()DeepVecSIG24._predict_SVG()DeepVecSIG24._predict_UDF()DeepVecSIG24._simplify_SVG()DeepVecSIG24._vis_stroke()DeepVecSIG24.run()
- sketchkit.vectorization.LineDrawer package
Submodules¶
sketchkit.vectorization.vectorizer module¶
- class sketchkit.vectorization.vectorizer.Vectorizer(method: str = 'DeepVecSIG24', device: str = 'cuda')[source]¶
Bases:
objectA class for image vectorization.
This class provides functionality to convert a raster image to a vector image.
- method¶
The vectorization method that is used.
- Type:
str
- device¶
The device that is used.
- Type:
str
Module contents¶
- class sketchkit.vectorization.DeepVecSIG24(device: str = 'cuda')[source]¶
Bases:
objectA class for image vectorization using the method of paper “Deep Sketch Vectorization via Implicit Surface Extraction” in SIGGRAPH 2024.
- device¶
The device that is used.
- Type:
str
- _load_checkpoint_ndc(filepath)[source]¶
Loads model from a checkpoint we will need the distance threshold to accruately recover the UDF for the next NDC model
- _load_checkpoint_udf(filepath)[source]¶
Loads model from a checkpoint we will need the distance threshold to accruately recover the UDF for the next NDC model
- run(image_array: ndarray, image_folder: str = './', out_folder: str = 'svg') Sketch[source]¶
Vectorize 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 svg file.
- Returns:
a Sketch instance.
- Return type:
sketch (Sketch)
- class sketchkit.vectorization.LineDrawer(method: str = 'CNNVE', device: str = 'cuda')[source]¶
Bases:
objectNative LineDrawer integration that mirrors the structure of other vectorizers.
- class sketchkit.vectorization.Vectorizer(method: str = 'DeepVecSIG24', device: str = 'cuda')[source]¶
Bases:
objectA class for image vectorization.
This class provides functionality to convert a raster image to a vector image.
- method¶
The vectorization method that is used.
- Type:
str
- device¶
The device that is used.
- Type:
str