I don't fully understand Chroma Sub-sampling 4:2:0 ?
2 views (last 30 days)
Show older comments
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 Comment
Hussam Noah
on 24 Apr 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 ;)
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!