|
Thanks Steven! Do you recommend a nested loop?
Best
"Steven_Lord" <slord@mathworks.com> wrote in message <jq2pqg$3lg$1@newscl01ah.mathworks.com>...
>
>
> "Z A" <nospam-rekabi570@yahoo.ca> wrote in message
> news:jq2o7p$p9o$1@newscl01ah.mathworks.com...
> > Hello
> > I am trying to track 36438 images. Each image is 128X512 an is unit8. A
> > binary image, background black and high intensity structures white.
> > I created the following code to read the images, following that I track
> > the structures:
> >
> > for i=1:36438
> > n=int2str(i);
> > a=strcat('frame',n,'.tif');
> > disp(a);
> > x=imread(a);
> > data(:,:,i)=x;
> > end
> >
> > save('video','data');
> >
> > It iterates from image1 to image6144 and then I get an error message
> > saying:
> > ??? Maximum variable size allowed by the program is exceeded. So I am
> > guessing it's a memory issue.
>
> Each image has this many elements:
>
> >> oneImage = 128*512
> oneImage =
> 65536
>
> All of them together would have:
>
> >> allImages = 36438*oneImage
> allImages =
> 2388000768
>
> If stored as uint8, they would require this much memory _in a contiguous
> block_:
>
> >> allMemoryBytes = 1*allImages
> allMemoryBytes =
> 2388000768
> >> allMemoryGB = allMemoryBytes/(1024^3)
> allMemoryGB =
> 2.2239990234375
>
> But I'm guessing that your x and data are actually being stored as double
> precision values, in which case they'd require:
>
> >> allMemoryBytes = 8*allImages
> allMemoryBytes =
> 19104006144
> >> allMemoryGB = allMemoryBytes/(1024^3)
> allMemoryGB =
> 17.7919921875
>
> If you're on a 32-bit system, you cannot have a contiguous block of memory
> that large.
>
> http://www.mathworks.com/help/matlab/matlab_prog/resolving-out-of-memory-errors.html
>
> Even on a 64-bit system, it's unlikely you'll have a contiguous block of
> memory that large due to fragmentation, unless your machine has a LOT of
> memory and you're not doing anything on it but using MATLAB.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com
|