How to use vision.ChromaResampler for chroma sampling?

4 views (last 30 days)
Hello, I need help, I dont understand how to do chroma sampling using Computer Vision Toolbox? this is what I do to perform downsampling for chroma :
H = vision.ChromaResampler;
x = imread('image5.bmp');
y=x(:,:,1);
cb1=x(:,:,2);
cr2=x(:,:,3);
hcsc = vision.ColorSpaceConverter;
hcsc.Conversion = 'RGB to YCbCr';
x1 = step(hcsc, x);
H.Resampling = '4:4:4 to 4:2:2';
[Cb, Cr] = step(H, x(:,:,2), x(:,:,3));
Do I write the right code for downsampling chroma? Thank you for your attention..
  1 Comment
Ijaz Ahmad
Ijaz Ahmad on 26 Apr 2022
Yes, this is the right code for chroma sub-smpling.
And to upsample, the following code can be used:
H_upsample = vision.ChromaResampler;
H_upsample.Resampling = "4:2:2 to 4:4:4";
[Cb2, Cr2] = step(upsampler, Cb, Cr);

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!