Opencv实现yuv420P格式的读取
最编程
2024-08-15 15:50:30
...
FILE *fs = NULL;
int iRet = fopen_s(&fs,"test_yuv420p_320x180.yuv", "rb");
if (0 != iRet)
{
return;
}
unsigned char pSrc[320 * 90 * 3] = { 0 };
int iLen = fread(pSrc, 1, 320 * 90 * 3, fs);
int pixel_h = 180;
int pixel_w = 320;
Mat yuv;
Mat m_color;
yuv.create(pixel_h * 3 / 2, pixel_w, CV_8UC1);
memcpy(yuv.data, pSrc, pixel_w * pixel_h * 3 / 2 * sizeof(unsigned char));
cvtColor(yuv, m_color, cv::COLOR_YUV2RGB_I420);
imshow("image", m_color);
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
推荐阅读
-
【Codecs】YUV主要格式YV12,I420,YUV420P的区别
-
重新渲染YUV420P格式的OpenGL
-
不同YUV格式的解读:YU12、I420、YV12、NV12、NV21、YUV420P、YUV420SP、YUV422P和YUV444P的差异解析
-
Opencv实现yuv420P格式的读取
-
两种方法将YUV420P文件转换为PNG图像格式的Python实现
-
RGB转换NV21(YUV的一种储存格式)(代码实现)
-
MediaCodec 实现高效解码,输出标准 YUV420P 格式帧
-
【音视频】解析yuv420p转化为rgb的原理及代码实现(第三部分. 代码)
-
使用OpenCV扩展模块中的TrackerKCF实现视频中的单一目标跟踪
-
win10 下的opencv3.2.0实现tracker常见问题----必要条件整理