我有原始图像缓冲区。我正在使用以下代码将其转换为jpeg:
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");
它正在捕获并将其转换为jpeg.but捕获的图像不正确。我附上了图片以供参考
和QImage tmpImage = QImage(raw_image,width,height,QImage :: Format_RGB16);形象是
for QImage tmpImage = QImage(raw_image,width,height,QImage :: Format_RGB444);
我如何获得正确的图像?提前谢谢。
答案 0 :(得分:2)
错误的色彩空间。
==> Format_RGB32
尝试: QVideoFrame :: Format_YUYV或 QVideoFrame :: Format_UYVY