palette_quantize — GFX2D post op

Datenarten: rgbrgb

Aufruf: import gfx2d; gfx2d.palette_quantize(rgb, colors=None, scheme='okabe_ito') (oder opsgfx2d.get("palette_quantize"))

Verwendung

Bildet jedes Pixel auf die im euklidischen RGB nächstgelegene Palettenfarbe ab.

> Die ausführliche Beschreibung unten ist der Originaltext — Zusammenfassung und Überschriften sind übersetzt.

`colors is an (K, 3) array or a list of :mod:palette` role names;

the default is the whole Okabe–Ito set plus black and white, so the result

stays legible under a colour vision deficiency.

The search is exhaustive, so the assignment is optimal for this metric

and each pixel's error equals its distance to the nearest palette entry —

there is no approximation to bound. The suite checks optimality by brute

force and checks that an image whose colours already lie in the palette

comes back unchanged, bit for bit.

Euclidean distance in (possibly sRGB-encoded) RGB is not perceptual

distance. That is a documented choice, not an oversight: a perceptual metric

needs a colour-appearance model this module does not own, and quantising in

an unstated space would be worse than quantising in a stated one.

Referenzen (Beispieldaten, Literatur)

• Katalog der Beispieldaten (Download-URLs / Lizenzen) — 2-D nutzt skimage.data (BSD/Public Domain) plus synthetische Bilder, 3-D nennt Download-URLs echter Datenquellen (Stanford, PDS, …).

• Herkunft und Literatur der Operatoren — die Quellen der Forschung/Verfahren, auf denen diese Operatorfamilie beruht.

• Der kanonische Algorithmus (Autor, Jahr) und seine Anwendungen stehen im Familienleitfaden oben.

Ausführbare Beispiele (verifizierte Samples, die diesen Operator wirklich aufrufen)

gfx2d_scenepy -3.11 examples/gfx2d_scene.py

Typkompatible Folge-Operatoren (nehmen rgb als Eingabe)

srgb_to_linear · linear_to_srgb · blend_mode · light_mask · normal_map_decode · bloom · vignette · chromatic_aberration

Gleiche Kategorie (post)

bloom · vignette · chromatic_aberration · film_grain · color_lut · color_grade · dither


*Provenance: gfx2d.py — GFX2D Operator-Registry. Diese Notiz wird von tools/opdocs.py md erzeugt (nicht von Hand bearbeiten).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.