Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:AI Builder Club Skills Caption Style Matching

From Leeroopedia
Knowledge Sources
Domains Image_Analysis, Video_Processing
Last Updated 2026-10-24 00:00 GMT

Overview

A computer vision technique that analyzes a reference caption screenshot to extract visual style parameters (highlight color, primary color, outline, shadow, font) and generates a matching ASS subtitle style configuration.

Description

Caption style matching automates the tedious process of hand-tuning ASS subtitle parameters to match an existing visual aesthetic. The technique loads a reference screenshot (e.g. a TikTok or YouTube caption frame) and performs pixel-level analysis: highlight color detection via saturation/brightness masks (saturation > 0.6, brightness > 120), quantizing common viral colors (neon green, yellow, cyan) or falling back to custom RGB; primary color detection via white pixel masking; and resolution calibration via ffprobe against a target video. The output is a complete style.json with 18 parameters that feeds directly into ASS generation. The key insight: high-engagement caption styles follow recognizable patterns (bold fonts, high-saturation highlights, soft drop shadows) that can be detected and replicated.

Usage

Use this principle when you want to match the visual style of an existing caption screenshot rather than hand-authoring style parameters. Alternatively, use a preset JSON for known styles.

Theoretical Basis

The technique applies HSV-based color segmentation to identify the dominant high-saturation color (the highlight) and the dominant bright color (the primary text). The saturation mask filters for pixels where S=(max−min)/max>0.6 and V=max>120, then takes the median RGB of the surviving pixels.

S(r,g,b)=max⁡(r,g,b)−min⁡(r,g,b)max⁡(r,g,b),V=max⁡(r,g,b)

# Abstract model:
def detect_highlight_color(image):
    sat_mask = (saturation(image) > 0.6) & (brightness(image) > 120)
    if count(sat_mask) > 50:
        median_rgb = median(image[sat_mask])
        return quantize(median_rgb)  # neon-green | yellow | cyan | custom
    return default_neon_green

def detect_primary_color(image):
    white_mask = all_channels(image > 220)
    return white if count(white_mask) > 50 else white

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment