在C中使用视频/图像文件

时间:2022-12-29 21:17:11

I'm trying to look through and find a way to annotate a video in C with polygons bounding boxes, however I'm stuck at a very elementary step.

我正在试图通过多边形边界框找到一种在C中注释视频的方法,但是我已经陷入了非常重要的一步。

Assuming I know how to break a .MPEG movie up into multiple JPEG images, how do I manipulate that file in C? The things I'll eventually need to draw on are text, points, and lines, but I am having a hard time figuring out how to get started with this.

假设我知道如何将.MPEG电影分解为多个JPEG图像,我该如何在C中操作该文件?我最终需要绘制的东西是文本,点和线,但我很难弄清楚如何开始使用它。

If I declare:

如果我宣布:

FILE* img = fopen('foo.jpeg', 'r');

then what could I do with img? Is there a way to access certain pixels in the drawing?

然后我可以用img做什么?有没有办法访问图纸中的某些像素?

1 个解决方案

#1


0  

What you did in your code sample is just opening a file. You didn't even read any data from it yet.

您在代码示例中所做的只是打开一个文件。你甚至没有读过它的任何数据。

The simplest way to load an image file is to use dedicated library, such as SOIL. If you weren't able to do it by yourself, however, I really don't think you will be able to accomplish your project goals - it is really advanced stuff you want to create, and you failed, as you already noticed, on the most basic of steps.

加载图像文件的最简单方法是使用专用库,例如​​SOIL。但是,如果你自己无法做到这一点,我真的不认为你能够完成你的项目目标 - 这是你想要创建的高级东西,而你已经注意到,你失败了最基本的步骤。

#1


0  

What you did in your code sample is just opening a file. You didn't even read any data from it yet.

您在代码示例中所做的只是打开一个文件。你甚至没有读过它的任何数据。

The simplest way to load an image file is to use dedicated library, such as SOIL. If you weren't able to do it by yourself, however, I really don't think you will be able to accomplish your project goals - it is really advanced stuff you want to create, and you failed, as you already noticed, on the most basic of steps.

加载图像文件的最简单方法是使用专用库,例如​​SOIL。但是,如果你自己无法做到这一点,我真的不认为你能够完成你的项目目标 - 这是你想要创建的高级东西,而你已经注意到,你失败了最基本的步骤。