Sunday, May 20, 2012

Function Slicing pada pengolahan citra digital


Function Slicing(MInput:Matriks; Value:integer):Matriks;
var
  i,j,k, tempdiv, LevelBit : integer;
  MOutput :Matriks;
begin
    SetLength (MOutput,Length(MInput),Length(MInput[0]));
    LevelBit:=0;
    for i:=0 to Length(MOutput)-1 do
      begin
        for j:=0 to Length(MOutput[0])-1 do
          begin
            tempdiv:=MInput[i,j];
            for k:= 0 to Value do
              begin
                  LevelBit:=tempdiv mod 2;
                  tempdiv:=tempdiv div 2;
              end;
            if LevelBit=1 then
              LevelBit:=255;
            MOutput[i,j]:=LevelBit;
          end;
      end;
    Slicing:=MOutput;
end;

No comments:

Post a Comment