i am sending 4 images out of 108 images..please have a look how the images are stored with file names...
Sie verfolgen jetzt diese Frage
- Aktualisierungen können Sie in Ihrem Feed verfolgter Inhalte sehen.
- Je nach Ihren Kommunikationseinstellungen können Sie auch E-Mails erhalten.
How to load CASIA Iris Version V1 database images..
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Jyothi Alugolu
am 16 Mai 2017
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
KSSV
am 16 Mai 2017
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
Jyothi Alugolu
am 16 Mai 2017
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
that is not the question which i asked... i used recures.m file,but i am not getting all the subfolder images..
KSSV
am 16 Mai 2017
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
How your question of accessing images in sub folders/ folders is different from what given in the link?
Akzeptierte Antwort
Walter Roberson
am 16 Mai 2017
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 Kommentare
Jyothi Alugolu
am 16 Mai 2017
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
Bearbeitet: Walter Roberson
am 16 Mai 2017
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
am 16 Mai 2017
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
Bearbeitet: Walter Roberson
am 16 Mai 2017
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
am 16 Mai 2017
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
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
am 16 Mai 2017
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
Bearbeitet: Walter Roberson
am 16 Mai 2017
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
am 16 Mai 2017
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
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.
Jyothi Alugolu
am 16 Mai 2017
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
I am not getting....Can you please send me the code clearly...
Walter Roberson
am 16 Mai 2017
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
projectdir = '$root path$';
dinfo = dir( fullfile(projectdir, '*.bmp') );
srcFiles = fullfile( projectdir, {dinfo.name} );
srcFiles = reshape(srcFiles, 7, []);
Walter Roberson
am 16 Mai 2017
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
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
am 17 Mai 2017
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
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
am 17 Mai 2017
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
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, []);
Jyothi Alugolu
am 18 Mai 2017
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
no, i am working in R2013a
Walter Roberson
am 18 Mai 2017
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
Bearbeitet: Walter Roberson
am 18 Mai 2017
projectdir = '$root path$';
dinfo = subdir( fullfile(projectdir, '*', '*', '*', '*.bmp') );
srcFiles = reshape({dinfo.name}, 7, []);
Jyothi Alugolu
am 18 Mai 2017
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
Bearbeitet: Walter Roberson
am 18 Mai 2017
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
am 18 Mai 2017
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
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, []);
Jyothi Alugolu
am 18 Mai 2017
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
thank you..it worked...
monitor sky
am 2 Feb. 2018
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
please i need project iris detection using artificial neural network
Walter Roberson
am 6 Feb. 2018
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
Parul
am 29 Okt. 2022
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
@Jyothi Alugolu can you please share the code for iris preprocessing on casia iris version 1 database
Weitere Antworten (1)
Nimra Ibrar
am 9 Jun. 2019
please i need code of iris recognization if any one help?
1 Kommentar
Walter Roberson
am 9 Jun. 2019
⋮
-
Verknüpfen
Direkter Link zu diesem Kommentar
Siehe auch
Kategorien
Mehr zu Environment and Settings finden Sie in Help Center und File Exchange
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Es ist ein Fehler aufgetreten
Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)
Asien-Pazifik
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)