0

Unity's Texture.GetPixels32() gives us a Color32[], which is an RGBA array that can be converted easily into byte[].

How can we convert this Color32[] or RGBA byte[] into a YUV byte[]?

Also, how does the Alpha value affect the YUV conversion? Online, I mostly see people only trying to convert RGB to YUV. Thanks!

1
  • Maybe I know why you're doing this? Where do you need to use this byte array? Commented Nov 30, 2018 at 20:31

1 Answer 1

2

Here is the little sample from my code:

decimal y = rgb.R * .299000 + rgb.G * .587000 + rgb.B * .114000;
decimal u = rgb.R * -.168736 + rgb.G * -.331264 + rgb.B * .500000 + 128;
decimal v = rgb.R * .500000 + rgb.G * -.418688 + rgb.B * -.081312 + 128;

I used the yuv in 0....1 intervall

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.