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
- _generate_ordered_sketch(msort, point_list_map, height, width)[source]¶
Generate a single Sketch object with paths ordered by frame appearance.
- _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
- _generate_ordered_sketch(msort, point_list_map, height, width)[source]¶
Generate a single Sketch object with paths ordered by frame appearance.
- _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: