Hasty Briefsbeta

Bilingual

Creating a Color Palette from an Image

2 days ago
  • #image-processing
  • #color-palette
  • #algorithm-design
  • First iteration used median-cut quantization in RGB with fixed ROYGBIV regions, but it became complex and was replaced by OKLCH and K-means for better color perception.
  • Second iteration clusters pixels in OKLCH using K-means++ (K=10 overshoot), merges similar colors, and picks highest-chroma pixels as swatches, aiming for five-color palettes.
  • Third iteration adjusts K to 14 for better accent detection and weights hue/chroma twice as much as lightness during merges to prioritize human color perception.
  • Fourth iteration introduces structural changes: dropping low-weight/low-chroma clusters, allocating slots by achromatic/chromatic mass, and refining swatch selection based on centroid chroma.
  • Final algorithm includes phantom guard, slot allocation by mass, and representative pixel selection to produce more human-like palettes without hard-coding edge cases.