没有合适的资源?快使用搜索试试~ 我知道了~
rgb转换成uyvy格式
5星 · 超过95%的资源 需积分: 50 20 下载量 107 浏览量
2018-01-31
14:42:27
上传
评论
收藏 3KB TXT 举报
温馨提示
试读
4页
VS 2013下,用opencv读入一张png格式图片,rgb转换成uyvy格式输出的源代码。
资源推荐
资源详情
资源评论
#include<iostream>
#include<stdio.h>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
// RGB2YUV
// pRGB point to the RGB data 指向RGB数据
// pYUV point to the YUV data 指向YUV数据
// width width of the picture 图像宽
// height height of the picture 图像高
// alphaYUV is there an alpha channel in YUV YUV的透明通道
// alphaRGB is there an alpha channel in RGB RGB的透明通道
int RGB2UYVY(unsigned char* pRGB, unsigned char* pYUV, int width, int height, bool alphaRGB)
{
if (NULL == pRGB)
{
return -1;
}
unsigned char* pRGBData = (unsigned char *)pRGB;
unsigned char* pYUVData = (unsigned char *)pYUV;
if (NULL == pYUVData)
{
pYUVData = new unsigned char[width*height * 2];
}
int R1, G1, B1, R2, G2, B2, Y1, U1, Y2, V1;
if (alphaRGB)
#include<stdio.h>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
// RGB2YUV
// pRGB point to the RGB data 指向RGB数据
// pYUV point to the YUV data 指向YUV数据
// width width of the picture 图像宽
// height height of the picture 图像高
// alphaYUV is there an alpha channel in YUV YUV的透明通道
// alphaRGB is there an alpha channel in RGB RGB的透明通道
int RGB2UYVY(unsigned char* pRGB, unsigned char* pYUV, int width, int height, bool alphaRGB)
{
if (NULL == pRGB)
{
return -1;
}
unsigned char* pRGBData = (unsigned char *)pRGB;
unsigned char* pYUVData = (unsigned char *)pYUV;
if (NULL == pYUVData)
{
pYUVData = new unsigned char[width*height * 2];
}
int R1, G1, B1, R2, G2, B2, Y1, U1, Y2, V1;
if (alphaRGB)
资源评论
- 柳鲲鹏2023-02-15很好。我改写了一下,支持RGB。阁下可将之定义为参数或者宏。
wo320721
- 粉丝: 4
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功