Main Content


Specify color space used in MATLAB


The ReturnedColorSpace property specifies the color space you want the toolbox to use when it returns image data to the MATLAB® workspace. This is only relevant when you are accessing acquired image data with the getsnapshot, getdata, and peekdata functions.

This property can have any of the following values:



MATLAB grayscale color space.


MATLAB RGB color space.


MATLAB YCbCr color space.

Note that YCbCr is often imprecisely referred to as YUV. (YUV is similar, but not identical. They differ by the 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.)


Convert grayscale Bayer color patterns to RGB images. The bayer color space option is only available if your camera's default returned color space is grayscale.

To use the BayerSensorAlignment property, you must set the ReturnedColorSpace property to bayer.


For some adaptors, such as GigE and GenTL, if you use a format that starts with Bayer, e.g. BayerGB8_640x480, we automatically convert the raw Bayer pattern to color – the ReturnedColorSpace is RGB. If you set the ReturnedColorSpace to 'grayscale', you'll get the raw pattern.

For an example showing how to determine the default color space and change the color space setting, see Specifying the Color Space.




Data type

Character vector


Defined at object creation time and depends on the video format selected