sketchkit.ordering.LineDrawer.CNNVE package¶
Submodules¶
sketchkit.ordering.LineDrawer.CNNVE.CNNVE module¶
Main animator class for LineDrawer - video-synchronized sketch animation
- class sketchkit.ordering.LineDrawer.CNNVE.CNNVE.CNNVE(device: str = 'cpu')[source]¶
Bases:
objectLineDrawer animation generator that synchronizes strokes with video frames. Renamed to CNNVE to match vectorization structure.
- indir¶
Input directory containing .graph_merge files and videos
- Type:
str
- _create_linear_curve(p_start, p_end)[source]¶
Create a linear Curve between two endpoints.
- Parameters:
p_start – Starting endpoint.
p_end – Ending endpoint.
- Returns:
Linear curve with control points at 1/3 and 2/3 of the distance.
- Return type:
- _generate_ordered_sketch(msort, point_list_map, height, width)[source]¶
Generate a single Sketch object with paths ordered by frame appearance.
- Parameters:
msort – Dictionary mapping frame indices to stroke IDs.
point_list_map – Dictionary mapping stroke IDs to point lists.
height – Height of the sketch.
width – Width of the sketch.
- Returns:
Sketch object with paths ordered by their appearance in the video frames.
- Return type:
- _points_to_path(points)[source]¶
Convert list of [y, x] points to a Path.
- Parameters:
points – List of [y, x] coordinate points.
- Returns:
Path object if there are at least 2 points, None otherwise.
- Return type:
Path or None
- _to_point(p)[source]¶
Convert [y, x] point to Point(x, y).
- Parameters:
p – List or tuple of [y, x] coordinates.
- Returns:
Point object with x and y coordinates swapped.
- Return type:
- _vis_merge_result_paints_undo(im_ori_c1, merge_dic, video_path)[source]¶
Visualize stroke merging with video synchronization.
- Parameters:
im_ori_c1 – Original image
merge_dic – Merge dictionary with stroke data
video_path – Path to video file
- Returns:
Generated Sketch object
- Return type:
- run(img: ndarray, video_path: str) Sketch[source]¶
Generate a single Sketch with ordered paths from image and video.
- Parameters:
img (np.ndarray) – Input image as a 2D numpy array (grayscale).
video_path (str) – Path to video file for frame synchronization.
- Returns:
Generated Sketch object with paths ordered by drawing sequence.
- Return type:
sketchkit.ordering.LineDrawer.CNNVE.color_generator module¶
Color generation utilities for creating visually distinct stroke colors.
- class sketchkit.ordering.LineDrawer.CNNVE.color_generator.ColorGenerator(use_hsluv=True)[source]¶
Bases:
objectGenerate perceptually distinct colors for stroke visualization.
- _color_gene_hsluv()[source]¶
Generate colors using HSLuv color space for better perceptual uniformity.
- Returns:
List of RGB color arrays
- Return type:
list
sketchkit.ordering.LineDrawer.CNNVE.frame_matcher module¶
Frame matching utilities for synchronizing strokes with video frames.
- class sketchkit.ordering.LineDrawer.CNNVE.frame_matcher.FrameMatcher[source]¶
Bases:
objectMatch extracted strokes to video frames based on overlap.
- match_strokes_to_frames(m_list, ref_frames, size)[source]¶
Match each stroke to the video frame where it first appears.
- Parameters:
m_list – Dictionary of stroke masks
ref_frames – List of reference video frames
size – Image size tuple (h, w)
- Returns:
Dictionary mapping frame indices to lists of strokes
- Return type:
dict
sketchkit.ordering.LineDrawer.CNNVE.video_processor module¶
Video processing utilities for extracting and filtering frames from MP4 files.
- class sketchkit.ordering.LineDrawer.CNNVE.video_processor.VideoProcessor[source]¶
Bases:
objectProcess video files to extract and filter frames.
- sketchkit.ordering.LineDrawer.CNNVE.video_processor.add_pil_border(original_image, border_width=3, border_color=(255, 0, 0))[source]¶
Adds a colored border to a PIL Image.
- Parameters:
original_image – PIL Image
border_width – Border width in pixels
border_color – RGB color tuple
- Returns:
PIL Image with border
Module contents¶
- class sketchkit.ordering.LineDrawer.CNNVE.CNNVE(device: str = 'cpu')[source]¶
Bases:
objectLineDrawer animation generator that synchronizes strokes with video frames. Renamed to CNNVE to match vectorization structure.
- indir¶
Input directory containing .graph_merge files and videos
- Type:
str
- _create_linear_curve(p_start, p_end)[source]¶
Create a linear Curve between two endpoints.
- Parameters:
p_start – Starting endpoint.
p_end – Ending endpoint.
- Returns:
Linear curve with control points at 1/3 and 2/3 of the distance.
- Return type:
- _generate_ordered_sketch(msort, point_list_map, height, width)[source]¶
Generate a single Sketch object with paths ordered by frame appearance.
- Parameters:
msort – Dictionary mapping frame indices to stroke IDs.
point_list_map – Dictionary mapping stroke IDs to point lists.
height – Height of the sketch.
width – Width of the sketch.
- Returns:
Sketch object with paths ordered by their appearance in the video frames.
- Return type:
- _points_to_path(points)[source]¶
Convert list of [y, x] points to a Path.
- Parameters:
points – List of [y, x] coordinate points.
- Returns:
Path object if there are at least 2 points, None otherwise.
- Return type:
Path or None
- _to_point(p)[source]¶
Convert [y, x] point to Point(x, y).
- Parameters:
p – List or tuple of [y, x] coordinates.
- Returns:
Point object with x and y coordinates swapped.
- Return type:
- _vis_merge_result_paints_undo(im_ori_c1, merge_dic, video_path)[source]¶
Visualize stroke merging with video synchronization.
- Parameters:
im_ori_c1 – Original image
merge_dic – Merge dictionary with stroke data
video_path – Path to video file
- Returns:
Generated Sketch object
- Return type:
- run(img: ndarray, video_path: str) Sketch[source]¶
Generate a single Sketch with ordered paths from image and video.
- Parameters:
img (np.ndarray) – Input image as a 2D numpy array (grayscale).
video_path (str) – Path to video file for frame synchronization.
- Returns:
Generated Sketch object with paths ordered by drawing sequence.
- Return type: