procedure CompareImagesWithTesting(Image1,Image2:TBitmap);
var x,y:integer;
P1,P2:PRGBTripleArray;
summe1,summe2:integer;
begin
differents := 0;
summe1 := 0;
summe2 := 0;
QueryPerformanceFrequency(freq);
QueryPerformanceCounter(zeit1);
for y := 0
to Image1.Height -1
do
begin
P1 := Image1.ScanLine[y];
P2 := Image2.ScanLine[y];
if not CompareMem(p1,p2,Image1.Width*SizeOf(TRGBTriple))
then
begin
for x := 0
to Image1.Width-1
do
begin
inc(summe1,
RGB(P1[x].rgbtRed,P1[x].rgbtGreen,P1[x].rgbtBlue));
inc(summe2,
RGB(P2[x].rgbtRed,P2[x].rgbtGreen,P2[x].rgbtBlue));
if summe1 <> summe2
then
begin
summe1 := 0;
summe2 := 0;
inc(differents);
end;
end;
end;
end;
QueryPerformanceCounter(zeit2);
Application.ProcessMessages;
Form1.Memo1.Lines.Add(FormatFloat('
0.0000', (zeit2 - zeit1) * 1000 / freq));
Form1.Memo2.Lines.Add(IntToStr(differents));
end;