for j := 0 to Form1.Image1.Picture.Height do
begin
R:= (Form1.Image1.Canvas.Pixels[i,j] and $FF0000) shr 16;
G:= (Form1.Image1.Canvas.Pixels[i,j] and $FF00) shr 8;
B:= (Form1.Image1.Canvas.Pixels[i,j] and $FF) ;
Y := Trunc((66*R + 129*G + 25*B + 128)/256.0 + 16);
Cb := Trunc((-38*R - 74*G + 112*B + 128)/256.0 + 128);
Cr := Trunc((112*R - 94*G - 18*B + 128)/256.0 + 128);
if Y<0 then
Y:=0
else if Y>255 then
Y:=255;
if Cr<0 then
Cr:=0
else if Cr>255 then
Cr:=255;
if Cb<0 then
Cb:=0
else if Cb>255 then
Cb:=255;
Y:= Y- 16;
Cb:=Cb- 128;
Cr:=Cr- 128;
R := (298*Y + 409*Cr + 128)/256;
G := (298*Y - 100*Cb - 208*Cr + 128)/256;
B := (298*Y + 516*Cb + 128)/256;
if R<0 then
R:=0
else if R>255 then
R:=255;
if G<0 then
G:=0
else if G>255 then
G:=255;
if B<0 then
B:=0
else if B>255 then
B:=255;
Form1.Image2.Canvas.Pixels[i,j]:=RGB( Trunc(B),Trunc(G),Trunc(R)) ;
end;
下載地址:點擊打開鏈接