Code covered by the BSD License  

Highlights from
Aztec barcode reader

image thumbnail

Aztec barcode reader

by

 

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

rij_ascii=uitlezenrij(rij)
function rij_ascii=uitlezenrij(rij)

% met een procent teken er achter zijn nog niet geverifieerd

lrij=size(rij);
rij_ascii=' ';
mode=63;   %mode 1000 is stop
a=1;
shift=[0 63];
while a<(lrij(2)-4)
    if mode == 46
        c=bin2dec(rij(a:(a+3)));
        a=a+4;
        if c==13%
            mode=63;
            shift=[1 48];
        elseif c==14
            mode=63;
        elseif c==15%
            mode=29;
        elseif c==1
            rij_ascii=[rij_ascii ' '];
        else%
            rij_ascii=[rij_ascii char(c+mode)];
        end   
    else
    c=bin2dec(rij(a:(a+4)));
    a=a+5;
    if mode==63
        if c==27%
            mode=95;
        elseif c==1%
            rij_ascii=[rij_ascii ' '];
        elseif c==28
            mode=95;
        elseif c==29
            mode=0;
        elseif c==30
            mode=46;
        elseif c==31
            a=a+2;  %was mode=1000
        else%
            rij_ascii=[rij_ascii char(c+mode)];
        end
    elseif mode==95
        if c==28
            mode=63; 
            shift=[1 95];
        elseif c==1%
            rij_ascii=[rij_ascii ' '];
        elseif c==29
            mode=0;
        elseif c==30
            mode=46;
        elseif c==31
            a=a+3;
            mode=29;% was mode=1000;
        else
            rij_ascii=[rij_ascii char(c+mode)];
        end
    elseif mode==29
        if c==31
            mode=63;
        elseif c==6
            rij_ascii=[rij_ascii '!'];
        elseif c==26
            rij_ascii=[rij_ascii '?'];
        elseif c==9
            rij_ascii=[rij_ascii ' '];
        elseif c==0
            mode=95;
        else%
            rij_ascii=[rij_ascii char(c+mode)];
        end
    elseif mode==0
        if c==30
            mode=29;
        elseif c<11 ||c==13||c==14||c==15%
            rij_ascii=[rij_ascii char(c+29)];
        elseif c==11%
            rij_ascii=[rij_ascii '('];
        elseif c==12%
            rij_ascii=[rij_ascii ')'];
        elseif c==21
            rij_ascii=[rij_ascii '\'];
        elseif c==28
            mode=95;
        elseif c<21 && c>17%
            rij_ascii=[rij_ascii char(c+76)];
        elseif c==29
            mode=63;
        end
    end
    end
    if shift(1)==1
        shift(1)=2;
    elseif shift(1)==2
        mode=shift(2);
        shift(1)=0;
    end
    %rij_ascii=[rij_ascii '=' num2str(c) ' - '];
end

Contact us