Clear Filters
Clear Filters

what percentage of reduction in image size resulting from switching from the YCvCr colour space to RGB ?

2 views (last 30 days)
what percentage of reduction in image size resulting from switching to the YCvCr colour space to RGB ?

Answers (1)

DGM on 17 May 2022
Edited: DGM on 17 May 2022
If we're talking about "size" as in geometry (i.e. number of pixel elements), then if the YCbCr is not downsampled, then the image channels have the same number of elements before and after conversion. If the YCbCr image is subject to chroma subsampling, then there are fewer elements in the Cb and Cr channels. After conversion to RGB, the image will have more elements than it did when it was YCbCr.
If we're talking about "size" as in memory, then it depends on how it was converted, and again, whether chroma subsampling was used. If no subsampling is used and the same numeric class is used, then the two images will have the same size in memory.
Argb = imread('peppers.png');
Aycc = rgb2ycbcr(Argb); % this is uint8 with no subsampling
Argb2 = ycbcr2rgb(Aycc); % this is also uint8
whos Aycc
Name Size Bytes Class Attributes Aycc 384x512x3 589824 uint8
whos Argb2
Name Size Bytes Class Attributes Argb2 384x512x3 589824 uint8
If we're talking about images in files, I think it's safe to say that the most common numeric class for either type is uint8, though the varied methods of compression across different image formats kind of makes the comparison moot.
TL;DR: The channels of an RGB image are represented with equal spatial resolution, but the channels of a YCbCr image may have unequal spatial resolution.
If you're referring to some other aspect of the images, you'll have to clarify.
Walter Roberson
Walter Roberson on 17 May 2022
Sometimes when people talk about YCbCr, they are talking about formats that pack multiple fields at the bit level. For example, using 8 bits for Y and 4 bits for Cb and 4 bits for Cr, for a total of 16 bits (2 bytes). That would then be expected to expand to R G B at 8 bits each, total of 24 bits.
DGM on 18 May 2022
Edited: DGM on 18 May 2022
ITU-R BT601 discusses subsampling to some degree. MATLAB's rgb2ycbcr()/ycbcr2rgb() have no convenient options to support it directly, but that's probably just because it would be problematic in an environment where the common workflows center around images as rectangular arrays.
YCbCr is commonly subsampled. That possibility is one of the advantages of using a color model that allows you to separate brightness and color information. Every JPG image that MATLAB saves is 4:2:0 chroma subsampled. Digital video files encoded using "YUV" don't actually use YUV; they use YCbCr -- and it should be easy to find subsampled video.
I don't pretend to be familiar with the possible conventions for how the data is actually shoved into a file. There's a reason I was talking vaguely about "elements" instead of height and width. It doesn't really much make sense to talk about an image's height and width when its channels have different numbers of elements.

Sign in to comment.


Community Treasure Hunt

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

Start Hunting!