Perform Chroma Resampling of Image
This example shows you how to downsample and upsample the chrominance components of an image.
Example Model
Open the Simulink® model.
modelname = "ex_blkchromaresampling.slx";
open_system(modelname)

This model reads an input image using the Image From File block with the File name parameter set to peppers.png and Image signal parameter set to Separate color signals.
The model then converts the input image from the RGB color space to the YCbCr color space by using a Color Space Conversion block with these parameter values:
Conversion —
R'G'B' to Y'CbCrUse conversion specified by —
Rec. 601 (SDTV)Image signal —
Separate color signals
The model downsamples the chrominance components by using a Chroma Resampling block with these parameters:
Resampling —
4:4:4 to 4:2:2Antialising filter —
Default
The model then upsamples the chrominance components by using another Chroma Resampling block with these parameters:
Resampling —
4:2:2 to 4:4:4Antialising filter —
Default
The model then converts the Y', Cb, and Cr components back to the RGB color space by using a Color Space Conversion block with these parameter values:
Conversion —
Y'CbCr to R'G'B'Use conversion specified by —
Rec. 601 (SDTV)Image signal —
Separate color signals
Simulate the Model
Run the model. The Chroma Resampling blocks downsamples the chrominance components from a size of 384-by-512 pixels to a size of 384-by-256 pixels, and then upsamples them back to a size of 384-by-512 pixels. The model displays the original input image and the resampled output image by using Video Viewer blocks.
sim(modelname);

