PDA

View Full Version : The picture looks green with QImage



luochen601
26th July 2010, 11:08
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?

hobbyist
26th July 2010, 11:25
Perhaps your webcam produces BGR-frames? In that case try


mpLbl->setPixmap(QPixmap::fromImage(image.rgbSwapped()));

luochen601
26th July 2010, 11:37
Perhaps your webcam produces BGR-frames? In that case try


mpLbl->setPixmap(QPixmap::fromImage(image.rgbSwapped()));


That is the problem, it is OK now, thanks!