Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hue to wavelength mapping

Is there an algorithm to find out the wavelength of the color given the hue value (between 0 degree to 360 degree). Is there any built-in function in MATLABfor the same?

like image 954
SegFault Avatar asked Aug 07 '12 16:08

SegFault


People also ask

What is the relationship between wavelength and hue?

Hue is the wavelength within the visible-light spectrum at which the energy output from a source is greatest. This is shown as the peak of the curves of intensity in Figure 2. In this example, all three colors have the same hue in the yellow-green portion of the spectrum.

What is hue in mapping?

Hue is the perceptual dimension associated with color names. Typically, we use different hues to represent different categories of data. Figure 4.1: An example of eight different hues. Hues are associated with color names such as green, red or blue.

Does wavelength determine hue?

Hue is determined by the dominant wavelength of the visible spectrum. It is the attribute that permits colors to be classified as red, yellow, green, blue, or an intermediate color. Saturation pertains the amount of white light mixed with a hue.

How do you determine wavelength from color?

The wavelength of visible light determines the color that the light appears. Light with the longest wavelength appears red, and light with the shortest wavelength appears violet. In between are the wavelengths of all the other colors of light. A prism separates visible light into its different colors.


4 Answers

While Mark Ransom and Franco Callari are completely right that you cannot recover the spectrum of a perceptual color, nor unambiguously map hue values to wavelengths, you could definitely piece something together if you just want the corresponding monochromatic wavelength.

The part of the hue cycle between 270 and 360 is another problem. There is nothing corresponding to pink or magenta in the light spectrum, so let's assume that we only use hue values between 0 and 270 degrees.

Estimating that the usable part of the visible spectrum is 400-650nm, with wavelength L (in nm) and hue value H (in degrees), you can improvise this:

 L = 650 - 250 / 270 * H

650 is the maximum wavelength, 250 is the wavelength range and 270 is the hue range.

I think this should be in the right direction but there may of course be room for improvement. You might be able to get better results comparing between input hues and corresponding colors on a visible spectrum chart, and then adjusting the values somewhat.

Plot of hue to wavelength function

like image 143
Junuxx Avatar answered Oct 24 '22 02:10

Junuxx


It is possible to find the dominant wavelength of a color/hue. But as said most colors arn’t monochromatic and the same color can be constructed with different “mixes” of wavelengths. I.e. metamerism. Also, for the extra spectral magenta and violet colors only a complementary wavelength can be specified. I.e. the hue/dominant wavelength that additively mixes to white. Also white must be specified, since the is no absolute white due to adaption. Also psychologically our perception of hues doesn’t follow dominant hue lines. Se the Munsell and NCS systems.

Here you can calulate dominant wavelength from RGB values or different CIE systems: http://www.brucelindbloom.com/index.html?Calc.html I don’t have the formula though.

You can then transform RGB to/from HSL and similar. And to/from Munsell or NCS perceptual hues (NCS values are proprietary, so you have to pay and use their software).

like image 39
Håkan Lundberg Avatar answered Oct 24 '22 02:10

Håkan Lundberg


Short answer: NO. A given hue can in general be produced by a triple infinity of wavelengths.

A "physical color" is a combination of pure spectral colors (in the visible range). In principle there exist infinitely many distinct spectral colors, and so the set of all physical colors may be thought of as an infinite-dimensional vector space (a Hilbert space). This space is typically notated Hcolor. More technically, the space of physical colors may be considered to be the topological cone over the simplex whose vertices are the spectral colors, with white at the centroid of the simplex, black at the apex of the cone, and the monochromatic color associated with any given vertex somewhere along the line from that vertex to the apex depending on its brightness.

. . .

This system implies that for any hue or non-spectral color not on the boundary of the chromaticity diagram, there are infinitely many distinct physical spectra that are all perceived as that hue or color. So, in general there is no such thing as the combination of spectral colors that we perceive as (say) a specific version of tan; instead there are infinitely many possibilities that produce that exact color. The boundary colors that are pure spectral colors can be perceived only in response to light that is purely at the associated wavelength, while the boundary colors on the "line of purples" can each only be generated by a specific ratio of the pure violet and the pure red at the ends of the visible spectral colors.

The CIE chromaticity diagram is horseshoe-shaped, with its curved edge corresponding to all spectral colors (the spectral locus), and the remaining straight edge corresponding to the most saturated purples, mixtures of red and violet.

(Source)

like image 37
Francesco Callari Avatar answered Oct 24 '22 02:10

Francesco Callari


I cant provide simple solution, but there is something you need to consider:

  • The visible part of the spektrum is roughly between 380nm (UV-border) and 780nm (IR-border). But what you see (hue) depends on the cone-cells triggered. Above 660nm, the M-cone is not triggered at all, so everything between 660nm and 780nm is hue 0°.
  • at 580nm you have yellow with hue 60°, the purest green is at about 535nm, so that is 120°, and the purest blue (240°) is at about 457nm.
  • if you apply a linear function, yellow should be at 597nm - which it is not, so you'd need a more complex approach.
  • above blue, the red cone still gets triggered until we see violet, but we wont reach red again on higher frequencies, so you cant go above approximately 300°.
  • the hue range between 300° and 360° has no æquivalent in visible spektrum, it can only be simulated by mixing high frequency light (blue or violet) with red light, which results in something between magenta and red on the purple-line.
like image 40
rhavin Avatar answered Oct 24 '22 02:10

rhavin