在matlab中加载多个图像tiff文件的最快方法是什么? [英] What is the fastest way to load multiple image tiff file in matlab?

查看:659
本文介绍了在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?

推荐答案

IMREAD的特定于TIFF的语法列表'信息'参数说明以下内容:

The TIFF-specific syntax list for IMREAD says the following for the 'Info' parameter:


从多图像
TIFF文件中读取图像时,传递
的输出 imfinfo 作为'Info'的值
参数有助于 imread 更快地找到文件中的
图片。

When reading images from a multi-image TIFF file, passing the output of imfinfo as the value of the 'Info' argument helps imread locate the images in the file more quickly.

结合 Jonas建议的单元阵列预分配,这应该可以加快速度:

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文件的最快方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆