Invert Image is one of image processing to invert the color. The easy way to understand is Change Black Color to White and White to Black, but there are variation if the Red, Green and Blue value have variation.
Invert Image Basically obtain from decrease Value of 255 to Red Pixel Value, 255 to Green Pixel Value and 255 to B Pixel Value.
Below is Source Code for Invert Image Processing in Delphi.
procedure TForm1.ToolButtonInvertClick(Sender: TObject);
var i,j :byte;
PH:PByteArray;
R,G,B : integer;
begin
for i:=0 to FormHasil.ImgHasil.Height-1 do
begin
PH:=FormHasil.ImgHasil.Picture.Bitmap.ScanLine[i];
for j:=0 to FormHasil.ImgHasil.Width-1 do
begin
R:=255-PH[3*j];
G:=255-PH[3*j+1];
B:=255-PH[3*j+2];
PH[3*j]:= R;
PH[3*j+1]:= G;
PH[3*j+2]:= B;
end;
end;
FormHasil.ImgHasil.Repaint;
FormHistogram.Histogram;
end;
Please Comment If I’m Wrong. Comment are widely open…!!
Tidak ada komentar:
Posting Komentar