INDEX  F.A.Q.  SEARCH  LATEST POSTS     Rules  Register  Profile  Private messages  Login


Search all forums or this forum: Advanced search
YUYV/YUY2 signed/unsigned, RBG and "usual" values questions

Forum Index -> Video -> Programming Printer-friendly version
Reply to topic
Author Message
Guimauve2
Member


Joined: 08 May 2008
Location: Canada

Post Posted: May 08, 2008 18:15 Posts Comp View users profile Send private message Reply with quote

Good evening everyone,

After acquiring a new laptop a few weeks ago, I decided to put my programming skills to use and try to capture image susing my webcam with the Video For Linux Two API (V4L2) (I use Ubuntu 8.04). They are a few programs that already exist for that (of course!), but I really wanted to build one myself. smile.gif

I managed to get buffers from the webcam. The pixel format of my webcam is YUYV (or, in the Windows world, YUY2).

OK, here's my questions about the format, they are a few of them.

I store my byte values for my images in signed chars. It means that the Y, U and V values are between -128 and 127. If I do some stats about the Y, U and V values for a set of 50 frames, here is what I get:

Max Y encountered: 127.
Max U encountered: 127.
Max V encountered: 127.
Min Y encountered: -128.
Min U encountered: -128.
Min V encountered: -128.
Avg Y1 encountered: 15.
Avg Y2 encountered: 15.
Avg U encountered: -25.
Avg V encountered: -5.

First question: are these values plausible? I'm not a professionnel in video editing or anything, but these values, since they're in the correct range, seem correct. I noticed that a lot of Y values seem to be around 0. The U values tend to be around 128 or -127, and V values seem to be around -128 (and are never really in the positive range).

Is it typical for YUYV images, or my values are bad? I have yet to output the buffers to an image to see if it looks OK...

My second question: should the YUYV values be signed or unsigned? For now, they are signed. But it is very easy to get them positive by adding 128 to them. Is it correct? If so, is adding 128 to the values to correct way to proceed.

Also, how do I convert the values to RGB ones? I tries with the formulae on the FOURCC website, but I always get values off-range (like higher than 500).

Is there are simple way to output the values (YUYV of RGB (once I find the correct formulae...)) to an image file? I thought of BITMAP, but I always get a bad header error message (but that's not very important right now, as I can probably figure it out on my own).

Thank you! I really appreciate the help this Forum has already provided me regarding the YUYV format!

Guimauve2

P.S.: do you know where is can find YUYV-encoded bitmap images? I would like to open them in a hex editor the check to values.


Reply to topic All times are GMT - 6 Hours
Forum Index -> Video -> Programming Page 1 of 1





You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Jump to:  
Display:   
About   Advertise   Forum Archive   RSS Feeds   Statistics