图像曝光
提示:这里可以添加技术概要
核心源码
procedure TForm1.Button1Click(Sender: TObject);
var
p: PByteArray;
//曝光的原理是R,G,B三个分量如果其中任何一个小于128。
//则该分量取反即255-
x, y: Integer;
Bmp: TBitmap;
begin
Bmp := TBitmap.Create;
Bmp.Assign(Image1.Picture.Bitmap);
Bmp.PixelFormat := pf24Bit;
for y := 0 to Bmp.Height - 1 do
begin
p := Bmp.scanline[y];
for x := 0 to Bmp.Width - 1 do
begin
if p[x * 3] < 128 then
p[x * 3] := not p[x * 3]; { TODO : 各分量取反 }
if p[x * 3 + 1] < 128 then
p[x * 3 + 1] := not p[x * 3 + 1];
if p[x * 3 + 2] < 128 then
p[x * 3 + 2] := not p[x * 3 + 2];
end;
end;
Image2.Picture.Bitmap.Assign(Bmp);
Bmp.Free;
end;