Code covered by the BSD License

by

### Heuve (view profile)

This program can read Aztec barcode from video or pictures. It is partial in Dutch

[snijden H1 V1]=bijsnijden(B,x,y,afstand)
```function [snijden H1 V1]=bijsnijden(B,x,y,afstand)

afstand=afstand*5;
snijden=[1 y 1 x];
p=1;

H=[(std(B))' (max(B))' (min(B))' (fft(B))'];
V=[std(B,1,2) max(B,[],2) min(B,[],2) fft(B,[],2)];
Hg=mean(H);
Vg=mean(V);
H1=sum([(H(:,1)-Hg(1))/Hg(1) (H(:,2)-Hg(2))/Hg(2) (H(:,3)-Hg(3))/(-Hg(3)) (H(:,4)-Hg(4))/(-Hg(4))],2);
V1=sum([(V(:,1)-Vg(1))/Vg(1) (V(:,2)-Vg(2))/Vg(2) (V(:,3)-Vg(3))/(-Vg(3)) (V(:,4)-Vg(4))/(-Vg(4))],2);

check=0; a=1; teller=0;
while (((teller<(p-0.9)) || (check<afstand)) && a<y*0.5)
if V1(a)>(0)
if check==0
teller=0;
end
teller=teller+V1(a);
check=check+1;
elseif (teller<(-7)) || (V1(a)<(-0.5))
check=0;
teller=0;
elseif check>=1
check=check+1;
teller=teller+V1(a);
end
%test=[teller check a V1(a)]
a=a+1;

end

if a<y*0.4 && (a-check)>afstand/3
snijden(1)=a-check;
end

check=0; a=y; teller=0;
while (teller<p || check<afstand) && a>y*0.6
if V1(a)>0
if check==0
teller=0;
end
teller=teller+V1(a);
check=check+1;
elseif (teller<(-2)) || (V1(a)<(-0.5))
check=0;
teller=0;
elseif check>=1
check=check+1;
teller=teller+V1(a);
end
a=a-1;
end

if a>y*0.6
snijden(2)=a+check;
end

check=0; a=1;  teller=0;
while (teller<p || check<afstand*5) && a<x*0.7
if H1(a)>(-0.2)
if check==0
teller=0;
end
teller=teller+H1(a);
check=check+1;
elseif (teller<(-7)) || (H1(a)<(-0.5))
check=0;
teller=0;
elseif check>=1
check=check+1;
teller=teller+H1(a);
end
a=a+1;
%test=[teller check a H1(a-1)]
end

if a<x*0.7 && (a-check)>afstand/3
snijden(3)=a-check;
end

check=0; a=x;  teller=0;
while (teller<p || check<afstand*5) && a>x*0.3
if H1(a)>(0)
if check==0
teller=0;
end
teller=teller+H1(a);
check=check+1;
elseif (teller<(-2)) || (H1(a)<(-0.5))
check=0;
teller=0;
elseif check>=1
check=check+1;
teller=teller+H1(a);
end
a=a-1;
%test=[a teller check]
end

if a>x*0.3
snijden(4)=a+check;
end

% if (snijden(4)-snijden(3))>(1.2*(snijden(2)-snijden(1)))
%     snijden(4)=floor(snijden(3)+(1.1*(snijden(2)-snijden(1))));
% end
```