首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在Qt中将YUV数据的“QVideoframe”转换为RGBA32数据的“QVideoframe”?

如何在Qt中将YUV数据的“QVideoframe”转换为RGBA32数据的“QVideoframe”?
EN

Stack Overflow用户
提问于 2017-03-29 23:42:37
回答 3查看 4.6K关注 0票数 2

我从网络摄像头接收QVideoFrames,它们包含YUV format (QVideoFrame::Format_YUV420P)格式的图像数据。如何将这样的帧转换为QVideoFrame::Format_ARGB32QVideoFrame::Format_RGBA32的帧?

我可以不使用Qt5中现有的功能,而不进行低级别的操作吗?

示例:

代码语言:javascript
运行
复制
QVideoFrame convertFormat(const QVideoFrame &inputframe, QVideoFrame::PixelFormat outputFormat)
{
    // What comes here?
}

//Usage
QVideoFrame converted = convertFormat(mySourceFrame, QVideoFrame::Format_RGB32);
EN

Stack Overflow用户

发布于 2017-03-29 23:56:26

https://doc.qt.io/qt-5/qvideoframe.html#map

代码语言:javascript
运行
复制
if (inputframe.map(QAbstractVideoBuffer::ReadOnly))
{
    int height = inputframe.height();
    int width = inputframe.width();
    uchar* bits = inputframe.bits();
    // figure out the inputFormat and outputFormat, they should be QImage::Format
    QImage image(bits, width, height, inputFormat);
    // do your conversion
    QImage outImage = image.convertToForma(outFormat); // blah convert
    return QVideoFrame(outImage);
}
票数 -2
EN
查看全部 3 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43106069

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档