sketchkit.ordering package¶
Subpackages¶
Submodules¶
sketchkit.ordering.orderer module¶
- class sketchkit.ordering.orderer.Orderer(method: str = 'LineDrawer', device: str = 'cuda')[source]¶
Bases:
objectMain interface for sketch ordering. Determines the stroke drawing sequence for a static sketch.
- method¶
The ordering method instance (e.g., LineDrawer or Fu).
- static create(method: Literal['LineDrawer'], device: str = 'cuda') LineDrawer[source]¶
- static create(method: Literal['Fu'], device: str = 'cpu') Orderer
Create an instance of the specified ordering method.
- Parameters:
method – Backend name. Supported values are “Fu”, “LineDrawer” (case-sensitive).
device – Device to use for computation. For Fu, “cpu” is sufficient. For LineDrawer, “cuda” is recommended.
- Returns:
An instance of the selected ordering method.
- Raises:
ValueError – If an unknown method is specified.
- run(*args, **kwargs) Sketch[source]¶
Run the ordering process using the selected method.
- Parameters:
*args – Arguments passed to the selected method’s run method.
**kwargs – Keyword arguments passed to the selected method’s run method.
method (For LineDrawer) – sketch: Sketch object containing the static sketch to animate.
method – img: numpy array of the sketch image (grayscale). ref_video_path: path to the reference video file.
- Returns:
A Sketch object with ordered paths, where the order of paths corresponds to the drawing sequence.
- Return type:
Module contents¶
- sketchkit.ordering.Fu¶
alias of
AnimatedDrawer
- class sketchkit.ordering.LineDrawer(method='CNNVE', device='cpu')[source]¶
Bases:
OrdererImplementation of LineDrawer: Stroke-Level Process Reconstruction of Complex Line Art Based on Human Perception.
This method uses a reference video to recover the drawing order of a vector sketch by matching static vector strokes to the video frames where they first appear.
- run(img: ndarray, ref_video_path: str) Sketch[source]¶
Run LineDrawer to determine the drawing order using the reference video.
- Parameters:
img – numpy array of the sketch image (grayscale).
ref_video_path – Path to the reference video file.
- Returns:
A Sketch object with ordered paths, where the order of paths corresponds to the drawing sequence.
- Return type:
- class sketchkit.ordering.Orderer(method: str = 'LineDrawer', device: str = 'cuda')[source]¶
Bases:
objectMain interface for sketch ordering. Determines the stroke drawing sequence for a static sketch.
- method¶
The ordering method instance (e.g., LineDrawer or Fu).
- static create(method: str = 'LineDrawer', device: str = 'cuda') Orderer[source]¶
Create an instance of the specified ordering method.
- Parameters:
method – Backend name. Supported values are “Fu”, “LineDrawer” (case-sensitive).
device – Device to use for computation. For Fu, “cpu” is sufficient. For LineDrawer, “cuda” is recommended.
- Returns:
An instance of the selected ordering method.
- Raises:
ValueError – If an unknown method is specified.
- run(*args, **kwargs) Sketch[source]¶
Run the ordering process using the selected method.
- Parameters:
*args – Arguments passed to the selected method’s run method.
**kwargs – Keyword arguments passed to the selected method’s run method.
method (For LineDrawer) – sketch: Sketch object containing the static sketch to animate.
method – img: numpy array of the sketch image (grayscale). ref_video_path: path to the reference video file.
- Returns:
A Sketch object with ordered paths, where the order of paths corresponds to the drawing sequence.
- Return type: