I don't fully understand Chroma Sub-sampling 4:2:0 ?
Afficher commentaires plus anciens
i want to implement chroma subsampling 4:2:0 by a fcator of 2, horizontally and vertically, where we calculate the average chrominance every four pixels, but i don't fully understand how to write a code for it?
i wrote a function that concerts an rgb image to ntsc (YIQ color model) using the transforamtion matrix, then i resized the image to a multiple of 4 to make things simple, i already know how to implement 4:2:2 and 4:1:1 but 4:2:0 i can't figure out.
1 commentaire
Hussam Noah
le 24 Avr 2020
Dear Ahmed, to do 4:2:0 subsampling use 4:2:2 and then to the new array take the average of 2 row elements
e.g.
1 2 3 4
4 3 2 1
1 1 1 1
3 3 3 3
|
\/
4:2:2
|
\/
1 3
4 2
1 1
3 3
|
\/
taking average
|
\/
(1+4)/2 (3+2)/2 = 2.5 2.5
(1+3)/2 (1+3)/2 = 2 2
you can do the average by traversing the array rows and jump 2 rows at a time doing the following
(thisRow + bellowRow) /2
example
(Row1 + Row2) / 2
then
(Row3+ Row4) /2
and so on
Goodluck with your assignment ;)
Réponses (0)
Catégories
En savoir plus sur Color dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!