How to convert 'QVideoFrame' with YUV data to 'QVideoframe' with RGBA32 data in Qt?

前端 未结 3 1277
一个人的身影
一个人的身影 2021-01-15 13:33

I receive QVideoFrames from webcam, and they contain image data in YUV format (QVideoFrame::Format_YUV420P). How can I convert one

3条回答
  •  爱一瞬间的悲伤
    2021-01-15 14:07

    I've found a YUV --> RGB conversion solution in the linked comment,

    So Implementing the supportedPixelFormats function like the following example does the magic of converting even YUV based formats (in my case, it converted a Format_YUV420P format) into the Format_RGB24 format:

    QListMyVideoSurface::
    supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const
    {
        Q_UNUSED(handleType);
        return QList()
            << QVideoFrame::Format_RGB24
        ;
    }
    

    Tell me if it worked for you.

提交回复
热议问题