Matlab:我的内存有限,有其他解决方案可以从视频中读取数据吗?

发布于 2024-11-17 08:24:44 字数 432 浏览 1 评论 0原文

我目前在使用 matlab 时遇到问题,当我尝试从视频中读取一些数据时,出现错误:

???内存不足,无法容纳 990 帧。

我有足够的内存来读取大约 100 帧左右。

我在标题中提到替代解决方案,因为我认为显而易见的答案是购买更多内存。还有其他方法可以读取这些帧并处理它们吗?例如,我认为也许我可以通过循环一次读入一帧并调整视频帧的大小以使用更少的内存(或者通过备用程序执行此操作)?该视频在 1024x1024 下非常占用内存。然而,通过缩小尺寸,我担心我会丢失视频中有价值的数据。

任何帮助将不胜感激!

预先感谢:)

ps。当前代码:

vid = VideoReader('video.avi');
frames = read(vid);

I am currently having a problem with matlab in that when I try and read in some data from a video I am presented with an error:

??? Not enough memory available for 990 frames.

I have enough memory available for reading about 100 frames or so.

I say alternate solutions in the title as I would assume the obvious answer would be to buy more memory. Are there any other ways of reading these frames and processing them? For example I thought that perhaps I may be able to read in a frame at a time via a loop and resize the video frame in order to use less memory (or do this via an alternate program)? The video is pretty memory intensive at 1024x1024. However by downscaling I am worried that I will be losing valuable data from the video.

Any help would be greatly appreciated!

Thanks in advance :)

ps. Current code:

vid = VideoReader('video.avi');
frames = read(vid);

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

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

发布评论

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

评论(1

白龙吟 2024-11-24 08:24:44

您可以通过给出索引来读取特定的帧,而不是将所有帧读入内存,如 文档

frames = read(vid); %# Read all
frames = read(vid, index); %# Read only the specified frames

例子

frames = read(vid, [1 50]); %# Read the first 50 frames

You can read spesific frame(s) by giving the indices instead of reading all of the frames into the memory as given in the documentation.

frames = read(vid); %# Read all
frames = read(vid, index); %# Read only the specified frames

Example

frames = read(vid, [1 50]); %# Read the first 50 frames
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文