i am sending 4 images out of 108 images..please have a look how the images are stored with file names...
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
How to load CASIA Iris Version V1 database images..
4 ビュー (過去 30 日間)
古いコメントを表示
Jyothi Alugolu
2017 年 5 月 16 日
Hello, CASIA Iris Image Database Version 1.0 (CASIA-IrisV1) includes 756 iris images from 108 eyes. For each eye, 7 images are captured in two folders...totally there are 108 folders(eyes) and each folder contains 2 sub-folders by name 1 (right eye) and 2 (left eye)..1st sub-folder contains 3 images and 2nd sub-folder contains 4 images... How can i load all the images from all the folders and sub-folders?
4 件のコメント
KSSV
2017 年 5 月 16 日
Jyothi Alugolu
2017 年 5 月 16 日
that is not the question which i asked... i used recures.m file,but i am not getting all the subfolder images..
KSSV
2017 年 5 月 16 日
How your question of accessing images in sub folders/ folders is different from what given in the link?
採用された回答
Walter Roberson
2017 年 5 月 16 日
https://www.mathworks.com/help/vision/ref/imageset-class.html
imgSetVector = imageSet(imgFolder,'recursive')
Or you could create an imageDatastore, and use it; see for example https://www.mathworks.com/help/matlab/import_export/read-and-analyze-image-files.html
18 件のコメント
Jyothi Alugolu
2017 年 5 月 16 日
編集済み: Walter Roberson
2017 年 5 月 16 日
The images of CASIA-IrisV1 are stored as:
$root path$/XXX_S_Y.bmp
XXX: the unique identifier of eye, range from 000 to 108.
S: the index of session, denotes the first session and the second session.
Y: the index of image in the same session. Range from 1 to 3 in the first session, 1 to 4 in the second session.
Therefore XXX_S_Y:bmp means the iris image with index Y in session S from eye XXX.
Jyothi Alugolu
2017 年 5 月 16 日
編集済み: Walter Roberson
2017 年 5 月 16 日
i tried something like this:
close all;
clc;
count=0;
% the folder in which ur images exists
adata(1).f='00';
adata(2).f='0';
for i=1:108
for k=1:4
for j=1:2
if(i<10)
input=strcat('C:\Users\admin\Desktop\Databases\Iris\CASIA-IrisV1\CASIA Iris Image Database (version 1.0)\',[adata(1).f,num2str(i)],'\',num2str(j),'\',[adata(1).f,num2str(i)],'_',num2str(j),'_',num2str(k),'*.bmp');
kk=strcat('C:\Users\admin\Desktop\Databases\Iris\CASIA-IrisV1\CASIA Iris Image Database (version 1.0)\',[adata(1).f,num2str(i)],'\',num2str(j),'\',[adata(1).f,num2str(i)],'_',num2str(j),'_',num2str(k));
elseif(i>=10 && i<=99)
input=strcat('C:\Users\admin\Desktop\Databases\Iris\CASIA-IrisV1\CASIA Iris Image Database (version 1.0)\',[adata(2).f,num2str(i)],'\',num2str(j),'\',[adata(2).f,num2str(i)],'_',num2str(j),'_',num2str(k),'*.bmp');
kk=strcat('C:\Users\admin\Desktop\Databases\Iris\CASIA-IrisV1\CASIA Iris Image Database (version 1.0)\',[adata(2).f,num2str(i)],'\',num2str(j),'\',[adata(2).f,num2str(i)],'_',num2str(j),'_',num2str(k));
else
input=strcat('C:\Users\admin\Desktop\Databases\Iris\CASIA-IrisV1\CASIA Iris Image Database (version 1.0)\',num2str(i),'\',num2str(j),'\',num2str(i),'_',num2str(j),'_',num2str(k),'*.bmp');
kk=strcat('C:\Users\admin\Desktop\Databases\Iris\CASIA-IrisV1\CASIA Iris Image Database (version 1.0)\',num2str(i),'\',num2str(j),'\',num2str(i),'_',num2str(j),'_',num2str(k));
end
end
end
end
srcFiles = dir(input);
p=length(srcFiles);
Walter Roberson
2017 年 5 月 16 日
projectdir = '$root path$';
dinfo = dir( fullfile(projectdir, '*.bmp') );
srcFiles = fullfile( projectdir, {dinfo.name} );
Unless, that is, there are other bmp files in the same directory. If there are other .bmp files in the same directory then,
projectdir = '$root path$';
dinfo = dir( fullfile(projectdir, '*.bmp') );
filenames = {dinfo.name};
matchpos = regexp(filenames, '^[01]\d\d_[12]_[1-4]\.bmp$');
wrong_file = cellfun( @isempty, matchpos );
filenames(wrong_file) = [];
srcFiles = fullfile(projectdir, filenames);
Jyothi Alugolu
2017 年 5 月 16 日
編集済み: Walter Roberson
2017 年 5 月 16 日
i tried using recurse.m ...
code:
clc; % Clear the command window.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
start_path = fullfile(matlabroot, 'bin');
%Ask user to confirm or change.
topLevelFolder = uigetdir(start_path);
if topLevelFolder == 0
return;
end
%Get list of all subfolders.
allSubFolders = genpath(topLevelFolder);
%Parse into a cell array.
remain = allSubFolders;
listOfFolderNames = {};
while true
[singleSubFolder, remain] = strtok(remain, ';');
if isempty(singleSubFolder)
break;
end
listOfFolderNames = [listOfFolderNames singleSubFolder];
end
numberOfFolders = length(listOfFolderNames);
%Process all image files in those folders.
for k = 1 : numberOfFolders
%Get this folder and print it out.
thisFolder = listOfFolderNames{k};
fprintf('Processing folder %s\n', thisFolder);
filePattern = sprintf('%s/*.bmp', thisFolder);
baseFileNames = dir(filePattern);
aa=natsortfiles({baseFileNames.name});
numberOfImageFiles = length(aa);
%Now we have a list of all files in this folder.
if numberOfImageFiles >= 1
% Go through all those image files.
for f = 1 : numel(aa) %%here aa is being 4 because 108th user 2nd folder contains 4 images
M1{f} = [imread(fullFileName)]; %%only 4 images are being stored..
fullFileName = fullfile(thisFolder,aa{f});
end
fprintf('\nProcessing image file %s\n', fullFileName);
end
fprintf('Folder %s has no image files in it.\n', thisFolder);
end
In the above code, variable aa is storing last user 2nd folder images and those images are being return by variable M..
But what i want is...108 folders with 7 images...so,finally M must have 756 images..(because 108 * 7 = 756);...
Walter Roberson
2017 年 5 月 16 日
In the file structure you described, you only have one folder, not 108 folders.
If your files are all in the same folder, then after using the code I gave, after the line
srcFiles = fullfile(projectdir, filenames);
you can use
srcFiles = reshape(srcFiles, 7, []);
and then you would have a 7 x 108 cell array of strings that were file names.
Walter Roberson
2017 年 5 月 16 日
projectdir = '$root path$';
dinfo = dir( fullfile(projectdir, '*.bmp') );
srcFiles = fullfile( projectdir, {dinfo.name} );
srcFiles = reshape(srcFiles, 7, []);
Walter Roberson
2017 年 5 月 16 日
You would need to replace '$root path$' with the actual directory name. I copied that from your statement
$root path$/XXX_S_Y.bmp
This code will not be sufficient if your files are in folders. For example are your files really of the form
$root path$/XXX/S/Y.bmp
?
Jyothi Alugolu
2017 年 5 月 17 日
The images of CASIA-IrisV1 are stored as: $root path$/XXX_S_Y.bmp XXX: the unique identifier of eye, range from 000 to 108. S: the index of session, denotes the first session and the second session. Y: the index of image in the same session. Range from 1 to 3 in the first session, 1 to 4 in the second session. Therefore XXX_S_Y:bmp means the iris image with index Y in session S from eye XXX. XXX=000:108 (t0tally 108 folders) And if S=1,THEN Y=1:3 (1st sub-folder i.e if S=1, then it contains 3 images If S=2, Then Y=1:4 (2nd Sub-folder i.e if S=2, then it contains 4 images).. so for a folder there will be 7 images(3 images in 1st subfolder and 4 images in 2nd subfolder)... Totally 108 folders..so there will be 108 * 7= 756 images from the database..i want load all those images and store in a cell array... I am sending you zip code with some images
Walter Roberson
2017 年 5 月 17 日
Assuming that you have R2016b or later:
projectdir = '$root path$';
dinfo = dir( fullfile(projectdir, '*', '*', '*', '*.bmp') );
srcFiles = fullfile( {dinfo.folder}, {dinfo.name} );
srcFiles = reshape(srcFiles, 7, []);
Walter Roberson
2017 年 5 月 18 日
編集済み: Walter Roberson
2017 年 5 月 18 日
projectdir = '$root path$';
dinfo = subdir( fullfile(projectdir, '*', '*', '*', '*.bmp') );
srcFiles = reshape({dinfo.name}, 7, []);
Jyothi Alugolu
2017 年 5 月 18 日
編集済み: Walter Roberson
2017 年 5 月 18 日
while running your code:
projectdir = 'C:\Users\admin\Desktop\Databases\Iris\CASIA-IrisV1\CASIA Iris Image Database (version 1.0)'; %%folder path
dinfo = subdir( fullfile(projectdir, '*', '*', '*', '*.bmp') );
srcFiles = reshape({dinfo.name}, 7, []);
i am having error:
Error using subdir (line 79)
Folder (C:\Users\admin\Desktop\Databases\Iris\CASIA-IrisV1\CASIA Iris Image Database (version 1.0)\*\*\*) not
found
Error in GOT1 (line 2)
dinfo = subdir( fullfile(projectdir, '*', '*','*', '*.bmp') );
Walter Roberson
2017 年 5 月 18 日
projectdir = 'C:\Users\admin\Desktop\Databases\Iris\CASIA-IrisV1\CASIA Iris Image Database (version 1.0)'; %%folder path
paths_to_process = {projectdir};
srcFiles = {};
while ~isempty(paths_to_process)
this_path = paths_to_process{1};
paths_to_process(1) = [];
img_info = dir( fullfile(this_path, '*.bmp') );
these_images = fullfile( this_path, {img_info.name} );
srcFiles = [srcFiles; these_images(:)];
dir_info = dir( this_path );
dir_info( ~[dir_info.isdir] ) = [];
dir_info( ismember( {dir_info.name}, {'.', '..'} ) ) = [];
if ~isempty(dir_info)
these_folders = fullfile( this_path, {dir_info.name} );
paths_to_process = [paths_to_process; these_folders(:)];
end
end
num_files = length(srcFiles);
basenames = cell(num_files,1);
for K = 1 : num_files
[~, basenames{K}, ~] = fileparts(srcFiles{K});
end
[~, sortidx] = sort(basenames);
srcFiles = srcFiles(sortidx);
srcFiles = reshape(srcFiles, 7, []);
Walter Roberson
2018 年 2 月 6 日
Parul
2022 年 10 月 29 日
@Jyothi Alugolu can you please share the code for iris preprocessing on casia iris version 1 database
その他の回答 (1 件)
Nimra Ibrar
2019 年 6 月 9 日
please i need code of iris recognization if any one help?
1 件のコメント
Walter Roberson
2019 年 6 月 9 日
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)