QVideoFrame转QImage格式对照表

194 篇文章 107 订阅

主要为通过查询QVideoFrame::imageFormatFromPixelFormat接口获得QImage格式对照表。

对照表

  • Format_ARGB32
  • Format_ARGB32_Premultiplied
  • Format_RGB32
  • Format_RGB24
  • Format_RGB565
  • Format_RGB555
  • Format_ARGB8565_Premultiplied
  • Format_BGRA32
  • Format_BGRA32_Premultiplied
  • Format_BGR32
  • Format_BGR24
  • Format_BGR565
  • Format_BGR555
  • Format_BGRA5658_Premultiplied
  • Format_AYUV444
  • Format_AYUV444_Premultiplied
  • Format_YUV444
  • Format_YUV420P
  • Format_YV12
  • Format_UYVY
  • Format_YUYV
  • Format_NV12
  • Format_NV21
  • Format_IMC1
  • Format_IMC2
  • Format_IMC3
  • Format_IMC4
  • Format_Y8
  • Format_Y16
  • Format_Jpeg
  • Format_CameraRaw
  • Format_AdobeDng
  • NPixelFormats
  • Format_User

判断代码

#include <QApplication>
#include <QVideoFrame>
#include <QDebug>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QList<QImage::Format> imageFormats = {
        QImage::Format_Invalid,
        QImage::Format_Mono,
        QImage::Format_MonoLSB,
        QImage::Format_Indexed8,
        QImage::Format_RGB32,
        QImage::Format_ARGB32,
        QImage::Format_ARGB32_Premultiplied,
        QImage::Format_RGB16,
        QImage::Format_ARGB8565_Premultiplied,
        QImage::Format_RGB666,
        QImage::Format_ARGB6666_Premultiplied,
        QImage::Format_RGB555,
        QImage::Format_ARGB8555_Premultiplied,
        QImage::Format_RGB888,
        QImage::Format_RGB444,
        QImage::Format_ARGB4444_Premultiplied,
        QImage::Format_RGBX8888,
        QImage::Format_RGBA8888,
        QImage::Format_RGBA8888_Premultiplied,
        QImage::Format_BGR30,
        QImage::Format_A2BGR30_Premultiplied,
        QImage::Format_RGB30,
        QImage::Format_A2RGB30_Premultiplied,
        QImage::Format_Alpha8,
        QImage::Format_Grayscale8,
        QImage::NImageFormats
    };

    QList<QVideoFrame::PixelFormat> pixelFormats = {
        QVideoFrame::Format_Invalid,
        QVideoFrame::Format_ARGB32,
        QVideoFrame::Format_ARGB32_Premultiplied,
        QVideoFrame::Format_RGB32,
        QVideoFrame::Format_RGB24,
        QVideoFrame::Format_RGB565,
        QVideoFrame::Format_RGB555,
        QVideoFrame::Format_ARGB8565_Premultiplied,
        QVideoFrame::Format_BGRA32,
        QVideoFrame::Format_BGRA32_Premultiplied,
        QVideoFrame::Format_BGR32,
        QVideoFrame::Format_BGR24,
        QVideoFrame::Format_BGR565,
        QVideoFrame::Format_BGR555,
        QVideoFrame::Format_BGRA5658_Premultiplied,

        QVideoFrame::Format_AYUV444,
        QVideoFrame::Format_AYUV444_Premultiplied,
        QVideoFrame::Format_YUV444,
        QVideoFrame::Format_YUV420P,
        QVideoFrame::Format_YV12,
        QVideoFrame::Format_UYVY,
        QVideoFrame::Format_YUYV,
        QVideoFrame::Format_NV12,
        QVideoFrame::Format_NV21,
        QVideoFrame::Format_IMC1,
        QVideoFrame::Format_IMC2,
        QVideoFrame::Format_IMC3,
        QVideoFrame::Format_IMC4,
        QVideoFrame::Format_Y8,
        QVideoFrame::Format_Y16,

        QVideoFrame::Format_Jpeg,

        QVideoFrame::Format_CameraRaw,
        QVideoFrame::Format_AdobeDng,

        QVideoFrame::NPixelFormats,
        QVideoFrame::Format_User
    };

    for (int i = 0 ; i < pixelFormats.count(); i++) {
        QImage::Format format = QVideoFrame::imageFormatFromPixelFormat(pixelFormats.at(i));
        qDebug()<<"|"<<pixelFormats.at(i)<<"|"<<(format ? "YES" : "NO")<<"|";
    }

    return app.exec();
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值