matlab 读取同一文件中所有图像_我如何从Matlab中的多个文件夹读取图像?

My question I have folder of image organized as

Database -> CASIA Iris Image Database (version 1.0) -> folder001(this folder change to 001to 108) -> previouse folder contains two folder each of them contains 3 images

the structure of folder as

how i can read CASIA V1.0 1 IN MATLAB?

解决方案

Below is a generic code for any number of images in a folder. You can simplify it if you are sure to have 3 images per folder and you know the filename format for each.

%# 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值