clc
clear all
tic

%test NOK kusu
imds = imageDatastore(fullfile('MDSkusy','KulatNOK'));
%test OK kusu
% imds = imageDatastore(fullfile('MDSkusy','KulatOK'));

dataFilenames = imds.Files;
nFiles = numel(dataFilenames);

%detekce jednotlivych vad
IsNOKscrew = NOKscrew(imds);
IsNOKparts= NOKparts(imds);
IsNOKholes = NOKholes(imds);

%kombinace vektoru s jednotlivymi vadami
IsNOK = IsNOKscrew + IsNOKparts + IsNOKholes;

%Pocet vadnych kusu
numberNOK = nnz(IsNOK)

%podil odhalenych NOK kusu
Final = numberNOK/nFiles
toc

%pocet jednotlivych odhalenych vad
testnumberscrew = nnz(IsNOKscrew)
testnumberparts = nnz(IsNOKparts)
testnumbersholes = nnz(IsNOKholes)

