“Develop success from failures. Discouragement and failure are two of the surest stepping stones to success.”
Unit – 3
The purpose of a color model is to facilitate the specification of colors in some standard way. A color model is a specification of a coordinate system and a subspace within that system where each color is represented by a single point. Color models most commonly used in image processing are:
In this model, each color appears in its primary colors red, green, and blue. This model is based on a Cartesian coordinate system. The color subspace is the cube shown in the figure below. The different colors in this model are points on or inside the cube, and are defined by vectors extending from the origin.
Figure 15.3 RGB color model
All color values R, G, and B have been normalized in the range [0, 1]. However, we can represent each of R, G, and B from 0 to 255.
Each RGB color image consists of three component images, one for each primary color as shown in the figure below. These three images are combined on the screen to produce a color image.
Figure 15.4 Scheme of RGB color image
The total number of bits used to represent each pixel in RGB image is called pixel depth. For example, in an RGB image if each of the red, green, and blue images is an 8-bit image, the pixel depth of the RGB image is 24-bits. The figure below shows the component images of an RGB image.
Full color
Red Green Blue
Figure 15.5 A full-color image and its RGB component images
Cyan, magenta, and yellow are the primary colors of pigments. Most printing devices such as color printers and copiers require CMY data input or perform an RGB to CMY conversion internally. This conversion is performed using the equation
𝐶 1 𝑅
[𝑀] = [1] − [𝐺]
𝑌 1 𝐵
where, all color values have been normalized to the range [0, 1].
In printing, combining equal amounts of cyan, magenta, and yellow produce muddy-looking black. In order to produce true black, a fourth color, black, is added, giving rise to the CMYK color model.
The figure below shows the CMYK component images of an RGB image.
The RGB and CMY color models are not suited for describing colors in terms of human interpretation. When we view a color object, we describe it by its hue, saturation, and brightness (intensity). Hence the HSI color model has been presented. The HSI model decouples the intensity component from the color-carrying information (hue and saturation) in a color image. As a result, this model is an ideal tool for developing color image processing algorithms.
The hue, saturation, and intensity values can be obtained from the RGB color cube. That is, we can convert any RGB point to a corresponding point is the HSI color model by working out the geometrical formulas.
The hue H is given by
𝐻 = {
𝜃 if 𝐵 ≤ 𝐺
}
Where
360 − 𝜃 if 𝐵 > 𝐺
1 [(𝑅 − 𝐺) + (𝑅 − 𝐵)]
𝜃 = 𝑐o𝑠−1 { 2 }
√(𝑅 − 𝐺)2 + (𝑅 − 𝐵)(𝐺 − 𝐵)
The saturation S is given by
𝑆 = 1 − 3
(𝑅 + 𝐺 + 𝐵)
[min (𝑅, 𝐺, 𝐵)]
The intensity I is given by
𝐼
= 3
All RGB values are normalized to the range [0,1].
The applicable equations depend on the value of H:
If 0° ≤ 𝐻 < 120° :
𝐵 = (1 − 𝑆)
𝑅 = 𝐼 [1 + 𝑆 cos 𝐻 ]
cos (60°− 𝐻)
𝐺 = 3𝐼 − (𝑅 + 𝐵)
If 120° ≤ 𝐻 < 240° :
𝐻 = 𝐻 − 120°
𝑅 = (1 − 𝑆)
𝐺 = 𝐼 [1 + 𝑆 cos 𝐻 ]
cos (60°−𝐻)
𝐵 = 3𝐼 − (𝑅 + 𝐺)
If 240° ≤ 𝐻 ≤ 360° :
𝐻 = 𝐻 − 240°
𝐺 = (1 − 𝑆)
𝐵 = 𝐼 [1 + 𝑆 cos 𝐻 ]
𝑅 = 3𝐼 − (𝐺 + 𝐵)
The next figure shows the HSI component images of an RGB image.
Hue Saturation Intensity Figure 15.7 A full-color image and its HSI component images
Full-color image processing approaches fall into two major categories:
In full-color images, color pixels really are vectors. For example, in the RGB system, each color pixel can be expressed as
𝑐𝑅(𝑥, 𝑦)
𝑅(𝑥, 𝑦)
𝑐(𝑥, 𝑦) = [𝑐𝐺(𝑥, 𝑦)] = [𝐺(𝑥, 𝑦)]
𝑐𝐵(𝑥, 𝑦)
𝐵(𝑥, 𝑦)
For an image of size M×N, there are MN such vectors, c(x, y), for x = 0,1, 2,...,M-1; y = 0,1,2,...,N-1.
As with the gray-level transformation, we model color transformations using the expression
(𝑥, 𝑦) = 𝑇[ƒ(𝑥, 𝑦)]
where f(x, y) is a color input image, g(x, y) is the transformed color output image, and T is the color transform.
This color transform can also be written
𝑠i = 𝑇i(𝑟1, 𝑟2, … , 𝑟𝑛) i = 1,2, … , 𝑛
For example, we wish to modify the intensity of the image shown in Figure 14.8(a) using
(𝑥, 𝑦) = 0.7ƒ(𝑥, 𝑦)
𝑠i = 0.7𝑟i i = 1,2,3
𝑠i = 0.7𝑟i + 0.3 i = 1,2,3
𝑠3 = 0.7𝑟3
Figure 15.8 (a) Original image. (b) Result of decreasing its intensity