我有一个多图像 tiff 文件(例如 3000 帧)并且想将每个图像加载到 matlab 中(我现在使用的是 2010a)。但是我发现随着帧索引的增加,读取图像需要更长的时间。以下是我现在使用的代码
for i=1:no_frame;
IM=imread('movie.tif',i);
IM=double(IM);
Movie{i}=IM;
end
还有其他方法可以更快吗?
最佳答案
TIFF-specific syntax list for IMREAD 'Info'
参数如下:
When reading images from a multi-image TIFF file, passing the output of
imfinfo
as the value of the'Info'
argument helpsimread
locate the images in the file more quickly.
结合preallocation of the cell array suggested by Jonas ,这应该会加快你的速度:
fileName = 'movie.tif';
tiffInfo = imfinfo(fileName); %# Get the TIFF file information
no_frame = numel(tiffInfo); %# Get the number of images in the file
Movie = cell(no_frame,1); %# Preallocate the cell array
for iFrame = 1:no_frame
Movie{iFrame} = double(imread(fileName,'Index',iFrame,'Info',tiffInfo));
end
关于image - 在 matlab 中加载多个图像 tiff 文件的最快方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6157606/