Digital Signal Processing Reference
In-Depth Information
After rounding, it follows that
2
4
3
5
¼ round
2
4
3
5
¼
2
4
3
5
R
G
B
199:53
10:16
99:9
200
10
100
EXAMPLE 14.3
Given the 2 2 RGB image
"
100 50
200 150
#
"
10 25
20 50
#
"
10 5
20 15
#
R ¼
G ¼
B ¼
convert the RGB color image into a grayscale image.
Solution:
Since only Y components are kept in the grayscale image, we apply Equation
(14.4)
to each pixel in the 2 x 2 image
and round the results to integers as follows:
"
100 50
200 150
#
"
10 25
20 50
#
"
10 5
20 15
#
"
37 30
74 76
#
Y ¼ 0:299
þ 0:587
þ 0:114
¼
Figure 14.9
shows the grayscale image converted from the 24-bit color image in
Figure 14.5
using
the RGB-to-YIQ transformation, where only the luminance information is retained.
14.1.6
MATLAB Functions for Format Conversion
The following list summarizes MATLAB functions for image format conversion:
imread
¼
read image data file with the specified format
X
¼
8-bit grayscale image, 8-bit indexed image, or 24-bit RGB color image
FIGURE 14.9
Grayscale image converted from the 24-bit color image in
Figure 14.5
using RGB-to-YIQ transformation.
Search WWH ::
Custom Search