Sunday, May 20, 2012

Function negative papan catur pada pengolahan citra digital


function ImageNegative4(MInput:Matriks):Matriks;
var
  i,j : integer;
  MOutput : Matriks;
begin
  SetLength(MOutput,Length(MInput),Length(MInput[0]));
  for i:=0 to Length(MOutput)-1 do
  begin
    for j:=0 to Length(MOutput[0])-1 do
    begin
      if (j>(Length(MInput[0]) div 2)) and (i<=(Length(MInput) div 2)) then
      MOutput[i,j]:=255 - MInput[i,j]
      else
      if (j<=(Length(MInput[0]) div 2)) and (i>Length(MInput) div 2) then
      MOutput[i,j]:=255 - MInput[i,j]
      else
      MOutput[i,j]:=MInput[i,j];
    end;
  end;
  ImageNegative4:=MOutput;
end;

No comments:

Post a Comment