用C读取YUV图像

发布于 2024-10-05 02:46:06 字数 78 浏览 0 评论 0原文

  1. 如何读取任何yuv图像?

  2. 如何传递 YUV 图像的尺寸以读取缓冲区?

  1. How to read any yuv image?

  2. How can the dimensions of an YUV image be passed for reading to a buffer?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雄赳赳气昂昂 2024-10-12 02:46:06
  1. 通常,当人们谈论 YUV 时,他们谈论的是 YUV 4 :2:0。您对任何 YUV 图像的引用都会产生误导,因为有多种不同的格式,并且每种格式的处理方式都不同。例如,原始 YUV 4:2:0(按照惯例,扩展名为 .yuv 的文件)不包含任何尺寸数据;而 y4m 文件通常会这样做。因此,在开始阅读之前,您确实需要知道您正在处理的图像类型。对于 YUV 4:2:0,您只需打开文件并按顺序读取亮度 (Y') 和色度 (CbCr) 分量,请记住色度分量已被抽取(亮度分量的四分之一大小)。之后,您通常将 Y'CbCr 转换为 RGB,以便可以显示图像。

  2. 根据我上面提到的,您根本无法确定任何 YUV 图像的尺寸。通常,尺寸根本不在文件中。你必须预先了解它们——这就是为什么大多数 列出供下载的 YU​​V 文件的站点还列出了其帧尺寸(对于视频,还列出了帧尺寸)帧)。大多数 YUV 文件都是 CIF (352x288) 或 QCIF (176x144),但也有一些从模拟视频数字化的文件的 SIF 格式略有不同。 此处了解不同的格式。

  1. Usually, when people talk about YUV they talk about YUV 4:2:0. Your reference to any YUV image is misleading, because there are a number of different formats, and each is handled differently. For example, raw YUV 4:2:0 (by convention, files with an extension .yuv) doesn't contain any dimension data; whereas y4m files typically do. So you really need to know what sort of image you're dealing with before you start reading it. For YUV 4:2:0, you just open the file and read the luminance (Y') and chrominance (CbCr) components in that order, keeping in mind the chrominance components have been decimated (quarter size of the luminance components). After that you typically convert Y'CbCr to RGB so you can display the image.

  2. From what I've mentioned above, you simply can't determine the dimensions of any YUV image. Often, the dimensions are simply not in the file. You have to know them up front -- this is why most sites listing YUV files for download also list their frame dimensions (and for video, the number of frames). Most YUV files are either CIF (352x288) or QCIF (176x144), although there are some files digitized from analog video that are in the slightly different SIF format. Read about the different formats here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文