Friday, 31 January 2014

Abstract DIP Model - Part III (Science of colour)

 An abstract model for DIP came across my mind. It contains four sections viz; Acquire, Transfer, Display and Interpret. This post is third part of the series. First and second part discussed Acquire and Transfer blocks. Please refer November 2013 post in my blog for detailed introduction.

A colour picture is mapped into matrix of numbers, compressed and stored as an image file. At the time of display on the computer screen, files are decompressed and numbers are remapped into pixels. In the case of printing, numbers are remapped into dots. Thus display block is connected with remapping of numbers into pixels. To understand the functioning of the block one should know following things; Science of colour, Screen technologies, Printing technologies and Mapping algorithms. In this post only science of colour will be discussed. 

Science of Colour
Light enters into eye via cornea and it is focused by lens and reaches the retina. It lies on the inside of eye wall. It contains two types of photoreceptive cells called cones and rods. Six to seven million cones lie near the central portion of retina called fovea. The maximum absorption occurs at 430, 530 and 560 nm and they can be referred as red, green and blue cones. Approximately 65% of cones are sensitive to red, 33% are sensitive green and remaining 2% is sensitive to blue color. But blue cones are extremely sensitive.  Rods are around 70 million in numbers and they are spread all over retina. The rods are very sensitive to light and low levels of illumination are sufficient to function. Cones require bright light to function. That is why a brightly coloured flower in the daylight appears colourless in the moon light. 

Visible range exists between 400 nm to 700 nm. The entire visible spectrum is divided into 10 nm wide band and represents spectral power. Thus a collection of 31 bands may be used to describe a particular spectral density distribution. Or else simply use red, green and blue primaries to represent a colour. Isaac Newton said, “Indeed rays, properly expressed, are not colored.” In the real world only Spectral Power Distributions (SPDs) exist and colour is perceived by our eyes and brains [1]. In image processing we use simple red, green and blue to describe colour rather than 31 bands SPD.

Any image acquiring device (still or video camera) as well as image display device should have the same spectral response as the human eye. With prevailing technologies, spectral responses of devices can be made as close to human visual system. Radiance means amount of light is emitted from a source. It is objectively measurable quality. Luminance means light intensity perceived by eye. Infra red (IR) radiance can be measured but IR ray luminance will be zero as eyes can’t perceive IR.

CIE MODEL
The science of colorimetry tries to find the relationship between SPD and perceived color. Way back in 1931 International Colour Commission (in French it is Commission Internationale de L’Éclairage   (CIE)) developed a tristimulus model that have X, Y and Z primaries. In this Y corresponds to Luminance of the light. These XYZ tristimulus primaries are developed by colour matching experiment. X, Y and Z form a colour volume. If the luminance component is ignored then it becomes a two-dimensional picture. Representation of colour without the luminance component is created by following way. 

x=X/(X+Y+Z) and y= Y/(X+Y+Z)

A plot between x and y is done and it comes in the shape of shark-fin as in Fig. 1. This is called chromaticity diagram. It is the desired two-dimensional plot without the presence of luminance.

Figure 1. The chromaticity diagram (shark-fin shaped) 
contains colour gamut (triangular shaped) of  a device.
 Camella red is seen in white colour.  Image courtesy: Wikipedia

Gamut:   A triangle inside the chromaticity diagram provides a fair idea about the colour reproduction capability of display or capture device. The gamut is device dependent entity and size varies among devices. Larger gamut is always preferable. At present no device is capable to capture or display all colours shown in chromaticity diagram. For example, Camellia flower shown in Fig. 2, lies outside the gamut of given device [2].  It is shown in the Fig.1 as white spot. As a result, the display device fails to faithfully reproduce the original colour of camellia flower. It will use nearest equivalent colour to represent the flower.

Figure 2. The Camella flower
 Image courtesy: www.techmind.org
RGB MODEL
Later Red, Green and Blue colours are used as primaries and it is called RGB model. This colour space is used for display devices. Any colour can be created in display devices by adding red, green and blue colour in a proportion. This is called Additive Mixing. The normalized values of primaries range from 0 to 1. Thus it forms a perfect colour cube. This colour model is device dependent. It implies a when a RGB value is passed to display devices they need not give guarantee to produce the same colour. Slight variation in colour is expected. Using RGB colour space it is not possible to create all colours. But the colours produced by RGB model are sufficient for practical purposes.

  A variety of devices that is used to capture image and display follow power law equation i.e light intensity is proportional to some power of signal amplitude or pixel value. The exponent component value varies from 1.8 to 2.5.  Pre-multiplying by inverse of exponent is called gamma correction. Appearance of image in a Cathode Ray Tube (CRT) screen will be darker than the original image without the involvement of gamma correction. Introduction of gamma makes RGB colour space as non-linear.  To differentiate linear and non-linear RGB a suffix apostrophe is added with each colour component. Thus R' represents gamma corrected red colour. Many books fails to understand the important difference and use R and R' interchangeably. 

Hewlett-Packard (HP) and Microsoft developed a new colour space, sRGB, which is specifically suited for operating systems and Internet. In sRGB the gamma value is 2.2. It is not a perfect colour space as CIE's XYZ. But it is representative of the majority of the devices on which colour is viewed by average computer user. The new colour system helps to create substantial degree of consistency among the various devices [3].

Figure 3.  (a) Additive colours (Light) (b) Subtractive colours (Pigments)
CMYK MODEL
The RGB colour model that is based on additive mixing of colours is suited for printing purposes. Printing press produces an image by reflective light. This falls into category of colour generation by subtractive process. Refer Fig. 3 for further understanding. The secondary colours that are used in printing are Cyan, Magenta and Yellow. Cyan pigment will absorb red light and reflect all other colours. Likewise magenta will absorb green and yellow will absorb blue. Black colour may be produced by cyan, magenta and yellow.   But it will be muddy-looking black. Carbon black that is used to produce black in printing is cheaper than coloured pigments. These are the two reasons that make four colour model as standard. The colours are cyan, magenta, yellow and black (CMYK) [4].

OTHER MODELS
The RGB and CMYK are the primary colour models used for display and printing. Few other models like YUV, YIQ, CIELAB, CIELUV, HSI, HLS, and HSV color models are used for specific applications. 

YUV MODELS
Television broadcasting carries colour pictures from one place to another and projects the pictures on Television screens. Colour reproduction in screens is performed using additive mixing. Thus obvious choice of colour space should be RGB. But Television and Video systems seldom use the RGB as it is bandwidth inefficient. Next, when colour television broadcast was introduced in way back in 1950s there were lots of B&W TV sets. To cater to monochrome TVs the colour broadcast was made backward compatible. It means old B&W TVs can receive colour TV signals but B&W signals only projected on the screen. Our eye is sensitive to luminance variations than chrominance variations. Thus RGB colours were transformed to YUV colour space. Where Y stand for luminance and U and V contain colour information. Video engineers piggy-backed colour information on the TV composite signal to conserve bandwidth. Thus colour TV signals consumed same bandwidth as monochrome signals (6 to 7 MHz). This was an engineering marvel. The YUV space is used by PAL (Phase Alternation Line, Europe and Asia), NTSC (National Television System Committee, USA), and SECAM (French system) colour TVs [5],[6].

The conversion equations between R'G'B' and YUV is given below 

Y = 0.299R ́ + 0.587G ́ + 0.114B ́

U= – 0.147R ́ – 0.289G ́ + 0.436B ́

V = 0.615R ́ – 0.515G ́ – 0.100B ́

YIQ colour space is a variant of YUV and used in NTSC systems. Here I stand for In-phase and Q stands for quadrature. Digital Video standard ITU-R BT.601 (International Telecommunication Union - Recommendation) uses YCbCr which again a scaled version of YUV. Here Cb and Cr represent chrominance signals. The High Definition Television (HDTV) uses ITU-R BT.709 standard. The primaries used in this colour space closely correspond to the contemporary monitors.

Source
  1.  A Guided Tour of Color Space [Online] http://www.poynton.com/papers/Guided_tour/abstract.html
  2.  Introduction to colour science [Online] http://www.techmind.org/colour/
  3. sRGB: A Standard for Color Management - NEC SpectraView - spectraview.nec.com.au/wpdata/files/40.pdf (PDF, 1.1 MB)
  4. Rafael C. Gonzalez and Richard E.Woods, Digital Image Processing, 2nd edition, Pearson Education.
  5. Keith Jack, Video Demystified: A Handbook for the Digital Engineer 4th edition, Newnes Publishers
  6. Noor A. Ibraheem,  Mokhtar M. Hasan,  Rafiqul Z. Khan,  Pramod K. Mishra, "Understanding Color Models: A Review", ARPN Journal of Science and Technology, vol. 2, no. 3, April 2012, pp.265 -- 275.