Results 1 to 3 of 3

Thread: Help displaying frames from a webcam to the screen

  1. #1
    Join Date
    Jun 2007
    Posts
    10
    Thanks
    3

    Default Help displaying frames from a webcam to the screen

    I'm currently capturing video frames from a webcam using the V4L2 library in linux. The frames are encoded in YUY2 (it has a few other names I can't remember). I want to display some of these frames in a window of some sort.

    I don't need full motion video, 5 - 10 fps is more than enough.

    My thought was just to paint the buffer to a window, but I have no idea how to go about this in Qt. I also suspect I might need to do a conversion from YUY2 to something like RGB.

    I'm doing some reading on my own, but I thought I would post here and see if anyone had some ideas.

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Help displaying frames from a webcam to the screen

    You will need to convert the input frame pixel by pixel from YUV( yes, YUV ), to RGB( meaning you store the pixel data to a QImage or QPixmap ).

    Information about conversion formulas you can find here:
    http://en.wikipedia.org/wiki/YUY2,
    http://www.fourcc.org/fccyvrgb.php, and here
    http://www.fourcc.org/fccyvrgb.php.

    First you need to initialize the QImage to the dimensions of the frame, Next you just process the frame starting from the first pixel, and set the RGB data at the corresponding location in the QImage.

    Regards

  3. The following user says thank you to marcel for this useful post:

    stealth86 (29th June 2007)

  4. #3
    Join Date
    Jun 2007
    Posts
    10
    Thanks
    3

    Default Re: Help displaying frames from a webcam to the screen

    Quote Originally Posted by marcel View Post
    You will need to convert the input frame pixel by pixel from YUV( yes, YUV ), to RGB( meaning you store the pixel data to a QImage or QPixmap ).

    Information about conversion formulas you can find here:
    http://en.wikipedia.org/wiki/YUY2,
    http://www.fourcc.org/fccyvrgb.php, and here
    http://www.fourcc.org/fccyvrgb.php.

    First you need to initialize the QImage to the dimensions of the frame, Next you just process the frame starting from the first pixel, and set the RGB data at the corresponding location in the QImage.

    Regards
    Are there any libraries that perform the conversion between YUY2 and RGB that I could just link in?

    nvm: I just found the libavcodec library.
    Last edited by stealth86; 3rd July 2007 at 20:00.

Similar Threads

  1. Replies: 8
    Last Post: 18th March 2011, 11:27

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.