Hi
I would like to know if there is a way to save many tiff images into a cell (or if there is something better) in MATLAB. The dimensions of each image is 2085x1811x3 and they are uint8. This is the current attempt below:
imgType = '*.tif';
[filename, pathname] = uigetfile(imgType,'Select the MATLAB code file');
images = dir([pathname imgType]);
Seq = cell(length(images),1);
for idx = 1:length(images)
Seq{idx} = imread([pathname images(idx).name]);
end
image_num = 1;
imshow(Seq(image_num))
It works but crashes eventually if run for 2000 images, is there any way to store all of that information? I need the 2D matrix of each image, none of them may be overwritten. If the 2085x1811x3 dimensions can be read in as 2085x1811x1 instead I think that would help? Colour doesn't matter, only interested in grayscale values.

 채택된 답변

Stephen23
Stephen23 2016년 6월 3일
편집: Stephen23 2016년 6월 3일

0 개 추천

Each image has size 2085x1811x3 and is stored with 3*eight bits per pixel, then each image requires 11 megabytes of memory. There are more than two thousand of them, so you will need at least 23 gigbytes of memory to store them all. Does your computer have twenty-three gigabytes of main memory? Remember that computer memory (RAM, etc) is NOT the same as the harddrive capacity!
If you only need the grayscale then the total reduces down to 7.6 GB.
If you do not have this much memory then you have two choices:
  1. Buy more memory.
  2. change your algorithm so that you do not need to store all of the data (e.g. process one image at a time, subsample/resize, etc).

댓글 수: 1

francis steyn
francis steyn 2016년 6월 3일
Thanks Stephen, didn't know how the memory usage is calculated. I'll change the algorithm then and just mention these limitations.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Convert Image Type에 대해 자세히 알아보기

질문:

2016년 6월 3일

편집:

2016년 6월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by