Results 1 to 3 of 3

Thread: The picture looks green with QImage

  1. #1
    Join Date
    May 2010
    Posts
    19
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default The picture looks green with QImage

    The pBuf is from web camera. Please see below:

    QImage image(pBuff, 320, 240, 320*3, QImage::Format_RGB888);
    mpLbl->setPixmap(QPixmap::fromImage(image));

    The label can display this vedio successful, but it looks green against to normal.
    What is the problem?

  2. #2
    Join Date
    Jul 2010
    Posts
    21
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: The picture looks green with QImage

    Perhaps your webcam produces BGR-frames? In that case try
    Qt Code:
    1. mpLbl->setPixmap(QPixmap::fromImage(image.rgbSwapped()));
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    May 2010
    Posts
    19
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: The picture looks green with QImage

    Quote Originally Posted by hobbyist View Post
    Perhaps your webcam produces BGR-frames? In that case try
    Qt Code:
    1. mpLbl->setPixmap(QPixmap::fromImage(image.rgbSwapped()));
    To copy to clipboard, switch view to plain text mode 
    That is the problem, it is OK now, thanks!

Similar Threads

  1. print picture (QImage) from non GUI thread
    By valeron in forum Qt Programming
    Replies: 1
    Last Post: 30th April 2013, 19:35
  2. Replies: 2
    Last Post: 28th July 2009, 08:02
  3. How can I remove Green background
    By asya in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 6th March 2009, 13:18
  4. QPixmap/QImage How to enlarge a picture
    By jcr in forum Qt Programming
    Replies: 1
    Last Post: 22nd June 2006, 06:38

Tags for this Thread

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.