RGB values of visible spectrum

后端 未结 11 1727
难免孤独
难免孤独 2020-11-22 10:37

I need an algorithm or function to map each wavelength of visible range of spectrum to its equivalent RGB values. Is there any structural relation between the RGB System an

11条回答
  •  天涯浪人
    2020-11-22 11:06

    I'm not a programmer. I'm not a physician. I'm just a musician who has two eyes (as any human being has).

    So... I know the electromagnetic waves have a logarythm scale pattern into the Radio and TV range. Why it should be differente in the visible light range?

    Inside the Radio and TV world we use a simple equation: We divide a given range between two frecuencies into a given number of parts according to the ratio between the extreme frecuencies.

    Let's say: If our range starts in 100 MHZ and ends in 200 MHZ, we have a ratio of 2 (200 is equal to 100 multiplied by 2).

    So, if we have to divide that range in 10 equal parts, we have to use this equation:

    The first frecuency (100 MHZ) multiplied by the 10th root of 2.

    That new value multiplied by the 10th root of 2.

    And so and on.

    Why we use the 10th root of 2? Simple: Remember it is not a linear scale, it is a logarythm scale (exactly the same of musical notes).

    So, based in that equation, as we know the visible light spectrum is between 780 and 380 nanometers (aproximately 384.02 THZ and 789.26 THZ; both values very aproximately, because it is a variable value according to the individual optical capability), we just to know the ratio between those frecuencies:

    789.26/384.02=2,055

    Also, we know that the RGB aproximately equivalent to that extreme frecuencies are:

    384.02 THZ = 95,0,0 (hx=5F0000)

    788.92 THZ = 97,0,97 (hx=610061)

    Also, we know all the possible RGB combinations between that points are = 1595

    So, with all those values we have a simple equation:

    RGB = 95, 0, 0 = 384.02 THZ

    RGB = 96, 0, 0 = 384.02 THZ multiplied by (1595th root of 2,055) = 384,19 THZ

    RGB = 97, 0, 0 = 384,19 THZ multiplied by (1595th root of 2,055) = 384.37 THZ

    And so and on

    Simple scale.

    Just my humble opinion.

提交回复
热议问题