1

我的问题我的图像文件夹组织为

数据库 -> CASIA Iris Image Database (version 1.0) -> folder001(这个文件夹从 001 更改为 108) -> previouse 文件夹包含两个文件夹,每个文件夹包含 3 个图像

文件夹的结构为

http://imageshack.us/photo/my-images/337/picture1ki.png/

我如何在 MATLAB 中阅读 CASIA V1.0 1?

4

1 回答 1

1

以下是文件夹中任意数量图像的通用代码。如果您确定每个文件夹有 3 个图像并且您知道每个文件夹的文件名格式,则可以简化它。

%# Set the relative path for the database
basePath = 'Database/CASIA Iris Image Database (version 1.0)/';

for iFolder = 1:108
    %# Set current folder
    folder = sprintf('%s%03d/', basePath, iFolder);

    %# Find the image (e.g. bmp) files in the folder. Modify bmp for your needs.
    %#   and also modify 'left' string according to the subfolder of left images
    filenames = arrayfun(@(x) x.name, dir([folder 'left/*.bmp']),'UniformOutput',false);

    for iFile = 1:length(filenames)
        img = imread([folder filenames{iFile}]);

        %# and process the image
        %# ...

    end

    %# Modify the code for to run it for right folder
    %# ...
end
于 2012-05-16T12:47:37.297 回答