Domanda

i have raw image buffer. i am converting it into jpeg using following code:

  height = 240;
  width = 320;
raw_image=capture(width, height);//(c code uvc capture)
        QImage tmpImage = QImage(raw_image, width, height, QImage::Format_RGB32 ); //image.format=RGB888
        QByteArray im;
QBuffer bufferJpeg(&im);
bufferJpeg.open(QIODevice::WriteOnly);
tmpImage.save(&bufferJpeg, "JPG");
 tmpImage.save("image1.jpg","JPG");

it is capturing and converting it into jpeg.but the captured image is not proper. i have attached the image for reference

enter image description here

and for QImage tmpImage = QImage(raw_image, width, height, QImage::Format_RGB16 ); image is enter image description here

for QImage tmpImage = QImage(raw_image, width, height, QImage::Format_RGB444); enter image description here

How can i get the proper image? thanks in advance.

È stato utile?

Soluzione

wrong color space.

==> Format_RGB32

Try: QVideoFrame::Format_YUYV or QVideoFrame::Format_UYVY

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top