How to read large tiff or img file?
Show older comments
My files are huge with [12200,5010] rows and column. I read them in the following format:
fid=fopen('lc60_4.img','r'); LU=fread(fid,[12200,5010]); fclose(fid)
LA=imread('lai4_240.tif');
As I have 8 image to read matlab cant handle this. How can I solve this problem? Thanks
Accepted Answer
More Answers (1)
Image Analyst
on 11 Apr 2015
0 votes
Don't have them all in memory at one time. Just process one image at a time.
One file is not really all that huge. If it's a uint8 image, that's about 61 MB - about the size of a typical color digital photo. Eight of them is getting up there particularly if you're using some other temporary images along the way. You might use clear() to delete any scratch/temporary variables as soon as you're done with them to free up memory.
4 Comments
Hana
on 11 Apr 2015
Image Analyst
on 11 Apr 2015
Then read this or get more RAM memory in your computer. Or else subsample your images. There's a good chance you can do what you need to do (find areas of blobs or whatever) using smaller versions of the images.
Hana
on 11 Apr 2015
Image Analyst
on 11 Apr 2015
Yes, but when I suggested to read them image by image you said no. So if image by image is no good, then how is line by line going to work?
Categories
Find more on Convert Image Type in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!