Sei sulla pagina 1di 1

% Sobel edge detector result comparator

% Copyright(c) 2004, University of Waterloo, F. Khalvati


clear all;
hlmdir1=load('hlm1.dir'); %HLM dir result
refdir1=load('test1.dir'); %Reference model dir result
dim=256;
direrror=0;
flag=0;
idir=0;
jdir=0;
for i=1:dim
for j=1:dim
if hlmdir1(i,j)~=refdir1(i,j)
direrror=direrror+1; % error in direction
if flag==0
idir=i;
%index of first error in dir
jdir=j;
%index of first error in dir
flag=1;
end;
end;
end;
end;

hlmedge1=load('hlm1.edg'); %HLM edge result


refedge1=load('test1.edg');%Reference model edge result
edgerror=0;
iedge=0;
jedge=0;
for i=1:dim
for j=1:dim
if hlmedge1(i,j)~=refedge1(i,j)
edgerror=edgerror+1; % error in edge
if flag==0
iedge=i;
%index of first error in edge
jedge=j;
%index of first error in edge
flag=1;
end;
end;
end;
end;
direrror
idir
jdir
edgerror
iedge
jedge