Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Importing & Exporting
Posted:
Nov 11, 2012 1:57 PM
|
|
% I have to import images from 40 classes (directories) and each directory % has 7 images which is i called as subjects. then i need to make a vector % form of each image and then save it into linear array. % note my pictures is in grayscale which i will need to be in a linear % array. % Below I have written the code but it is giving me following error %??? Error using ==> imread at 374 %File "d:/ahsan/biometrics/imagedatabase/ATT/s1/1.PGM" does not exist.
%Error in ==> Pr4 at 15 %filename = imread( %sprintf('d:/ahsan/biometrics/imagedatabase/ATT/s%d/%d.PGM',i,k));
%start program clc clear all ;
class = 40 ; % We have 40 folders in our main directory. subjects = 7; % we have 7 images in our single directory.
for i = 1:class % this loop traverse all directories for k = 1:subjects % this loop traverse images in single directory filename = imread( sprintf('d:/ahsan/biometrics/imagedatabase/ATT/s%d/%d.PGM',i,k)); image = importdata (filename, '.PGM'); Y = ones(1,10); %Column array Y1 = filename; Y1= reshape(myfilename,1,[]); Y=Y1; end end %end program
|
|
|
|