In the previous section, we briefly touched upon the RGB colour model. But what we really need to understand is: what is colour?
To answer this fairly abstract question, we need to look to biology and physics. Visible light is a electromagnetic wave between 380 and 800 nm. Human eyes are able to percieve this wave using cells in the retina. There are two types of cells which sit in the retina: rods and cones.
Rods are used mainly in low-light conditions and are sensitive to lower frequency wavelengths. Cones are chiefly responsible for colour vision and are senstive to wavelengths which visible light sit in. There are three types of cones:
These cones tend to be more sensitive to different colours. S-cones are more senstive to lower wavelengths and can perceive blue-green colours. L-cones are more sensitive to higher wavelengths and can perceive gree-red colours. However, they are not distributed over visible light evenly. Both M- and L-cones cover a similar range of colours. It is up to the brain to use the information from the cones to give rise to different perceptions of colour.
In computer vision, we need to represent these wavelengths in a way which can be stored in memory and sent as an electronic signal to a display device. To do this we have a mathematical representation, where a colour can be described through a set of numbers (a turple). We call this mathematical representation a colour model.
There are numerous colour models which exist, each with their own purpose. Over the next few sections we'll discuss some of the more common colour models which are used in computer vision and image processing. Each have their relative merits and tradeoffs.
RGB is one of the most common colour models, because it easily maps to the hardware in screens and it fits with our knowledge of primary colours. Each pixel has a separate value for the amount of red, green and blue at that position. For example a pixel which is pure red with no other colour would have the RGB value of: r=1.0, g=0.0, b=0.0, a colour which is a neutral gray wold have the RGB value of: r=0.5, g=0.5, b=0.5
Visually explained in figure 3, we define an RGB colour space with values of RGB from 0-255. We draw red from 0-255 from top to bottom and green from 0-255 from legt to right. If you click on the figure, we vary blue from 0-255-0 over time.
HSV is much the same as HSL, but the space is defined differently, but we can still alter the hue. Both HSL and HSV use similar concepts, but the alignment of the colour in changed. If thought of as shapes, HSL is a bicone, with points at white and black, where HSV is a cone with the bottom point as black.