This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

vision.ColorSpaceConverter System object

Package: vision

Convert color information between color spaces


    Note:   The vision.ColorSpaceConverter System object will be removed in a future release. Use the rgb2gray, rgb2ycbcr, or the makecform and the applycform functions with equivalent functionality instead.

The ColorSpaceConverter object converts color information between color spaces.

    Note:   Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.


H = vision.ColorSpaceConverter returns a System object, H, that converts color information from RGB to YCbCr using the conversion standard Rec. 601 (SDTV).

H = vision.ColorSpaceConverter(Name,Value) returns a color space conversion object, H, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1, Value1,...,NameN,ValueN).

Code Generation Support
Supports MATLAB® Function block: Yes
System Objects in MATLAB Code Generation (MATLAB Coder)
Code Generation Support, Usage Notes, and Limitations.



Color space input and output conversion

Specify the conversion color spaces as one of the following:

[RGB to YCbCr]
[YCbCr to RGB]
[RGB to intensity]
[RGB to HSV]
[HSV to RGB]
[sRGB to XYZ]
[XYZ to sRGB]
[sRGB to L*a*b*]
[L*a*b* to sRGB]

Note that the R, G, B and Y (luma) signal components in the preceding color space conversions are gamma corrected. The default is [RGB to YCbCr].


Reference white point

Specify the reference white point as one of D50 | D55 | D65. The default is D65. These values are reference white standards known as tristimulus values that serve to define the color "white" to correctly map color space conversions. This property applies when you set the Conversion property to [sRGB to L*a*b*] or [L*a*b* to sRGB].


Standard for RGB to YCbCr conversion

Specify the standard used to convert the values between the RGB and YCbCr color spaces as one of Rec. 601 (SDTV) | Rec. 709 (HDTV). The default is Rec. 601 (SDTV). This property applies when you set the Conversion property to [RGB to YCbCr] or [YCbCr to RGB].


Scanning standard for RGB-to-YCbCr conversion

Specify the scanning standard used to convert the values between the RGB and YCbCr color spaces as one of [1125/60/2:1] | [1250/50/2:1]. The default is [1125/60/2:1]. This property applies when you set the ConversionStandard property to Rec. 709 (HDTV).


stepConvert color space of input image
Common to All System Objects

Create System object with same property values


Expected number of inputs to a System object


Expected number of outputs of a System object


Check locked states of a System object (logical)


Allow System object property value changes


Convert an image from an RGB to an intensity color space.

i1 = imread('pears.png');

hcsc = vision.ColorSpaceConverter;
hcsc.Conversion = 'RGB to intensity';
i2 = step(hcsc, i1);



This object implements the algorithm, inputs, and outputs described on the Color Space Conversion block reference page. The object properties correspond to the block parameters, except:

The Image signal block parameter allows you to specify whether the block accepts the color video signal as One multidimensional signal or Separate color signals. The object does not have a property that corresponds to the Image signal block parameter. You must always provide the input image to the step method of the object as a single multidimensional signal.

Introduced in R2012a

Was this topic helpful?