Thread: Distored image when convert RGB into YUV. How to fix???

  1. #1
    Registered User
    Join Date
    Nov 2013
    Posts
    5

    Distored image when convert RGB into YUV. How to fix???

    From .ppm image, I extracted R,G,B data and saved following structures:

    RGB RGB RGB RGB RGB RGB RGB..........

    corresponding to each pixel position.
    Then I used formula to convert R,G,V into Y,U,V.With each pixel, I obtained YUV correspondingly.

    R0G0B0->Y0U0V0 , R1G1B1 ->Y1U1B1, ........

    I saved data following YUV422 Data Format:The YUV422 data format shares U and V values between two pixels. As a result, these values are transmitted to the PC image buffer only once for every two pixels.

    R0G0B0R1G1B1->Y0UY1V

    a,How to calculate U and V from U0,U1 and V0,V1????????
    b,In my case , I used this formula:

    U=(U0+U1)/2; V=(V0+V1)/2;

    Obtained data was saved following structure to create .yuv file:

    YUYV YUYV YUYV YUYV YUYV YUYV......

    But when I used YUV tools to read new .yuv file, that image is not similar to original image. What did I do wrong here ????
    Last edited by ios198; 11-20-2013 at 02:33 AM.

  2. #2
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    This thread should be moved to tech board
    Fact - Beethoven wrote his first symphony in C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Convert const int** to image
    By ArutyunovG in forum C++ Programming
    Replies: 1
    Last Post: 02-03-2012, 06:45 AM
  2. Convert image to matrix
    By prefix in forum C++ Programming
    Replies: 1
    Last Post: 09-05-2011, 03:57 AM
  3. Convert video to image
    By rwcradio in forum C Programming
    Replies: 7
    Last Post: 11-20-2007, 03:36 AM
  4. how to convert a bitmap image to a jpg image file using C++?
    By nomer in forum Windows Programming
    Replies: 4
    Last Post: 06-04-2006, 07:40 PM
  5. Hi, how to convert a grayscale image into 8 bit image?
    By Alexanderbinich in forum C++ Programming
    Replies: 3
    Last Post: 03-15-2005, 07:50 PM

Tags for this Thread