Online
Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.287 Beiträge
Delphi 12 Athens
|
Re: Vergleichen zweier BitMaps
13. Nov 2003, 21:34
 Stimmt, meinte natürlich ABS.
 Das mit dem XOR, weis auch nicht was da in meinem Kopf fehlgeleitet wurde. (hatte mir auch ein paar Werte durchgerechnet, und da stimmte es fast)
 Na dann optimieren wir mal in Richtung Graustufen.
Delphi-Quellcode:
Var R1, G1, B1, R2, G2, B2, Re, Ge, Be: Byte;
{je Pixel}
R1 := Bild1.Canvas.Pixels[X, Y] and $0000FF;
G1 := (Bild1.Canvas.Pixels[X, Y] and $00FF00) shr 8;
B1 := (Bild1.Canvas.Pixels[X, Y] and $FF0000) shr 16;
R2 := Bild2.Canvas.Pixels[X, Y] and $0000FF;
G2 := (Bild2.Canvas.Pixels[X, Y] and $00FF00) shr 8;
B2 := (Bild2.Canvas.Pixels[X, Y] and $FF0000) shr 16;
Re := ABS(R1 - R2);
Ge := ABS(G1 - G2);
Be := ABS(B1 - B2);
Bild3.Canvas.Pixels[X, Y] := RGB(Re, Ge, Be);
wird zu:
Delphi-Quellcode:
Var C: Byte;
{je Pixel}
C := ABS((Bild1.Canvas.Pixels[X, Y] and $0000FF) - (Bild2.Canvas.Pixels[X, Y] and $0000FF));
Bild3.Canvas.Pixels[X, Y] := RGB(C, C, C);
oder:
Delphi-Quellcode:
Var C: Byte;
{je Pixel}
C := ABS((Bild1.Canvas.Pixels[X, Y] and $0000FF) - (Bild2.Canvas.Pixels[X, Y] and $0000FF));
Bild3.Canvas.Pixels[X, Y] := (C shl 16) or (C shl 8) or C;
Ein Therapeut entspricht 1024 Gigapeut.
|
|
Zitat
|