Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Oklab color space

From Wikipedia, the free encyclopedia
(Redirected fromOKLab)
Standard color space with color-opponent values
Oklab and Oklch
Irregular perceptual lightness in a gradient generated with constantvalue inHSV space, with light yellows and dark blues, compared to one generated with constant lightness in Oklch.
StatusRecommendation draft
First published23 December 2020 (2020-12-23)[1]
Latest version13 February 2024 (2024-2-13)[2]
Preview version29 February 2024 (2024-2-29)[3]
OrganizationW3C
CommitteeCSS Working Group
SeriesCSS Color
PredecessorCIELAB color space
DomainColor model
LicensePublic domain
Websitewww.w3.org

TheOklab color space is auniform color space fordevice independent color designed to improveperceptual uniformity,hue andlightness prediction,color blending,[a] andusability while ensuringnumerical stability andease of implementation.[1] Introduced by Björn Ottosson in December 2020, Oklab and itscylindrical counterpart,Oklch, have been included in theCSS Color Level 4 and Level 5 drafts for device-independentweb colors since December 2021.[2][3] They are supported by recent versions of majorweb browsers[6] and allow the specification ofwide-gamutP3 colors.[7]

Oklab's model is fitted with improved color appearance data: CAM16 data for lightness and chroma, and IPT data for hue. The new fit addresses issues such as unexpected hue and lightness changes in blue colors present in theCIELAB color space, simplifying the creation ofcolor schemes and smoothercolor gradients.[1][7][4]

As Ottosson explained,[1] he chose the nameOklab because the model does an OK (adequate) job and is based on the three color-space coordinatesL,a, andb.

Coordinates

[edit]
Oklch color wheel

Oklab uses the same spatial structure as CIELAB, representing color using three components:

  • L for perceptual lightness, ranging from 0 (pure black) to 1 (reference white, if achromatic), often denoted as apercentage
  • a andb for opponent channels of the fourunique hues, unbounded but in practice ranging from −0.5 to +0.5;CSS assigns ±100% to ±0.4 for both[2]
    • a for green (negative) to red (positive)
    • b for blue (negative) to yellow (positive)

LikeCIELCh, Oklch represents colors using:

  • L for perceptual lightness
  • C forchroma representing chromatic intensity, with values from 0 (achromatic) with no upper limit, but in practice not exceeding +0.5; CSS treats +0.4 as 100%[2]
  • h for hue angle in acolor wheel, typically denoted indecimal degrees

Achromatic colors

[edit]

Neutralgreys, pure black and the reference white are achromatic, that is,C=0{\displaystyle C=0},a=0{\displaystyle a=0},b=0{\displaystyle b=0}, andh isundefined. Assigning any real value to their hue component has no effect on conversions between color spaces.[2]

Color differences

[edit]

The perceptualcolor difference in Oklab is calculated as theEuclidean distance between the(L,a,b) coordinates.[8][2]

Conversions between color spaces

[edit]

Conversion to and from Oklch

[edit]

Like CIELCh, theCartesian coordinatesa andb are converted to thepolar coordinatesC andh as follows:

C=a2+b2h=atan2(b,a){\displaystyle {\begin{aligned}C&={\sqrt {a^{2}+b^{2}}}\\h&=\operatorname {atan2} (b,a)\end{aligned}}}

And the polar coordinates are converted to the Cartesian coordinates as follows:

a=Ccos(h)b=Csin(h){\displaystyle {\begin{aligned}a&=C\cos(h)\\b&=C\sin(h)\end{aligned}}}

Conversion from CIE XYZ

[edit]

Converting from CIE XYZ with aStandard Illuminant D65 involves:[1]

  1. Applying thelinear map:[b]
    [lms]=M1[XYZ]{\displaystyle {\begin{bmatrix}l\\m\\s\end{bmatrix}}=\mathbf {M} _{1}{\begin{bmatrix}X\\Y\\Z\end{bmatrix}}}
  2. Applying acube rootnon-linearity:
    [lms]=[l1/3m1/3s1/3]{\displaystyle {\begin{bmatrix}l'\\m'\\s'\end{bmatrix}}={\begin{bmatrix}l^{1/3}\\m^{1/3}\\s^{1/3}\end{bmatrix}}}
  3. Converting to Oklab with another linear map:
    [Lab]=M2[lms]{\displaystyle {\begin{bmatrix}L\\a\\b\end{bmatrix}}=\mathbf {M} _{2}{\begin{bmatrix}l'\\m'\\s'\end{bmatrix}}}

Given:

M1=[0.81893301010.36186674240.12885971370.03298454360.92931187150.03614563870.04820030180.26436626910.6338517070]M2=[0.21045425530.79361778500.00407204681.97799849512.42859220500.45059370990.02590403710.78277176620.8086757660]{\displaystyle {\begin{aligned}\mathbf {M} _{1}&={\begin{bmatrix}0.8189330101&{\phantom {-}}0.3618667424&-0.1288597137\\0.0329845436&{\phantom {-}}0.9293118715&{\phantom {-}}0.0361456387\\0.0482003018&{\phantom {-}}0.2643662691&{\phantom {-}}0.6338517070\end{bmatrix}}\\\mathbf {M} _{2}&={\begin{bmatrix}0.2104542553&{\phantom {-}}0.7936177850&-0.0040720468\\1.9779984951&-2.4285922050&{\phantom {-}}0.4505937099\\0.0259040371&{\phantom {-}}0.7827717662&-0.8086757660\end{bmatrix}}\end{aligned}}}

Conversion from sRGB

[edit]
See also:SRGB § From sRGB to CIE XYZ

Converting fromsRGB requires first converting from sRGB to CIE XYZ with a Standard Illuminant D65. As the last step of this conversion is a linear map from linear RGB to CIE XYZ, the reference implementation directly employs themultiplied matrix representing thecomposition of the two linear maps:[1]

[lms]=[0.41222147080.53633253630.05144599290.21190349820.68069954510.10739695660.08830246190.28171883760.6299787005][RlinearGlinearBlinear]{\displaystyle {\begin{bmatrix}l\\m\\s\end{bmatrix}}={\begin{bmatrix}0.4122214708&0.5363325363&0.0514459929\\0.2119034982&0.6806995451&0.1073969566\\0.0883024619&0.2817188376&0.6299787005\end{bmatrix}}{\begin{bmatrix}R_{\text{linear}}\\G_{\text{linear}}\\B_{\text{linear}}\end{bmatrix}}}

Conversion to CIE XYZ and sRGB

[edit]

Converting to CIE XYZ and sRGB simply involves applying the respectiveinverse functions in reverse order:[1]

[lms]=M21[Lab][lms]=[(l)3(m)3(s)3][XYZ]=M11[lms]{\displaystyle {\begin{aligned}{\begin{bmatrix}l'\\m'\\s'\end{bmatrix}}&=\mathbf {M} _{2}^{-1}{\begin{bmatrix}L\\a\\b\end{bmatrix}}\\{\begin{bmatrix}l\\m\\s\end{bmatrix}}&={\begin{bmatrix}\left(l'\right)^{3}\\\left(m'\right)^{3}\\\left(s'\right)^{3}\end{bmatrix}}\\{\begin{bmatrix}X\\Y\\Z\end{bmatrix}}&=\mathbf {M} _{1}^{-1}{\begin{bmatrix}l\\m\\s\end{bmatrix}}\end{aligned}}}

Notes

[edit]
  1. ^However, it is not suitable forimage blending orprocessing, for which thegamma-expanded linearRGB color space is more appropriate.[4][5]
  2. ^The (l,m,s) space used here is not the same as theLMS color space, but rather an arbitrary space that was found numerically to best fit the color appearance data.

References

[edit]
  1. ^abcdefgOttosson, Björn (23 Dec 2020)."A perceptual color space for image processing".GitHub Pages. Retrieved24 July 2024.
  2. ^abcdefCSS Color Module Level 4 (Candidate recommendation draft). W3C. Retrieved24 July 2024.
  3. ^abCSS Color Module Level 5 (Working draft). W3C. Retrieved25 July 2024.
  4. ^abLevien, Raph (18 January 2021)."An interactive review of Oklab". GitHub Pages. Retrieved24 July 2024.
  5. ^Novak, John (21 September 2016)."What every coder should know about gamma". Retrieved26 July 2024.
  6. ^"Oklab color model".Can I Use. Retrieved24 July 2024.
  7. ^abSitnik, Andrey; Turner, Travis (25 January 2023)."OKLCH in CSS: why we moved from RGB and HSL".Evil Martians. Retrieved24 July 2024.
  8. ^Lilley, Chris (July 2021)."Better than Lab? Gamut reduction CIE Lab & OKLab". W3C. Retrieved24 July 2024.
CAM
CIE
RGB
Y′UV
Other
Color systems
and standards
For the vision capacities of organisms or machines, see Color vision.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Oklab_color_space&oldid=1278337603"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp