User`s guide
4 Conversions
Color Space Conversion
The Color Space Conversion blo ck enables you to conve rt co lor information
from the R’G’B ’ color space to the Y’CbCr color space and from the Y’CbCr
color space to the R’G’B’ color space as specified by Recommendation ITU-R
BT.60 1 -5. This block can also be used to con vert from th e R’G’B’ colo r space to
intensity. T he prime notation indicates that the signals are gamma corrected.
This section includes the following topic:
• “Converting Color Information from R’G’B’ to Int en sity” o n page 4-14 -- U se
the Color Space Conversion block to convert an R’G’B’ imag e to intensity.
Converting Color Information from R’G’B’ to Intensity
Some image processing algorithms are customized for intensity images. If you
want to use one of these algorithms, you must first convert your image to
intensity. In this topic, you learn how tousetheColorSpaceConversionblock
to accomplish this task. You can use thisproceduretoconvertanyR’G’B’
imagetoanintensityimage:
1 Define an R’G’B’ image in the MATLAB workspace. To read in an R’G’B’
image from a JPG file, at the M ATLAB command prompt, type
I= imread('greens.jpg');
I is a 300-by-500-by-3 array of 8-bit unsigned integer values. Each plane of
this array represents the red, green, or blue color values of the image.
2 To view the image this matrix represents, at the MATLAB command
prompt, type
imshow(I)
4-14