Results 1 to 3 of 3

Thread: Using QImage/QPixmap with external capture devices

  1. #1
    Join Date
    Aug 2009
    Posts
    7
    Qt products
    Qt4

    Default Using QImage/QPixmap with external capture devices

    Guys, i got a quick question concerning how to use external API for image and showing it in a QLabel as a pixmap.

    I tried an obvious method which I used the external camera API and save it as a bmp file and then i import it in qt using load() and set it to be the pixmap of the label. It did the job. But now i want to do a live stream and writing and read bmp file on the disk and reading them does not seems to be a good idea. Therefore, i wonder how should i manipulate the array of pixels i got from the camera API with Qimage/Qpixmap such that it can be displayed on QLabel?

    Thanks guys

    schan117

  2. #2
    Join Date
    Feb 2008
    Posts
    98
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    2
    Thanked 24 Times in 24 Posts

    Default Re: Using QImage/QPixmap with external capture devices

    QImage and QPixmap inherit QPaintDevice. Thus you can paint to them using a QPainter. If you have the image already coded in .bmp in an array in memory, you may load the image into the QPixmap using QPixmap::loadFromData().

    However, if you want to display live video, a QLabel is probably not the best idea. If you already have the pixels of the image in an array, creating a custom widget and reimplementing paintEvent() to paint the pixels directly would be faster.
    Last edited by victor.fernandez; 10th September 2009 at 16:31.

  3. #3
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Qt products
    Platforms
    Unix/X11 Windows
    Thanks
    20
    Thanked 5 Times in 5 Posts

    Default Re: Using QImage/QPixmap with external capture devices

    Be Faster ?
    You mean in paintEvent, drawImage to QPainter ? and image loadFromData ?


    Btw, sorry with my english...

Similar Threads

  1. Q3ScrollView resists to scroll down to the garbage bin
    By sivrisinek in forum Qt Programming
    Replies: 0
    Last Post: 5th February 2009, 18:50
  2. shared vs static
    By alisami in forum Installation and Deployment
    Replies: 3
    Last Post: 4th October 2008, 14:04
  3. Replies: 16
    Last Post: 23rd May 2008, 11:12
  4. Link Errors
    By magikalpnoi in forum Qt Programming
    Replies: 5
    Last Post: 25th September 2006, 23:04

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
  •  
Qt is a trademark of The Qt Company.