Hi, I'm trying to create a QImage from a QVideoFrame but my video has YUV420P format so converting it's not easy for me at all. By using a snippet from histogram class from the player example provided by Qt I was able to read each pixel on the frame but my question is: who can I decompose Y, Cb and Cr values from a single uchar? This is how to I'm iterating over the video frame bits. if (videoFrame.pixelFormat() == QVideoFrame::Format_YUV420P) { QImage nImage(videoFrame.width(), videoFrame.height(), QImage::Format_RGB32); uchar *b = videoFrame.bits(); for (int y = 0; y < videoFrame.height(); y++) { uchar *lastPixel = b + videoFrame.width(); int wIndex = 0; for (uchar *curPixel = b; curPixel < lastPixel; curPixel++) { double y_ = *curPixel;???????? double u_ = ???????????; double v_ = ???????????;
r = y_ + 1.402 * v_; g = y_ - 0.344 * u_ - 0.714 * v_; b = y_ + u_ * 1.772; nImage.setPixel(wIndex, y, qRgb(int(r), int(g), int(b))); ++wIndex; } b += videoFrame.bytesPerLine(); } return nImage; } ________________________________________________________________________________________________ I Conferencia CientÃfica Internacional UCIENCIA 2014 en la UCI del 24 al 26 de abril de 2014, La Habana, Cuba. Ver http://uciencia.uci.cu
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest