Download Untitled - Skemman

Transcript
SUNGLASS_CREATOR.M
classes = {'open', 'sunglasses'}
% the date will be collected into the variables:
X = []; Y = []; ell = 0;
% start in the directory containing only directory names
folders = dir;
% now go into each folder and grab the file names
for i = 3:length(folders), % ignore first two .. and .
% make sure its a directory
if folders(i).isdir,
cd(folders(i).name); % change directory
files = dir('*_4.pgm');
for j = 1:length(files),
% increment out image counter
ell = ell + 1;
% read the image
A = imread(files(j).name);
files(j).name
X(:,ell) = A(:);
% what class is this (part of file name)
for k=1:length(classes),
Y(k,ell) = 0.1;
if ~isempty(findstr(cell2mat(classes(k)),files(j).name)),
40