Not enough memory for splitting video into frames

I want to split a video clip into frames. The clip I used has 2040 frames, and when I run the code to split video into frames it gives an error saying there isn't enough memory for 2040 frames. Can anyone please tell me what the problem is? Has it got anything to do with the computer's RAM? I have 2GB

 採用された回答

Walter Roberson
Walter Roberson 2014 年 1 月 25 日

0 投票

Yes, the problem is likely the RAM. What is the height and width of each frame? Is the frame color or greyscale ? Is the datatype uint8 (values in the range 0 to 255) or double (values in the range 0 to 1) ?

4 件のコメント

Sneheet
Sneheet 2014 年 1 月 26 日
Video Parameters: 23.98 frames per second, RGB24 640x272. 2040 total video frames available.
Walter Roberson
Walter Roberson 2014 年 1 月 26 日
A video that size requires just over 1 gigabyte of memory to store. As you only have 2 GB memory and need some of that for the operating system and need some for MATLAB itself, you will not have 1 gigabyte of free memory to store the video in.
What are you planning to do with the frames once you have separated them out? If the plan is to write them to individual image files, then you can do that one frame at a time instead of reading the whole video into memory first.
Sneheet
Sneheet 2014 年 1 月 27 日
Once I've separated the frames, I want to find the difference between 2 consecutive frames. If the difference is below a threshold,then discard the previous frame. Else save the frames, then convert them into a single video.
My aim is to remove those frames which do not contain any motion. What do you suggest?
Image Analyst
Image Analyst 2014 年 1 月 27 日
I suggest you look at my answer. Evidently you did not because it does the differencing you're asking for, and it would be an easy addition to keep track of what frame has little motion detected and to not write those out.

サインインしてコメントする。

その他の回答 (2 件)

vijay sai
vijay sai 2014 年 1 月 26 日

0 投票

yes, as walter said the problem is with RAM, u could process the same by resizing the video to a reduced resolution....
Image Analyst
Image Analyst 2014 年 1 月 26 日

0 投票

See my demo. It does that. No memory problem because it only reads in and processes one frame at a time.

1 件のコメント

Sneheet
Sneheet 2014 年 1 月 30 日
ok Image Analyst, I saw your code. It works. Thanks. Now I need to read 2 consecutive frames in a loop. How do I do that? I mean how do I refer to those frames in the loop?

サインインしてコメントする。

質問済み:

2014 年 1 月 25 日

コメント済み:

2014 年 1 月 30 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by