本文介绍了在matlab中加载多个图像tiff文件的最快方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个多图像tiff文件(例如3000帧),并希望将每个图像加载到matlab(我现在使用的是2010a)。但我发现随着帧的索引增加,读取图像需要更长的时间。以下是我现在使用的代码
I have a multiple image tiff file (3000 frames for example) and want to load the each image into matlab (I am using 2010a now). But I found it takes longer time to read images as the index of the frame increasing. The following is the code I am using now
for i=1:no_frame;
IM=imread('movie.tif',i);
IM=double(IM);
Movie{i}=IM;
end
还有其他方法可以更快地完成吗?
Is there any other way to do it faster?
推荐答案
为'信息'
参数说明以下内容:
The TIFF-specific syntax list for IMREAD says the following for the 'Info'
parameter:
结合,这应该可以加快速度:
Combined with the preallocation of the cell array suggested by Jonas, this should speed things up for you:
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
这篇关于在matlab中加载多个图像tiff文件的最快方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!