Borrar filtros
Borrar filtros

Color wave length and hue

18 visualizaciones (últimos 30 días)
Prashant Somani
Prashant Somani el 29 de Sept. de 2011
Editada: Nikhil R. el 5 de Dic. de 2020
Is there any method to get color hue from its wave length?

Respuesta aceptada

Walter Roberson
Walter Roberson el 29 de Sept. de 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 comentarios
Walter Roberson
Walter Roberson el 4 de Sept. de 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. el 5 de Dic. de 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.

Iniciar sesión para comentar.

Más respuestas (1)

Nikhil R.
Nikhil R. el 5 de Dic. de 2020
Editada: Nikhil R. el 5 de Dic. de 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

Categorías

Más información sobre Convert Image Type en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by