How to get the wavelength of a pixel using RGB?

前端 未结 4 1975
深忆病人
深忆病人 2020-12-06 01:06

I have a project that would classify the color of a pixel. Whether it is red,violet, orange or simply any color in the color wheel. I know that there are over 16 million col

4条回答
  •  误落风尘
    2020-12-06 01:20

    Well RGB for a monitor maps to 3 independant levels of Red Green and Blue light, so there are (mostly) 3 distinct wavelengths present of any one percieved colour.

    BUT If you can convert your RGB colour value to its equivilent HSL, the H part (Hue) is the dominant colour in so far as wavelength goes if you are prepared to ignore the saturation (think of it as whiteness).

    Based on that you could approximate the dominante wavelength of a colour based on its H value.

    Red light is roughly 630–740nm wavelength, Violet is roughly 380–450nm.

提交回复
热议问题