clear all;
clc;
close all;
if ~exist('gabor.mat','file')
    fprintf ('Generiranje Gaborovih filtara ...');
    stvori_gabor;
end
if exist('net.mat','file')
    load net;
else
    mreza
end
if exist('imgdb.mat','file')
    load imgdb;
else
    IMGDB = ucitajimg;
end
while (1==1)
    choice=menu('DETEKCIJA LICA',...
                'Kreiraj bazu podataka',...
                'Inicijaliziraj mrezu',...
                'Uhodaj neuronsku mrezu',...
                'Ucitaj testnu sliku',...
                'Exit');
    if (choice ==1)
        IMGDB = ucitajimg;
    end
    if (choice == 2)
        mreza
    end    
    if (choice == 3)
        net = uhodavanje(net,IMGDB);
    end
    if (choice == 4)
        [file_name file_path] = uigetfile ('*.jpg');
        if file_path ~= 0
            im = imread ([file_path,file_name]);
            try 
                im = rgb2gray(im);
            end 
            tic
            im_out = skeniraj (net,im);
            toc
            figure;imshow(im_out,'notruesize');
        end
    end
    if (choice == 5)
        clear all;
        clc;
        close all;
        return;
    end    
end