How to get the YUV value for each pixel?

Hi everyone
I am new to matlab, so any help would be appreciated.
I have an image and I need to get the YUV value for each pixel in the image.
Can anyone help? Thanks in advance

 採用された回答

Dishant Arora
Dishant Arora 2014 年 2 月 17 日

0 投票

if you have a RGB image you can convert it into YUV using below mentioned equations:
Y = R*(0.299000) + G*(0.587000) + B*(0.114000);
U = R*(-0.168736) + G*(-0.331264) + B*(0.500000) + 128;
V = R*(0.500000) + G*(-0.418688) + B*(-0.081312) + 128;

2 件のコメント

Rachel
Rachel 2014 年 2 月 17 日
Thanks a lot!
DGM
DGM 2021 年 11 月 3 日
編集済み: DGM 2021 年 11 月 4 日
That's not YUV. That's more or less YPbPr, or YCbCr without the margins. The offset implies that the RGB image is uint8-scaled, though if it were actually uint8, the operations would result in severe data truncation. The only case in which this would work is if R,G,and B were uint8-scaled floating-point data.
This covers general luma-chroma conversions, including YUV:
If actual YCbCr conversion is desired with margins, just use rgb2ycbcr().

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeConvert Image Type についてさらに検索

質問済み:

2014 年 2 月 17 日

編集済み:

DGM
2021 年 11 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by