Filter löschen
Filter löschen

Color wave length and hue

18 Ansichten (letzte 30 Tage)
Prashant Somani
Prashant Somani am 29 Sep. 2011
Bearbeitet: Nikhil R. am 5 Dez. 2020
Is there any method to get color hue from its wave length?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 29 Sep. 2011
Hue = (650 - wavelength)*240/(650-475);
Note: the denominator consists of two seemingly arbitrary limits in the code. The 240 refers to the maximum hue value of 240 that is used in standard 8 bit Hue representation.
Visible light is about 400 to 700 nm, with 650 nm being the frequency of red. 475 is blue. Both indigo and violet fall below this limit, but the CIE model that defines the theoretical map of wavelength to hue has to treat colors in that range separately, and it could be that 475 nm is the effective limit for standard Hue calculation, perhaps requiring negative Hue (yes, that is possible in color theory, but not in standard 8 bit Hue representation.)
  3 Kommentare
Walter Roberson
Walter Roberson am 4 Sep. 2018
Sorry, I do not know, I did not write the code I linked to. I suspect the hue calculation given in that code might only be valid for colors in the range of red to blue, and that beyond that might start needing a different formula. The HSV and L*a*b* calculations are conditional based upon which component is strongest, and so calculating hue might get a bit complicated outside the noted range.
Nikhil R.
Nikhil R. am 5 Dez. 2020
Just a disclamer: I tried 400º wavelength, but got 342º hue, when I was expecting ~280º. I think something is wrong with the formula.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Nikhil R.
Nikhil R. am 5 Dez. 2020
Bearbeitet: Nikhil R. am 5 Dez. 2020
Hi! So, I have a formula from stackoverflow.com; if h = hueº, and w = wavelength nm.
w = (400 / 270)h. You use this as a graph:
Edit: Note: This formula tries to get the closest possible to the same. Hue tends to be brighter as for example:
400nm/~270º
~265nm/~180º
~575nm/~390º
...
Table of official hues to wavelengths (Approximently):
Name Hue Wavelength
Red 0/360 650
Orange 45 600
Yellow 60 420
Lime 100 575
Cyan 180 475
Purple 270 400

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by