i am sending 4 images out of 108 images..please have a look how the images are stored with file names...
Al momento, stai seguendo questa domanda
- Vedrai gli aggiornamenti nel tuofeed del contenuto seguito.
- Potresti ricevere delle e-mail a seconda delle tuepreferenze per le comunicazioni.
How to load CASIA Iris Version V1 database images..
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Jyothi Alugolu
il 16 Mag 2017
that is not the question which i asked... i used recures.m file,but i am not getting all the subfolder images..
Risposta accettata
Walter Roberson
il 16 Mag 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 Commenti
Jyothi Alugolu
il 16 Mag 2017
Modificato: Walter Roberson
il 16 Mag 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
il 16 Mag 2017
Modificato: Walter Roberson
il 16 Mag 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
il 16 Mag 2017
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
il 16 Mag 2017
Modificato: Walter Roberson
il 16 Mag 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
il 16 Mag 2017
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
il 16 Mag 2017
I am not getting....Can you please send me the code clearly...
Walter Roberson
il 16 Mag 2017
projectdir = '$root path$';
dinfo = dir( fullfile(projectdir, '*.bmp') );
srcFiles = fullfile( projectdir, {dinfo.name} );
srcFiles = reshape(srcFiles, 7, []);
Walter Roberson
il 16 Mag 2017
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
il 17 Mag 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. 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
il 17 Mag 2017
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
il 18 Mag 2017
no, i am working in R2013a
Walter Roberson
il 18 Mag 2017
Modificato: Walter Roberson
il 18 Mag 2017
projectdir = '$root path$';
dinfo = subdir( fullfile(projectdir, '*', '*', '*', '*.bmp') );
srcFiles = reshape({dinfo.name}, 7, []);
Jyothi Alugolu
il 18 Mag 2017
Modificato: Walter Roberson
il 18 Mag 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
il 18 Mag 2017
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
il 18 Mag 2017
thank you..it worked...
monitor sky
il 2 Feb 2018
please i need project iris detection using artificial neural network
Walter Roberson
il 6 Feb 2018
Parul
il 29 Ott 2022
@Jyothi Alugolu can you please share the code for iris preprocessing on casia iris version 1 database
Più risposte (1)
Nimra Ibrar
il 9 Giu 2019
please i need code of iris recognization if any one help?
1 Commento
Walter Roberson
il 9 Giu 2019
Vedere anche
Categorie
Scopri di più su Environment and Settings in Help Center e File Exchange
Tag
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Si è verificato un errore
Impossibile completare l'azione a causa delle modifiche apportate alla pagina. Ricarica la pagina per vedere lo stato aggiornato.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- 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)
Asia-Pacifico
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)