User`s guide

6 Working with Acquired Image Data
MathWorks product, Image Processing Toolbox, includes functions that
convert Y CbCr data to RGB data, and v ice versa.
Note Some devices that claim to support the YUV color space actually
support the YCbCr color space. YUV is similar to YCbCr but not identical.
ThedifferencebetweenYUVandYCbCr is th e scaling factor applied to the
result. YUV refers to a particular scaling factor used in composite NTSC
and PAL formats. In most cases, you can specify the YCbCr color space for
devices that support YUV.
Thefollowingexampleillustrateshowtospecifythecolorspaceofthe
returned image data.
1 Create an im age acquisition object Th i s example creates a video
input object for a generic Windows image acquisition d evice. To run this
example on your system, use the
imaqhwinfo function to get the object
constructor for your image acquisition device and substitute that syntax
for the following code.
vid = videoinput('win video',1);
2 View the default color space used for the data The value of the
ReturnedColorSpace prope rty indicates the color space of the im a ge data.
vid.ReturnedColorSpace
ans =
rgb
3 Modify the c olor space used for the data To change the color space
of the returned image data, set the value of the
ReturnedColorSpace
property.
set(vid,'ReturnedColorSpace','gra yscale')
ans =
grayscale
6-18