Sunday, May 20, 2012

function slicing dalam lingkaran pada pengolahan citra digital


function Slicing2(MInput:Matriks; Value:integer):Matriks;
var
  i,j,r,k,tempdiv, LevelBit : integer;
 MOutput : matriks;
begin
 SetLength (MOutput,Length(MInput),Length(MInput[0]));
    r:=Length(Moutput) div 2;
    for i:= 0 to Length(MOutput)-1 do
      begin
        for j:= 0 to Length(MOutput[0])-1 do
          begin
            if ((i-r)*(i-r)+(j-r)*(j-r))<=r*r then
                begin
                LevelBit:=0;
                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
            else
              MOutput[i,j]:= MInput[i,j];
          end;
      end;
 Slicing2:=MOutput;
end;

No comments:

Post a Comment