You are on page 1of 3

procedure TForm1.Button6Click(Sender: TObject); var i,j:Integer; temp1,temp2,temp3:integer; pixelPointer:PByteArray; originalPixelPointer:PByteArray; G,max1,max2,max3:integer; P:byte; begin G:=2; P:=60; Image5.Picture.Bitmap:=Image1.Picture.

Bitmap; max1:=0; max2:=0; max3:=0; for i:=0 to Image5.Picture.Height-1 do begin pixelPointer:=Image5.Picture.Bitmap.ScanLine[i]; originalPixelPointer:=Image1.Picture.Bitmap.ScanLine[i]; for j:=(0+i) to Image1.Picture.Width-1 do begin if originalPixelPointer[3*j]>=originalPixelPointer[max1] then max1:=j; if originalPixelPointer[3*j+1]>=originalPixelPointer[max1] then max2:=j;

if originalPixelPointer[3*j+2]>=originalPixelPointer[max1] then max3:=j; end; end;

for i:=0 to Image5.Picture.Height-1 do begin pixelPointer:=Image5.Picture.Bitmap.ScanLine[i]; originalPixelPointer:=Image1.Picture.Bitmap.ScanLine[i]; for j:=(0+i) to Image1.Picture.Width-1 do begin temp1:=originalPixelPointer[3*j]+originalPixelPointer[3*j]*((255originalPixelPointer[max1])/originalPixelPointer[max1]); temp2:=originalPixelPointer[3*j]+originalPixelPointer[3*j+1]*((255originalPixelPointer[max2])/originalPixelPointer[max2]); temp3:=originalPixelPointer[3*j]+originalPixelPointer[3*j+2]*((255originalPixelPointer[max3])/originalPixelPointer[max3]); if temp1<=0 then temp1:=0; if temp1>=255 then temp1:=255; if temp2<=0 then temp2:=0; if temp2>=255 then temp2:=255; if temp3<=0 then temp3:=0; if temp3>=255 then temp3:=255; pixelPointer[3*j]:=temp1; pixelPointer[3*j+1]:=temp2; pixelPointer[3*j+2]:=temp3; end;

end; Image5.Refresh; end;

You might also like