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.![]()
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 Thread
Results 1 to 1 of 1
Similar Threads
-
A Few Questions About Older Sony "HD-ready" CRTs, I-Link, etc.
By Seeker47 in forum DVB / IPTVReplies: 5Last Post: 7th Jun 2010, 00:51 -
Questions, re: changes between an "old" and "new" film
By takearushfan in forum Newbie / General discussionsReplies: 11Last Post: 26th Jan 2010, 13:23 -
couple "playing Pal in Ntsc" questions
By spiritgumm in forum Newbie / General discussionsReplies: 3Last Post: 16th Mar 2009, 20:34 -
Questions about "Audio Compression" on digital cable box.
By Xylob the Destroyer in forum DVB / IPTVReplies: 1Last Post: 21st Feb 2009, 12:39 -
DVD Lab Pro - Three elemenetary "hot to ....." questions
By perfection in forum Authoring (DVD)Replies: 2Last Post: 1st Sep 2007, 06:45