function IMGDB = ucitajimg

lica_folder = 'lica\'; 
objekt_folder = 'objekt\'; 
file_ext = '.png';
out_max = 0.9;            
out_min = -0.9;       


if exist('imgdb.mat','file')
    load imgdb;
else
    IMGDB = cell (3,[]);
end
fprintf ('Ucitavanje lica ');
folder_content = dir ([lica_folder,'*',file_ext]);
nface = size (folder_content,1);
for k=1:nface
    string = [lica_folder,folder_content(k,1).name];
    image = imread(string);    
    [m n] = size(image);
    if (m~=27 || n~=18)
        continue;
    end
    f=0;
    for i=1:length(IMGDB)
        if strcmp(IMGDB{1,i},string)
            f=1;
        end
    end
    if f==1
        continue;
    end
    fprintf ('.');    
    IM {1} = im2vec (image);    
    IM {2} = im2vec (fliplr(image));     
    IM {3} = im2vec (circshift(image,1)); 
    IM {4} = im2vec (circshift(image,-1));
    IM {5} = im2vec (circshift(image,[0 1]));
    IM {6} = im2vec (circshift(image,[0 -1]));
    IM {7} = im2vec (circshift(fliplr(image),1));
    IM {8} = im2vec (circshift(fliplr(image),-1));
    IM {9} = im2vec (circshift(fliplr(image),[0 1]));
    IM {10} = im2vec (circshift(fliplr(image),[0 -1]));
    for i=1:10
        IMGDB {1,end+1}= string;
        IMGDB {2,end} = out_max;
        IMGDB (3,end) = {IM{i}};
    end    
end
fprintf ('\nUcitavanje objekata ');    
folder_content = dir ([objekt_folder,'*',file_ext]);
nnface = size (folder_content,1);
for k=1:nnface
    string = [objekt_folder,folder_content(k,1).name];
    image = imread(string);
    [m n] = size(image);
    if (m~=27 || n~=18)
        continue;
    end
    f=0;
    for i=1:length(IMGDB)
        if strcmp(IMGDB{1,i},string)
            f=1;
        end
    end
    if f==1
        continue;
    end    
    fprintf ('.');
    IM {1} = im2vec (image);
    IM {2} = im2vec (fliplr(image));
    IM {3} = im2vec (flipud(image));
    IM {4} = im2vec (flipud(fliplr(image)));    
    for i=1:4
        IMGDB {1,end+1}= string;
        IMGDB {2,end} = out_min;
        IMGDB (3,end) = {IM{i}};
    end    
end
fprintf('\n');
save imgdb IMGDB;