🎨

Region Labeling for Dithering in LCH Color Space

に公開

Region Labeling for Dithering in LCH Color Space

This article presents a compact summary of a dithering method based on region labeling in the LCH color space.
The technique performs color quantization per region, rather than globally, allowing more perceptual consistency in reduced-color images.


🧠 Concept

Instead of treating the entire image uniformly, this method applies per-region color constraints using clustering in LCH space.

Key assumptions:

  • Regions are defined either manually or algorithmically (e.g., based on image zones or object segmentation).
  • Each region is assigned a limited palette of representative LCH colors.

🛠️ Algorithm Overview

  1. Convert input RGB image to LCH color space
  2. Assign each pixel to a region label (via mask or clustering)
  3. For each pixel:
    • Retrieve its region's palette (e.g., 4–8 LCH colors)
    • Compute distance to palette entries
    • Assign nearest color (optionally with dithering logic)
  4. Convert labeled image back to RGB

Hue differences are handled circularly to prevent wraparound artifacts (e.g., red ↔ purple).


💻 Implementation

A C# implementation is available here:

👉 SimpleLChDistanceReducer2.cs (GitHub)

Highlights:

  • RGB → Lab → LCH color conversion
  • Hue-aware distance computation
  • Region-based quantization with palette size limit per region
  • No semantic labels required

🎨 Why This Matters

Traditional dithering applies globally, often ignoring context.
This method enables local control over color space, improving visual cohesion.

Examples:

  • Sky stays sky-blue without bleeding into other regions
  • Character outlines don’t borrow irrelevant tones

📌 Summary

Cluster first, then reduce.
Enforcing local color constraints leads to better structural preservation under color compression.

This is not a semantic method—no class labels are assumed—just region-bound perceptual control.

Short, but sharp. Especially useful for:

  • Dithering enthusiasts
  • Stylized render engines
  • Retro aesthetics

Discussion