VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



RGB> YUV> RGB Conversion

by Marius Hudea (5 Submissions)
Category: Graphics
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

The application converts a RGB bitmap into YUV format. Both conversion and deconversions are illustrated.
The YUV (also know as YCbCr) colorspace is just another method of representing pixel information.
Instead of using Red, Green and Blue percentages, YUV uses a Y (luminance, luma) plane that transmits the light information and two chrominance planes U,V (Cb,Cr) that transmit the color information.
This is useful when compressing images and videos, because the human eye is more sensitive to the Y (luminance) information and less sensitive to the U,V (Cb, Cr) chroma information.
For example, some video codecs take two pixels and store them in the following format : Y1 U Y2 V , which means instead of using 48 bits , only 32 bits are used. Y1 and Y2 are the Y of each pixel and U and V are the chroma information (average for both pixels). It's a little bit more complex than this but I will show how it's done in another source code.

Inputs
One RGB image (recommended 320x240, 24 bits) stored in the same folder where the project is, called "picture.bmp". You can replace it with any bitmap you wish.
Assumes
In the next days/weeks I'll upload code that converts YUV to YUY2 and maybe YV12, thus compressing images almost lossless.
Code Returns
Shows a "grayscale" image of the original image (just the luminance field) and a RGB image that was obtained by converting back to RGB the image converted in YUV format.
Side Effects
None.
API Declarations
Just some basic API functions, should not cause any problems to users.
GetPixel, SetPixel to get/set the color of a pixel
Createfile, Closehandle, Writefile for file operations.

Rate RGB> YUV> RGB Conversion

Download RGB> YUV> RGB Conversion

Download RGB> YUV> RGB Conversion (382 KB)

RGB> YUV> RGB Conversion Comments

No comments have been posted about RGB> YUV> RGB Conversion. Why not be the first to post a comment about RGB> YUV> RGB Conversion.

Post your comment

Subject:
Message:
0/1000 characters