Sunday, May 20, 2012

function Image Negative Diagonal versi 2 pada pengolahan citra digital


function ImageNegativeDia2(MInput:Matriks):Matriks;
var
  i,j : integer;
  MOutput : Matriks;
begin
  SetLength(MOutput,Length(MInput),Length(MInput[0]));
  if Length(MInput)<Length(MInput[0]) then
  begin
  for i:=1 to Length(MOutput)-1 do
  begin
    for j:=1 to Length(MOutput[0])-1 do
    begin
      if round((j-Length(MInput[0]))/(i-0))<=round((0-Length(MInput[0]))/(Length(MInput)-0)) then
      MOutput[i,j]:=255-MInput[i,j]
      else
      MOutput[i,j]:=MInput[i,j];
    end;
  end;
  end
  else
  begin
  for i:=1 to Length(MOutput)-1 do
  begin
    for j:=1 to Length(MOutput[0])-1 do
    begin
      if (Length(MInput)*j)+(Length(MInput[0])*i)<=(Length(MInput)*Length(MInput[0])) then
      MOutput[i,j]:=255-MInput[i,j]
      else
      MOutput[i,j]:=MInput[i,j];
    end;
  end;
  end;
  ImageNegativeDia2:=MOutput;
end;

No comments:

Post a Comment