The color of a growlight in RGB

Discussion in 'Science and Nature' started by Prankster, Dec 11, 2021.

  1. #1 Prankster, Dec 11, 2021
    Last edited: Dec 11, 2021
    So this is just out of curiosity that im trying to do this but im trying the figure out the color of a growlight from the spectrum of its light. I have no experience in such calculations so I hope that somebody that is familiar with CIE colorspaces and chromaticities and stuff can help me figure some stuff out that are unclear to me.
    But yeah. First we need a spectrum.

    I took the spectrum of a viparspectra pro series growlight as practice. There was only the spectra and no tabulated data so I recreated that spectra with excel by counting pixels.

    spectra1.png

    So you three types of cells (L, M and S) in your eyes that are sensitive to light. They are different in there sensitivity to different colors. These cone fundamentals can be approximated by the following equations:

    conefund.png
    But because of colour mixing your eyes response to different colors (wavelengthts) is calculated with the following equations by using the y's of the previous equations.

    colormatch.png


    So how do I see the spectrum of the vipraspectra light? I have to calculate the response of my eyes to the spectrum of the vipraspectra light to get the socalled XYZ tristimulus values.

    So i have to calculate the product of the previous calculated x, y and z at a certain wavelength times the y of the spectrum of the growlight at that wavelength. Fot every wavelength (I took steps of 10 nanometers).

    This results in the response of the eyes to every wavelength in the spectrum of the grow light.

    what you see.png

    Spectrum is black and the colored lines is what your eyes see.

    *Note. I might be completely wrong about all of this :)

    So now I have to translate this to RGB.

    So XYZ tristimulus values are supposedly calculated by taking the integral of the line of what you see for each of the three the receptors (x = red line, y = green/yellow line, z = blue line).

    So by using simpson's rules I came up with the following numbers;

    X=66.66 (area under the curve for the red line)
    Y=63.04 (area under the curve for the yellow/green line)
    Z=50.24 (area under the curve for the blue line)

    So now the confusion starts. So to calculate chromaticities (coordinates in colorspace) the following calculations were done.

    chromaticities.png

    This results in:

    x=0,37
    y=0,35
    z=0,28

    So we need transformation matrix

    XYZ to RGB.png

    And gamma corrected (Since its a PAL colorspace) for R(lin), G(lin) and B(lin).

    gamma correction.png

    So I calculated the XYZ tristimulus values before and they were

    X = 66.66
    Y = 63.04
    Z = 50.24

    So how do I use these values? If I put these values through the matrix I get

    R=2012
    G=1586
    B=1424

    Which is impossible since it should be numbers between 0 and 255

    If I plug in

    X=0,37
    Y=0,35
    Z=0,28

    I get

    R=190
    G=150
    B=134

    color1.png

    I dont know. I am expecting a more white color. Its a broad spectrum growlight. The chromaticity coordinates also come close to the coordinates of the whitepoint (D65).

    So I divide the X, Y and Z values through Y. Since Y is suppose the be the lightness of the color. This results in

    X=1,0574
    Y=1
    Z=0,7970

    This results in

    R=306=255
    G=241
    B=216

    color2.png

    More what I was expecting but all of this is just a maybe maybe. I dont know what to do with my X, Y, Z values which resulted from the integration. Im stuck so I was hoping that somebody who is a bit more knowlegdeable than me on the subject, could help me figure out the color of this growlight.

    Just for fun.
     
    • Like Like x 1
    • Funny Funny x 1
  2. #2 Prankster, Dec 12, 2021
    Last edited: Dec 13, 2021
    This is how I got that transformation matrix

    The coordinates (chromaticities) of the PAL primary colors are the following:

    PAL primaries.png
    So we have the whitepoint D65 (natural daylight white at 6500 K). It chromaticity coordinates are the following. Y has to be 1 since this is unit luminance.

    whitepoint D65.png

    Combining the primaries with the white point
    calc1.png

    The inverse of the transformation matrix is calculated as follows

    calc2.png

    By taking the inverse you get the transformation matrix

    calc3.png

    So this is a different matrix than in my previous post. I dont know why. Maybe i used different color primaries than the ones for PAL.

    edit: I used the ITU-R BT-709 color primaries previous instead of PAL primaries)

    I dont know. Im confused now.

    But I get this color with this new matrix and by dividing the spectrum chromaticities (x=0.37, y=0.35, z=0.28) by 0.329. The y of the whitepoint.

    new color.png

    Which seems to be more what i am expecting.
    R= 255
    G=255
    B=214

    This is the color when i divide the chtomaticities by 0.35.

    R=255
    G=253
    B=208

    rgb3small.png
     
    • Like Like x 1
  3.  
    • Funny Funny x 2
    • Like Like x 1
  4. You got the same color as the color they show the light to be in the ads.
     
    • Winner Winner x 1
  5. Yeah. we aregetting close but im not really sure about the final steps. I will figure it out at a certain point. Iwill let you people know when i have figured it out.

    LED-Grow-Light-Pro-Series_8.jpg
     
  6. I prefer their new ones. They only cost like 10$ more than the old ones.

    Viparspectra 1000.JPG
     
  7. Previously I just assumed that when a number goes above 255 the number I just made it 255. Now I have scaled the XYZ values so that the max number is 1. This results in the following color.

    R=255
    G=231
    B=190

    small.png
     
    • Like Like x 1
  8. Why are we figuring this out?
     
  9. No reason. Just to see if you can figuren out the color from a spectrum
     
  10. But i already discovered some mistakes again.

    I stop now with this thread. Gonna have to do some reading first
     
  11. I could be wrong but I think all you have to do is multiply your SPD function by the RGB color matching functions to arrive at your RGB proportionality, and then I'd assume you'd multiply each term by 255 to convert into 8bit RGB.
    CIE-1931-2-color-matching-functions-converted-to-RGB-weighting-functions-with-a-D65.png

    If all areas under the color matching functions are equal to each other (which looks like might be the case) and if we set to 1, then when using a perfectly white light as a test (every nm has a 1.0 relative intensity), each resultant RGB term we get from multiplying the white SPD function by the color matching functions, should equal 1. This is why I'd suggest multiplying each term by a factor of 255 (8bit RGB: White = 255, 255, 255; Black = 0,0,0) but only if it turns out the area under the color matching functions are equal. If the areas arent all normalized to 1, then you'd have to derive the coefficients yourself by setting each RGB term to 255 and then solving for the missing coefficients.

    I might be wrong too, this link talks about an R:G:B ratio of 72.1:1.38:1 needing to be possibly applied to the RGB resultants??
    https://en.m.wikipedia.org/wiki/CIE_1931_color_space
     
  12. Yes.

    Thanks for your reply. Yeah. Its a bit more complicated. D65 white is not pure white. I also believe that im working in Tristumulus space to avoid any negative numbers numbers in red. Since XYZ covers the entire colorspace instead of only the gamut in the colorspace.

    But I can be wrong to. I

    The spectrum is multiplied by the colorsfunction at that wavelength. The resulting numbers are summed or in my case were integrated. This way I can see what contribution the red, green and blue cones give to be mixed too a certain color.

    But yeah. Its in XYZ space. Not chromaticities (xyz)

    In my last color I just scaled the numbers so that its max 255, after transformation with a matrix to linear RGB and than gamma corrected to RGB.

    That color looks quite reasonable.

    But yeah. I still got a lot of reading to do. Dont wanna share to much nonsense. Somebody might think that i know what im talking about :p
     
    • Like Like x 1
  13. Haha hopefully me too and you had me curious. It seemed the primaries used to derive the 1931 CIE RGB color match functions were similar to the wavelengths of the primaries used in present day tri-color monitors or TV's (436nm, 546nm, 700nm; they say eye is shit at telling color difference near 700nm so if the new monitors used a lower wavelength red primary, I was figuring it might not be too noticeable).

    Definitely seems like you're on the right track (if not correct), seems like your estimations are getting closer. Idk if 8bit RGB values are energy vectors or luminance vectors. You've got me very curious.

    This your method?
    1. Calculate XYZ tristimulus values
    2. Use XYZ to calculate xyz
    3. Scale max xyz term to = 1
    4. Apply the correct transform which corelates to the gamut of the device attempting to duplicate the color.
     
  14. Almost

    3. scale by dividing xyz through 0.329. The y of the D65 white point.
    4. transform to linear RGB and gamma correct.
    5. If a number comes out higher the 255 then rescale the numbers so 255 is the highest number.

    For example:

    R=287
    G=260
    B=214

    becomes

    R=255
    G=231
    B=190

    Yeah. Its just guessing basicly. The problem is the lack of a clear example on the internet. Its all scripts and programming stuff you'll find. Or abstract explanations without an example.
     

Share This Page