MATLAB: Error Using zeros command

digital image processingerror using zeroszeros

Hello,
I am getting the following error:
  • _Error using zerosOut of memory. Type HELP MEMORY for your options.
Error in CT2 (line 26) sequence = zeros([size(I) numFrames],class(I));_ *
in the following section of the code (the first line is line 26):
_ sequence = zeros([size(I) numFrames],class(I)); sequence(:,:,1) = I; _
I have a 32 bit system with the following memory (which seems enough for 30 images each being 3001 x 3001 uint 16) info:
Maximum possible array: 505 MB (5.299e+008 bytes) Memory available for all arrays: 1380 MB (1.448e+009 bytes) * Memory used by MATLAB: 427 MB (4.477e+008 bytes) Physical Memory (RAM): 3292 MB (3.452e+009 bytes)
  • Limited by contiguous virtual address space available. Limited by virtual address space available.
Any work arounds or pointers?
Thanks,
—Ish

Best Answer

1. Work on smaller images, or ...
2. Work on fewer images, or ...
3. Migrate to a 64 bit version of MATLAB, or ...
4. Learn to work on one image at a time, reading and writing them from disk, or ...
5. Convert to uint8 images, cutting the memory required in half, at a cost of 8 low order bits.
There a really are no things you can do to make things tremendously easier unless you do one of the options I've offered above. Wanting to solve big problems requires sufficient memory.
Note that once you do choose a way to alleviate the memory problem, many users just start working on bigger problems, so it will not be long until you trip over the same issues unless you move to a 64 bit system. Even then you can still cause problems if you get too aggressive in the size of the problems you attack, as a 64 bit system will start throwing stuff onto disk using virtual memory. So the swap time could be an issue. Computers are not infinitely large or fast.