Digital Signal Processing Reference
In-Depth Information
To obtain the grayscale image, we simply convert each RGB pixel to the YIQ pixel, and then keep its
luminance channel and discard IQ channel chrominance. The conversion formula is hence given by
Yðm; nÞ¼ 0 : 299 $Rðm; nÞþ 0 : 587 $Gðm; nÞþ 0 : 114 $Bðm; nÞ
(14.4)
Note that Yðm; nÞ , Iðm; nÞ , and Qðm; nÞ can be matrices that represent the luminance image and two
color component images, respectively. Similarly, Rðm; nÞ , Gðm; nÞ , and Bðm; nÞ can be matrices for the
RGB component images.
EXAMPLE 14.1
Given a pixel in an RGB image
R ¼ 200; G ¼ 10; B ¼ 100
convert the pixel values to the YIQ values.
Solution:
Applying Equation (14.2) , it follows that
2
4
3
5 ¼
2
4
3
5
2
4
3
5
Y
I
Q
0:299 0:587 0:114
0:596 0:274 0:322
0:212 0:523
200
10
100
0:311
Carrying out the matrix operations leads to
2
4
3
5 ¼
2
4
3
5 ¼
2
4
3
5
Y
I
Q
0:299 200 0:587 10 0:114 100
0:596 200 0:274 10 0:322 100
0:212 200 0:523 10
77:07
84:26
68:27
0:311 100
Rounding the values to integers, we have
2
4
3
5 ¼ round
2
4
3
5 ¼
2
4
3
5
Y
I
Q
77:07
84:26
68:27
77
84
68
Now let us study the following example to convert the YIQ values back to the RGB values.
EXAMPLE 14.2
Given a pixel of an image in the YIQ color format
Y ¼ 77;
I ¼ 84; Q ¼ 68
convert the pixel values back to the RGB values.
Solution:
Applying Equation (14.3) yields
2
4
3
5 ¼
2
4
3
5
2
4
3
5 ¼
2
4
3
5
R
G
B
1:000 0:956 0:621
1:000 0:272 0:647
1:000 1:106
77
84
68
199:53
10:16
99:90
1:703
 
Search WWH ::




Custom Search