# How can I convert a YCbCr image to 4:2:0

50 vues (au cours des 30 derniers jours)
Damon Calvert le 18 Fév 2020
Modifié(e) : Joseph Cheng le 18 Fév 2020
I have the image converted from rgb to YCbCr but now I have to change it from 4:4:4 to 4:2:0 and I have no idea how to do that.
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponses (1)

Joseph Cheng le 18 Fév 2020
Modifié(e) : Joseph Cheng le 18 Fév 2020
while you're probably not going to implement this in simulink but take a look at https://www.mathworks.com/help/vision/ref/chromaresampling.html which covers how it should be done for 4:4:4 to 4:2:2.
Not sure what the standard practice is for the down sampling as to which of say the 2x4 pixel subsets are used or average together to genearte the block but overall you're combining/binning the colors 2x2.
edit: also take a look at https://www.mathworks.com/matlabcentral/fileexchange/36417-yuv-files-reading-and-converting which is for YUV (yes i know you're looking for YCBCr)
where
yuv(:,:,1) = double(Y);
yuv(:,:,2) = imresize(double(U),2,'bicubic');
yuv(:,:,3) = imresize(double(V),2,'bicubic');
you can see that layer 2 and 3 (U and V) are resampled/resized to match the 4:2:0 scheme.
the file exchange that was mentioned in other answer posts appears to have been removed https://www.mathworks.com/matlabcentral/answers/65149-converting-ycbcr-4-4-4-to-4-2-0?s_tid=gn_loc_drop
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Convert Image Type dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by