While Downsampling 4:4:4 YCbCr image to 4:2:0 using imresize inbuilt function should we scale it by 0.5 or 0.25
2 views (last 30 days)
Show older comments
I have converted RGB image into its YCbCr equivalent i.e. 4:4:4. And separated its Y, Cb and Cr components.
Now i need to downsample this 4:4:4 sample into 4:2:0 sample. For this i am using imresize inbuilt command.
Y component will be as it is in 4:2:0. The doubt i have is for Cb and Cr chroma components should i scale each component by 0.5 or 0.25.
Code:
%Load Image
RGB = imread('dbz.jpg');
%convert image to YCbCr color space
YCBCR = rgb2ycbcr(RGB);
%Extract Y and Cb, Cr components from the converted image it is in 4:4:4
Y=YCBCR(:,:,1);
Cb=YCBCR(:,:,2);
Cr=YCBCR(:,:,3);
Next which below code should i use 0.5 or 0.25 ?
%4:2:0 conversion of YCbCr using inbuilt command with bilinear
Cb_auto = imresize(Cb, 0.5, 'bilinear', 'Antialiasing', false);
Cr_auto = imresize(Cr, 0.5, 'bilinear', 'Antialiasing', false);
or
%4:2:0 conversion of YCbCr using inbuilt command with bilinear
Cb_auto = imresize(Cb, 0.25, 'bilinear', 'Antialiasing', false);
Cr_auto = imresize(Cr, 0.25, 'bilinear', 'Antialiasing', false);
Why i have this doubt is that i read like 4:2:2 samples chroma at 1/2th the luma samples.
Whereas 4:2:0 samples chroma at 1/4th the luma samples.
Help is appreciated!
0 Comments
Accepted Answer
DGM
on 8 May 2023
Edited: DGM
on 8 May 2023
Let me preface this answer by saying that I am not familiar with the conventions used for various file encodings. How exactly the image data gets downsampled (the method of interpolation, the use of antialiasing) is something I can't comment on.
That said, 4:2:2 reduces the amount of chroma information by half by reducing resolution by 0.5 in one dimension. Using 4:2:0 reduces the amount of chroma information by a quarter by reducing resolution by 0.5 in both dimensions. In other words, when you resize the chroma channels by 0.5, you're reducing the amount of pixels to 0.5^2 = 0.25.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!